Selecting Data from json Format, is this possible? -
i try select data json source. working 433_trl collect data temperature , humidity sensors in json format file, search , collect needed information. works charm when sensor has unique id this:
{"time" : "2017-03-28 10:06:48", "model" : "prologue sensor", "id" : 9, "rid" : 178, "channel" : 1, "battery" : "low", "button" : 0, "temperature_c" : 21.600, "humidity" : 31}
but 3 of sensors sending information:
{"time" : "2017-03-28 10:06:24", "model" : "kedsum temperature & humidity sensor", "channel" : 3, "temperature_c" : 17.056, "humidity" : 49}
i use following string select temp , humidiy when sensor send unique id:
temp2=$(jq 'select(.rid == 178)| .temperature_c' /tmp/pilight_rtl.txt| xargs -n1 | tail -1)
and tryed this, select name , channel, did not work, use channel , select sometime other sensors sending on selected channel:
temp4=$(jq 'select(.model,.channel == [kedsum temperature & humidity sensor",1])| .temperature_c' /tmp/pilight_rtl.txt| xargs -n1 | tail -1)
now hope, of guys can me here, if possible , how? :)
Comments
Post a Comment