I’m setting up HA to manage dropping and raising my projector screen. Currently everything works, but I’m trying to avoid race conditions and having the screen not end up in weird positions. All that I can do/tell from HA is saying UP and waiting say 1minute and down and then wait 40s and then stop, but I can’t ever “know” where the screen is.
I know there has to be a better way then what I’m doing. Currently this is my setup which I’m looking for advice to improve upon.
I use two booleans, one is “screen moving” and the other is “power on/off” via a smart plug that reports power usage. I then have automations to switch the boolean for power on/off but only once (condition of automation is that it’s not already on/off) so it doesn’t flap. I then have a condition of screen not moving and when the screen is moving I turn that boolean on.
Is there not a way I can configure this all in one entitiy? So that when the power comes on, it finishes closing screen and will not attempt to raise it untill drop is finished and vis versa.
Here is some of my code:
switch:
platform: template
switches:
projector_screen_moving_boolean:
value_template: >
{{ is_state('input_boolean.projector_screen_moving_boolean', 'off') }}
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.projector_screen_moving_boolean
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.projector_screen_moving_boolean
projector_power_boolean:
turn_on:
- service: input_boolean.turn_on
entity_id: input_boolean.projector_power_boolean
turn_off:
- service: input_boolean.turn_off
entity_id: input_boolean.projector_power_boolean
And an automation: (One of many at this point…)
alias: Projector Down
description: ''
trigger:
- platform: state
entity_id: input_boolean.projector_power_boolean
from: 'off'
to: 'on'
condition:
- condition: not
conditions:
- condition: state
entity_id: input_boolean.projector_screen_moving_boolean
state: 'on'
action:
- service: remote.send_command
data:
device: projectorscreen
command: open
entity_id: remote.broadlinkrmpro4_remote
- service: input_boolean.turn_on
data: {}
entity_id: input_boolean.projector_screen_moving_boolean
- delay: '00:00:37.5'
- service: remote.send_command
data:
device: projectorscreen
command: open
entity_id: remote.broadlinkrmpro4_remote
- service: input_boolean.turn_on
data: {}
entity_id: input_boolean.projector_screen_moving_boolean
- delay: '00:00:37.5'
- service: remote.send_command
data:
device: projectorscreen
command: stop
entity_id: remote.broadlinkrmpro4_remote
- service: input_boolean.turn_off
data: {}
entity_id: input_boolean.projector_screen_moving_boolean
mode: single
1 post - 1 participant