Integration via HTTP - Concept/Idea needed

Hi Folks,

I’m in the process of trying out HA (and moste likely completely migrating form openhab) and I have to say, I’m really impressed. Installation was (using the docker image) straight forward, most components found or integratable with a little google directly. (Homematic IP, Homematic, Shelly, …)

Next on my list are my rollershutters which are controlled via homepilot. There is no ready integration, but i know the URL’s to go with.

Basically, to get the current position i have to poll http://homepilot/json?cmd=status and take from the returning json easiest per jsonpath the positions like $.devices[?(@.did==10006)].statusesMap.Position , with different ID’s of cause. I would like to call only once, and update all devices.

Setting is done with sending via put {"name":"GOTO_POS_CMD","value":"75"} to http://homepilot/devices/10006

I’m a bit lost; how do i approach this? Is there a pattern i can follow?

Thanks for any Help,

Michael

Gentle push - I do not need a solution, just the architecture…

I would use node-red for this because you get a reasonable programmable flow (and full JavaScript if you want it). It can read a rest interface (which is what those http calls are) and output to an HA input entity, and then read from a sensor or input entity to send a message back out to the roller blind.

Node red provides far greater flexibility than simple ha automation (in my view). For instance the below is what I use for lights. It doesn’t use rest in this, but it could.

1 Like

@RogerTP : Thanks.

I knew about NodeRed, but never considered using it yet. That was a awsome tipp, opening an entire new world :slight_smile:

Yep. I’ve never used Node Red prior to HA, but I quite enjoy it. I could write some of the stuff I’m doing into function nodes, but to be honest I can’t be bothered. There’s quite a lot of flexibility here for what I need. (By the way I found a bug in the flow above, lights were doing weird things when sunset was after 8pm. Comes of duplicating my Smartthings Webcore code into Node - I hated Webcore, it made you do strange things).

You night be able to do this on node red, but the cleanest method with the most flexibility and tightest integration would be to write your own cover entity using a custom component in Python. See developers.home-assistant.io.

This requires significant Python experience however and willingness to learn the ha backend.

1 Like

You can use RESTful sensors to get the current status. There’s some good examples in the docs describing how to use one sensor, and expose multiple values from the result as attributes on that sensor. From there you can set up multiple template sensors that read those attributes.

And to set postions, you would set up a RESTful command for each device.

2 Likes

@stibbons, my blinds run right now perfectly with node red, but i like to understand the other options i would have had.

If i would do like you suggested, wound’nt i have 2 Entities at he end, the sensor and the command?

How would i combine both into one slider for the UI?

So, sorry if my question is dumb, but wouldit be fair to say, that with a template i combine several entities in a new one?

Mostly true. You’d be combining an entity state or multiple entities’ states and multiple services into a single entity that works like a cover.

1 Like

Thanks! I think i will play with that!