When you enter the ip address in a browser, you get back: {"ip":"185.98.169.39"}
But when I paste this example code into the Developer tools Template Editor, it displays the result: ‘value_json’ is undefined. Shouldn’t it display the above data?
Since it doesn’t, what other coding is needed to retrieve the result from the ip address such that value_json is filled with data?
I want to get the xml data from my ControlByWeb X-410 device and read the temperature.
The device ip address that displays the date in a browser is: 192.168.86.33/state.xml
In Home Assistant, I need to load the raw data from that response into a value or variable that I can then parse to isolate the temperature. I want to poll the device every 15 minutes. I then want to be able to use that temp for Automations for skylights to open/close, etc.
FYI, I purchased a YoLink temp/humidity sensor and it already has HA integration set up, so it’s easy to use. I’d like to have the same functionality with my multiple ControlByWeb devices as some have additional features other than temperature (ie relays, binary sensors, etc.).
Re-reading gave me more insight to the disconnect. Template is used mostly to fetch the state or value of an entity. You need to create the entity using the rest platform.
As @vingerha says, we need to see the format that [Preformatted text](http://192.168.86.33/state.xml) returns to attempt to create the value_template to match.
so…with the json_attributes_path: "$.datavalues" … you can add the content as individual attributes, see the rest integration … or create individual sensors for them with the value in ‘state’…the latter is needed if you want to track history (e.g. show in graphs).
Thank you all for your help! I finally got it working properly with the temperature now available for adding a condition to Automations. Here is the final code: