Error - Command line switches - Command works in terminal but not HA

Lets see if I figure this out before getting a reply!

FYI I’m a noob…

So I’ve been working to get my Radio Thermostat CT80 working with HA.
The current mode and current temperature report to HA. Sweet.

Now I’m making a very dumb command switch to turn the thermostat to OFF mode and another to switch it to HEAT mode and set the temp to 72*F.

The curl commands quoted below work in terminal… The thermostat behaves as anticipated!

Inside config.yaml they bring errors.

 thermostat_off:
   command_on: 'curl "http://192.168.1.123/tstat" -d '{"tmode": 0}' -X POST # OFF'
 thermostat_to_seventy_two: 
   command_on: 'curl -d '{"tmode":1,"t_heat":72}' http://192.168.1.123/tstat'

Errors:

Configuration invalid

Error loading /config/configuration.yaml: while parsing a block mapping in “/config/configuration.yaml”, line 111, column 8 expected <block end>, but found ‘{’ in “/config/configuration.yaml”, line 111, column 59

At least one problem is you’re not using quoting correctly. Your command strings are quoted overall by single-quote characters. So it’s ok to use double-quote characters inside the string. But you’re also trying to use single-quote characters inside the string. That won’t work the way you’re doing it. In YAML, you can “escape” a single-quote character inside a string that is enclosed in single-quotes by entering two single-quote characters together. So, try this:

 thermostat_off:
   command_on: 'curl "http://192.168.1.123/tstat" -d ''{"tmode": 0}'' -X POST # OFF'
 thermostat_to_seventy_two: 
   command_on: 'curl -d ''{"tmode":1,"t_heat":72}'' http://192.168.1.123/tstat'

Good stuff! Thank you that worked :sunglasses:

I’m just wondering, as its not got an off command, because each off state might be different regarding where and when the command happened.

Does HA do a momentary push button option?

The buttons currently stay in the on position once I fire new commands.

Thanks again for your help so far :+1: