I searched and found a few threads but none of them really made a difference, I tried several different ways of setting up the rest sensor but none of them work. Can someone please help? I tried to read how to form the syntax but I fail every time.
I have an energy monitor hooked up to a raspi, and I’m using a software that will output the following, I’m trying to create a sensor to output the “watt” bit, which is how many watts are currently going through my electricity meter so I can monitor the electricity usage in real time. How can I make this “watt” value into a sensor (value shown as 549 on the pasted text)?
Please note this is the raw output from the software and I cannot change the way it is, home assistant keeps telling me “JSON is not a dictionary”.
[{"sensor":{"sensor_id":"0","sensor_title":"Electricity","sensor_clamp":"0","position_id":"3","position_time":"2019-09-20 17:50:46","position_description":"Usage","position_sensor":"0","measure_history":"3650","measure_currency":"Pound","measure_sensor":"0","measure_range":"0","measure_timeframe":"0","measure_timezone":"GMT0","measure_timezone_diff":"0","measure_type":"0","measure_pvoutput_id":"","measure_pvoutput_api":"","measure_scale_factor":"1.00","measure_lower_limit":"0","positions":{"3":{"position":"3","time":"2019-09-20 17:50:46","description":"Usage"}}},"tmpr":"15.7","watt":"549","daily":"12.673 Kwh<br \/>1.8","hourly":"0.374 Kwh<br \/>0.05","weekly":"85.42 Kwh<br \/>12.14","monthly":"312.969 Kwh<br \/>44.47"}]
This is how the sensor is currently set up, and I already tried value_json.watt[0] which yields the same error:
- platform: rest
json_attributes:
- watt
resource: "http://SERVER_URL/php/measureit_functions.php?do=summa$
name: "Power Use Now"
value_template: '{{ value_json.sensor }}'
unit_of_measurement: Watts
device_class: power