I have blinds that i can control with a url.
192.168.178.241/blinds/?ws=90 will close the blinds and 192.168.178.241/blinds/?ws=50 wil open the blinds.
How can I control the blind in home assistant?
I have tried the next lines in configuration.yaml, but then the blind will open every 30 seconds:
I’d suggest adding your blinds as cover entities, so they look a little nicer in the UI (Up and down arrow instead of 2 switches).
For that, we need to do two things:
rest_command:
blinds:
url: >-
{% if direction == "up" %}
http://192.168.178.241/blinds/?ws=50
{% elif direction == "down" %}
http://192.168.178.241/blinds/?ws=90
{% endif %}
This will create a service rest_command.blinds which we can call. The direction parameter will set the direction.
Now, we have to create a template cover:
cover:
- platform: template
covers:
bedroom_left: # Change this to sth. you like (one word, lowercase)
# Check https://www.home-assistant.io/integrations/cover/#device-class for available device classes
device_class: blind
friendly_name: "Bedroom Left" # This name will show up in the UI
open_cover:
service: rest_command.blinds
data:
direction: up
close_cover:
service: rest_command.blinds
data:
direction: down
Home Assistant has more features to offer for blinds, like setting the blinds to a certain percentage, stopping them, etc.
Is there a URL you can go to to fetch the current position?
Also - Which blinds are you using? Maybe there’s a better way of integrating them.
@tom_l Looking at the documentation for a rest switch, I’m wondering if your YAML will work - the URLs seem to require a GET request, which isn’t supported by the switch integration, and the body_on and body_off are the POST payload data, aren’t they?
Perhaps I’m getting something wrong though.
The blinds are controlled by a ESP8266. The blinds are not going up or down, but the angle of the sheets are changing by the number giving by ws. (0=sheets are at 20 degrees ,50=sheets are horizontal,90=160 degrees)
Ah, I see
Well, maybe a bit of a surprise, Home Assistant supports that natively as well
Take a look at the tilt position service. To use this effectively, you should have a linear scale of angles (increasing the number by one should add a fixed number of degrees).
If you are the one who programmed the ESPs, you might want to look into using ESPHome, more specifically, one of their Cover components.
ESPHome integrates natively with Home Assistant, if they are on the same network, Home Assistant even auto-discoveres ESPHome devices and presents the entities automatically
More than that, you don’t even need to install anything on your computer for that, with the ESPHome addon, you can program the ESP8266/ESP32 directly from the Web UI