@Madelinot Hmmm…this page leads me to believe that command line sensors don’t work if you’re using hass.io.
Hummm… Thanks for pointing it out. That’s too bad. It works fine from the command line using SSH to the server; I can get results…
I just tried it and I do get values within Home Assistant using a simple command like this:
command: '/usr/bin/curl --user username:password "http://ISYIPAddress/rest/nodes/ISYnode_address/ST" 2>&1 | grep -om1 value'
That simple command returns the word “value”. So, I think if I can figure out how to parse the content returned, I would be in business.
I also tested some REST commands and they seem to work. If I ever got all this working, I promise to post the solution back here. One of the reasons why I want to do it this way is that I want to be able to control my thermostat (CT101) by using Celsius degrees. That means I will have to apply a conversion inline. Unfortunately, that z-wave thermostat only reports in Fahrenheit, not Celsius.
Thanks again,
I don’t think you’ll be able to extract the temperature from the REST response without the use of the Perl option in grep. The lookbehind assertion used is a Perl specific feature, and I wasn’t able to come up with a way to get the temperature only without it.
The value is sometimes an integer, sometimes not. That may be why the . is not working in my case. The REST API seems to work well, as intended.
I have HA (latest version) running on HASSIO on a Raspberry PI.
Thanks for the detailed explanation. I will post if I find an answer.
Using AWK instead of GREP leads to better results. A little ugly, but it works:
awk -F"\"" '{print $8}'
Update: I have all of this mostly working, using AWK instead of GREP. I also convert values on the fly between F and C. I get values into HA from my thermostat connected to ISY994. I can also set the mode (Heat, Off) using REST commands. The ONLY thing left now if to set the heat setpoint using REST. The command I’m using is this:
url: http://myIPAddress/rest/nodes/ISYNodeAddress/set/CLISPH/{{ (states.input_number.heat_setpoint.state | float * 1.8 + 32) | int }}
That REST call does not work and gives “Error 404 on call…”. The call seems to be formatted correctly with proper Fahrenheit values coming from the variable. Any idea?
Found it. I had to use cmd
, just like all other REST commands. For some reason, using set
in the call does not work.
It seems I now have it all working. I will post a message with my complete solution once I have some time. Thanks to all.
That’s odd, using set
works fine for me. Glad you’ve got it working!
Yeah, very strange. I’m using the latest version of the ISY code (v 5.0.11) and also the latest version of Home Assistant (v 0.59.2). My CT101 zwave thermostat is connected to the ISY directly.
Not sure why there would be differences with you. Thanks for all your hard work figuring it all out, you saved me a lot of time. Like I said, I will post my solution and give you the credit.
Hey @DetroitEE: I’m currently working on making a lot of improvements to the ISY994 component. I’ve got a PR out right now that makes door and leak sensors work “natively” in Home Assistant, including their heartbeat feature.
Next up I’m going to make it properly detect the various Insteon device types without needing to resort to naming items specifically in the ISY994.
The thermostat is one that I’ve been curious about. I’ve been thinking about picking up the Insteon thermostat to replace my dumb thermostat, partially because it would give me an opportunity to make it work perfectly in Hass. In the meantime you and I could sync up and provide me with some details about how the thermostat is represented in the ISY so I can see how possible this would be. I’d love to get some example dumps of your /rest/nodes
endpoint so I can see how thermostats are treated in there.
@OverloadUT I’d be happy to help out in any way I can to improve the ISY component.
Here’s the relevant endpoints from rest/nodes
, there are 3 total: the thermostat itself, and two binary sensors that turn on when the thermostat is calling for heat/cool.
<node flag="128">
<address>28 9C CC 1</address>
<name>Thermostat</name>
<type>5.11.13.0</type>
<enabled>true</enabled>
<deviceClass>1</deviceClass>
<wattage>1000</wattage>
<dcPeriod>60</dcPeriod>
<startDelay>0</startDelay>
<endDelay>0</endDelay>
<pnode>28 9C CC 1</pnode>
<ELK_ID>A05</ELK_ID>
<property id="ST" value="136" formatted="68.00" uom="degrees"/>
<property id="CLIMD" value="1" formatted="Heat" uom="n/a"/>
<property id="CLISPC" value="154" formatted="77.00" uom="degrees"/>
<property id="CLISPH" value="136" formatted="68.00" uom="degrees"/>
<property id="CLIHUM" value="32" formatted="32.00" uom="%"/>
</node>
<node flag="0">
<address>28 9C CC 2</address>
<name>Thermostat - Cool Ctl</name>
<type>5.11.13.0</type>
<enabled>true</enabled>
<deviceClass>1</deviceClass>
<wattage>1000</wattage>
<dcPeriod>60</dcPeriod>
<startDelay>0</startDelay>
<endDelay>0</endDelay>
<pnode>28 9C CC 1</pnode>
<ELK_ID>A06</ELK_ID>
<property id="ST" value="0" formatted="Off" uom="%/on/off"/>
</node>
<node flag="0">
<address>28 9C CC 3</address>
<name>Thermostat - Heat Ctl</name>
<type>5.11.13.0</type>
<enabled>true</enabled>
<deviceClass>1</deviceClass>
<wattage>1000</wattage>
<dcPeriod>60</dcPeriod>
<startDelay>0</startDelay>
<endDelay>0</endDelay>
<pnode>28 9C CC 1</pnode>
<ELK_ID>A07</ELK_ID>
<property id="ST" value="0" formatted="Off" uom="%/on/off"/>
</node>
The commands as documented in the ISY REST api documentation all seem to work as expected, with the quirk that the insteon thermostat temperature and setpoints are all 2x their actual values in degrees F. The commands for setting the thermostat mode are documented in the OP. Note that I did not document the thermostat mode (CLIMD) setting for the “Fan”, “Program Auto”, “Program Heat”, and “Program Cool” modes, because I don’t see much point in them, but they should probably be included for the sake of completeness if you are going to add it to the component. Fan is 4, Program Auto is 5, Program Heat is 6, and Program Cool is 7. One other quirk that is not documented is that you can increment/decrement the setpoints by 1 by using the /node/cmd/BRT and /node/cmd/DIM commands.
Let me know if you need any more info.
Hey, I just wanted to follow up and thank you for the post. I need to finish my ISY994 refactor that will fix 5.0.10+ firmware support fist, and I plan on tackling the thermostat issue next. I’ll probably end up buying an Insteon thermostat, as soon as I can figure out how to make it work in a 2-wire system.
I would probably go with sed instead of awk. In order to use awk you’re going to have to make an assumption that the XML will always come back in the same order, which I’m not sure I would trust. Doing the following works for me:
- platform: command_line
name: House Temp
command: /usr/bin/curl -s --user ISYUser:ISYPass
“http://ISYAddress/rest/nodes/xx%20xx%20xx%20x/ST” 2>&1 | sed ‘s/^.formatted="//;s/".$//’
value_template: ‘{{ value | round(1) }}’
unit_of_measurement: °F
scan_interval: 5
I will have to try that. Do you know if SED will work with HASSio?
Has anyone gotten the grep or sed command to work with HASSIO? Hassio doesn’t support the -P option with grep.
I have HASSIO running and I have Insteon Thermostat configured an ISY. I am able to get a response using the REST API using a curl, but I having issues with Regex portion.
This is an old thread, but for anyone still watching: I’m working on integrating the ISY Thermostats through the climate
module: Insteon Thermostat 2441TH for ISY
Hello, just getting started with HASS, so my apologies for my ignorance. Went through guide but cannot get Zwave thermostat setup correct. Just to clarify, are the different code snippets above all going into Configuration.yaml, or different .yaml files? If so, do names matter etc? Thanks
I would recommend trying out the link in the post above yours, looks like they have developed a much cleaner way of integrating the Insteon thermostat.