Hello,
I have my home running HA and a bunch of Arduinos for pumps, zones, reading the status of various systems.
I wrote custom software for them, I GET URLs from them and they express themselves speaking json and everything works with only minor glitches.
But there I would very much like to improve and simplify some things, first one being how am I talking to switches. I am using the command line with curl and jq, and I think this is a ton of overhead. For example:
switch:
- platform: command_line
switches:
command_on: "/usr/bin/curl -s -X GET http://saladebombas:8080/EncenderPlanta?planta=2"
command_off: "/usr/bin/curl -s -X GET http://saladebombas:8080/ApagarPlanta?planta=2"
command_state: "/usr/bin/curl -s -X GET http://saladebombas:8080/Estado | jq '.bomba[2]'"
value_template: '{{ value_json == "true" }}'
friendly_name: Suelo planta segunda
I would like to move that to RESTful Switch. No problem, just a few changes and I’d be able to do something like this:
- platform: rest
resource: http://saladebombas:8080/Planta/2
value_template: '{{ value_json == "true" }}'
friendly_name: Suelo planta segunda
My question is, can I get the state of all the switches in one fell swoop? Poor old Arduinos do not have horsepower to spare, and I think it would be much kinder to them if there was a way to express a way to get with a single POST the value of all the switches that a particular Arduino has. Something like:
- platform: rest
resource: http://saladebombas:8080/Planta
friendly_name: Suelos
Of course, any other comment on my plan or pointers would be appreciated as well.
Thanks.