hello,
I am working on a project to automate my blinds. I already have the ability to control my blinds with physical buttons as well as virtual buttons in my home assistant. But now I want to introduce a code I found online that controls the blinds with the sun position. I want to be able to choose which mode I want, so when its in automated mode, my blinds will be set to the sun position, and when it’s in manual mode, I can adjust with the code I already have.
I am not really familiar with the Yaml code, so I hope someone of you can help me with this.
and also sorry if my English is not that good.
the link to the article about automated blinds with sun positioning:
here my existing code:
services:
- service: control_blind
variables:
target: int
then:
- stepper.set_target:
id: my_stepper
target: !lambda 'return target;'
- sensor.template.publish:
id: position
state: !lambda 'return target;'
captive_portal:
stepper:
- platform: uln2003
id: my_stepper
pin_a: GPIO26
pin_b: GPIO25
pin_c: GPIO33
pin_d: GPIO32
max_speed: 250 steps/s
binary_sensor:
- platform: gpio
pin: GPIO12
name: "Blinds up"
id: physical_control_up
on_press:
then:
- stepper.set_target:
id: my_stepper
target: 6000
- sensor.template.publish:
id: position
state: !lambda return id(my_stepper).target_position;
- platform: gpio
pin: GPIO14
name: "Blinds stop"
id: physical_control_stop
on_release:
then:
- stepper.set_target:
id: my_stepper
target: !lambda return id(my_stepper).current_position;
- sensor.template.publish:
id: position
state: !lambda return id(my_stepper).current_position;
- platform: gpio
pin: GPIO27
name: "Blinds down"
id: physical_control_down
on_press:
then:
- stepper.set_target:
id: my_stepper
target: 0
- sensor.template.publish:
id: position
state: !lambda return id(my_stepper).target_position;
cover:
- platform: template
name: "My Blind"
id: my_blind
device_class: blind
open_action:
- stepper.set_target:
id: my_stepper
target: 6000
- sensor.template.publish:
id: position
state: !lambda return id(my_stepper).target_position;
close_action:
- stepper.set_target:
id: my_stepper
target: 0
- sensor.template.publish:
id: position
state: !lambda return id(my_stepper).target_position;
stop_action:
- stepper.set_target:
id: my_stepper
target: !lambda return id(my_stepper).current_position;
- sensor.template.publish:
id: position
state: !lambda return id(my_stepper).current_position;
optimistic: true
assumed_state: true
sensor:
- platform: template
name: "My Blind Position"
id: position