Could anyone please help? I must be close.
I have setup a command_line sensor in Home Assistant and have a python script for it nearing completion.
sensor pH: - platform: command_line name: pH command: "python3 /root/config/read.py" value_template: "{{ value.field1 }}"
#!/usr/bin/python3 from requests import get response = get("https://api.thingspeak.com/channels/1088412/feeds.json?api_key=PJ6Z8DAA06A0T1DG&results=1") print(response.json()["feeds"])
When run in Terminal the result is:
[{“created_at”:“2021-01-16T10:43:23Z”,“entry_id”:186442,“field1”:“6.448”}]}
How can I further narrow the result down to make it suitable for Home Assistant’s command_line sensor? My goal is to extract only the “6.448” value. Thank you so much, in advance!