What is the best way to grab http output into a sensor? edit: and change icon/color?

So I have eight Somfy Glydea motors controlling my curtains. Normally one would use Somfy RTS and maybe the Somfy Tahoma Switch, and the integration that works with this (it is a good integration, and I believe it nowadays support local API). It is after all the “preferred solution” - however it is a 433MHz one-way communication and well it fails from time to time like a lot of other 433MHz solutions. It is by design if I say so.

So I got myself a bunch of ESP32-C6 boards, one per motor, and installed some software and well pluged it into my Somfy Glydea 35 RTS motors. It works lovely, no misses and rapid like nothing before (I had to put in delay between every transmission when using RTS) - I am super happy.

Since I also design the software, a smal WEB server, on the ESP32-C6, I have also included a status request from the motor to tell me where the curtains are (open/closed/“my position”).

So I can send as a shell command this:
somfy_status: "curl http://10.168.10.'{{gardin}}'/?STATUS/"

It will return “Open” / “Close” / “MyPosition” - but how do I grab this and create a sensor?
And/Or should I change from Shell command to REST or something?
I feel a bit lost here… Help?

RESTful Sensor - Home Assistant (home-assistant.io)

So follow up on this: I would love to be able to dynamically change icon and icon color depending on the returned status. However a RESTful sensor seems not to be able to do so or what am I missing?

In the Link Chris referenced, icon is listed as a variable that can be set with a template.

I would suggest that you create a template cover so you can interact with your curtains as if they were natively supported.

For color, the backend knows nothing about colors on the frontend. You have to set color in the front end, and you could choose a card which allows you to specify color with a template that is based on the value of the sensor.

You might also look into ESPHome; you probably could have just programmed your ESP32-C6 boards with that, and they would natively interact with HA’s API and presented a cover entity directly to HA.

Regarding ESPHome - yes I did consider that, however in the end I preferred to have a complete stand-alone solution. One of my thoughts are of course to try to make each ESP32-C6 into a ZigBee unit…

Thanks for the advice about icon - I will look into that!

Okay…

This time everything with the icon worked. I was for some reason locked into icon_template - not only just the key word icon - this solved everything…

Glad you got it to work!

Just as a note, in case you have any interest in ESPHome in the future: devices flashed with ESPHome don’t rely on any interaction with HA unless for some reason you program them that way (which is generally a bad idea). They operate as independent devices. ESPHome allows primarily two benefits:
1- You can write “code” with a YAML config file
2- You can (but do not have to) configure your device to easily send/receive data to/from HA. Entities created by the code on your device can optionally be automatically be discovered by HA.

Thanks for your note!

Do you by any chance know if ESP32-C6 is supported even? The latest I can read says something about ESP32-C3 is maybe supported kind-of?

The list of boards that are supported are on this page, There are two boards shown that have the ESP32C6 MCU. It looks like support was added in the 2023.9 release, this is the PR.

Edit- note that some features are still missing; notably Zigbee and Matter support.

Well I guess this is more or less the thing why I decided to go my own way:
Sparkfun ESP32-C6

I happened to choose this board for it’s very small size and integrated USB-C. There for sure will be others, but well it was what I could get my hands on so to say. I hope that I in the future can move to ESPHome - it would be very nice. Or I will continue to develop my own code in Arduinio.

And this is kind of my challenge: There are sooooo much information out on the internet, that one can not always get the correct or even any information sometimes. One might just use the wrong search words in web searches, something I do regularly since I simply did not grow up in a English speaking family - I use the words I know, and well try from there…

Anyway very large thanks for all help, and comments. They are appreciated!