I have a postgreSQL DB that stores UTC time field and a data field with JSON in it from a Nest thermostat. In the data from Nest I get a value that tells me if the AC is ON (true) or OFF (false). I want to be able to count the times it is either true (ON) or false (OFF) and graph it. The data looks like this and I get it every minute:
{ "current_state":{ "mode":"cool", "temperature":70.50200000000000954969436861574649810791015625, "humidity":54, **"ac":false,** "heat":false, "alt_heat":false, "fan":false, "auto_away":0, "manual_away":false, "structure_away":false, "leaf":true, "battery_level":3.91199999999999992184029906638897955417633056640625, "active_stages":{ }, "eco_mode":"schedule", "eco_temperatures":{ } }, "target":{ "mode":"cool", "temperature":84.6999680000000125801307149231433868408203125, "time_to_target":0 }, "name":"Upstairs Office \/ RTU-11", "auto_cool":84, "auto_heat":false }
I am trying to graph data->‘current_state’->>‘ac’ when its set to true