Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95528

Need help integrating REST devices

$
0
0

@AlfredoSola wrote:

Hello.

I am in the process of migrating from my homebrew control panel based in Javascript to HASS, which I am running on an RPi 3 (and will probably move to a 4 with an A2 SD in the future, but that is another story).

I have studied, written some configuration,yaml, and got some stuff to work like UVC cameras and temperature sensors. However, there is an issue I have been unable to work out.

The issue I am facing is in integrating my devices. I have a bunch of Arduinos that accept GET commands and report their status as json. For instance, here is something from my pump room Arduino:

alfredo@panel:~ $ curl 'http://saladebombas:8080/Estado'
{"status": "success","modo": "invierno","TRef": "25.00","ACS": "false","bomba": ["true","false","false"], "temperatura": ["25.31","46.63","45.94"],"memoria": "6781","puertos crujis": "1","EEPROM": ["0","15","0","25","0"]}

(please excuse names in Spanish, I never thought I’d have to share this much)

If I want to start the heating pump from the ground floor, I issue a GET command like this and get this response:

alfredo@panel:~ $ curl 'http://saladebombas:8080/EncenderPlanta?planta=0'
{"status" : "success"}

Now, with the sensor integration I am able to read the temperatures off one of my Arduinos and have a fancy card with a temperature history. So that works for me. Great!.

The problem I have is sending commands and tracking the status. The classic switch, actually.

I have tried to use the switch integration, but I don’t really understand how to let it know that I want to GET a resource to switch on, and another to switch off. Then I moved to the template switch, but that requires the device to accept POST commands which my devices don’t. I could do that if there is a compelling reason (like for example “dude, everyone does it that way”), but if I went with GET commands it’s because of simplicity in the server as Arduinos are not very powerful platforms.

I did modify the status of the pumps from “0” and “1” (which is a literal readout of the pin status) to “true” and “false” to try and make it easier on the integration.

I also played with the RESTful binary sensor, but couldn’t get it to work either.

So my question to the community is, how would you go about integrating these Arduinos? Would you modify the Arduinos themselves to make them behave consistently with some popular platform and easier to integrate, or not? If yes, which platform should I use as an example? Either way, could you give me an idea of what integration to use and roughly how to go about it?

Any ideas, and also pointers to others that may have described similar setups, would be appreciated.

Thanks!

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95528

Trending Articles