ukro
October 2, 2020, 10:08pm
1
Hello there !
I’ve installed hass 3days ago and very happy with the result, but i’m now struggling with a puzzle that i need help from the powerfull community minds
Intro:
As i don’t have any smart home stuff and i have RF remote control for exterior blinds, i dismount the RF controller, solder the switches to the 5V 8channel relay and put it on the GPIO of RPI(HA-Haspbian).
The remote control consist of buttons (UP,STOP,DOWN,CHANGE CHANNEL)
RF remote:
To switch channel, you need first press the change channel button and after 1 second press again to increase the channel to the next, of total 5 chanels.
What i have:
config yaml
input_number:
slider1:
name: rolety_number
min: 1
max: 6
step: 1
switches yaml
- platform: rpi_gpio
ports:
5: rolety_channel_change
6: rolety_down
13: rolety_stop
19: rolety_start
invert_logic: true
automation
- id: '1601670769347'
alias: rolety_number_increase
description: ''
trigger:
- platform: state
entity_id: switch.rolety_channel_change
condition: []
action:
- service: switch.turn_on
data: {}
entity_id: switch.rolety_channel_change
- delay: 00:00:01
- service: switch.turn_off
data: {}
entity_id: switch.rolety_channel_change
- delay: 00:00:01
- service: switch.turn_on
data: {}
entity_id: switch.rolety_channel_change
- delay: 00:00:01
- service: switch.turn_off
data: {}
entity_id: switch.rolety_channel_change
- service: input_number.increment
data:
entity_id: input_number.slider1
- delay: 00:00:05
mode: single
- id: '1601672201021'
alias: rolety_channel_restart
description: ''
trigger:
- platform: numeric_state
entity_id: input_number.slider1
above: '5'
condition: []
action:
- service: input_number.set_value
data:
value: 1
entity_id: input_number.slider1
mode: single
Situation now:
So on my UI i have a slider just for me to see the state.
When executing the automation rolety_number_increase the number is increasing and when it hits
condition state from 5 to 6, it resets to 1.
The relay is working correctly with the switch. And the number is holding after restart.
Problem:
How can i do next? :
I want to have a button1 for example, it have a value lets say 3, and it will trigger the automation until it will hit the slider state 3, then it will hit the switch rolety_start to rise the blinds
My first post, if i insert something incorrectly sorry, will be happy to fix
Thank you for any help!!
ukro
October 5, 2020, 11:14am
2
Solved by putting condition inside action and trigger the automation
auto yaml
- id: '1601810050556'
alias: rolety_number_increase_test_4
description: ''
trigger: []
condition: []
action:
- choose:
- conditions:
- condition: template
value_template: '{{states.input_number.slider1.state!=states.input_number.slider2.state}}'
sequence:
- service: switch.turn_on
data: {}
entity_id: switch.rolety_channel_change
- delay: 00:00:01
- service: switch.turn_off
data: {}
entity_id: switch.rolety_channel_change
- delay: 00:00:01
- repeat:
until:
- condition: template
value_template: '{{states.input_number.slider1.state==states.input_number.slider2.state}}'
sequence:
- service: switch.turn_on
data: {}
entity_id: switch.rolety_channel_change
- delay: 00:00:01
- service: switch.turn_off
data: {}
entity_id: switch.rolety_channel_change
- service: input_number.increment
data: {}
entity_id: input_number.slider1
- delay: 00:00:01
default: []
- id: '1601800879799'
alias: Rolety up
description: ''
trigger: []
condition: []
action:
- delay: 00:00:02
- choose:
- conditions:
- condition: template
value_template: '{{states.input_number.slider1.state!=states.input_number.slider2.state}}'
sequence:
- repeat:
until:
- condition: template
value_template: '{{states.input_number.slider1.state==states.input_number.slider2.state}}'
sequence:
- delay: 00:00:01
default: []
- service: switch.turn_on
entity_id: switch.rolety_start
mode: single
- id: '1601736998687'
alias: slider_set_state_3
description: ''
trigger: []
condition: []
action:
- service: input_number.set_value
data:
value: '3'
entity_id: input_number.slider2
- service: automation.trigger
data: {}
entity_id: automation.rolety_number_increase_test_4
mode: single
- id: '1601714161511'
alias: Delay off for rolety_up
description: ''
trigger:
- platform: state
entity_id: switch.rolety_start
to: 'on'
from: 'off'
condition: []
action:
- delay: 00:00:01
- service: switch.turn_off
entity_id: switch.rolety_start
mode: single
- id: '1601672201021'
alias: rolety_channel_restart
description: ''
trigger:
- platform: numeric_state
entity_id: input_number.slider1
above: '5'
condition: []
action:
- service: input_number.set_value
data:
value: 1
entity_id: input_number.slider1
mode: single
- id: '1601724739427'
alias: rolety_number_increase_test
description: ''
trigger:
- platform: state
entity_id: switch.rolety_channel_change_button
to: 'on'
from: 'off'
condition: []
action:
- service: switch.turn_on
data: {}
entity_id: switch.rolety_channel_change
- delay: 00:00:01
- service: switch.turn_off
data: {}
entity_id: switch.rolety_channel_change
- delay: 00:00:01
- repeat:
until:
- condition: state
entity_id: input_number.slider1
state: value_template {{ states.input_number.slider2.state | float }}
sequence:
- service: switch.turn_on
data: {}
entity_id: switch.rolety_channel_change
- delay: 00:00:01
- service: switch.turn_off
data: {}
entity_id: switch.rolety_channel_change
- service: input_number.increment
data: {}
entity_id: input_number.slider1
- delay: 00:00:01
mode: single