Hey petro,
thank you for your reply. Well I do not really care if it is shell or python :).
Just tried the code you provided and I get
Script script.adjust_again already running.
Hey petro,
thank you for your reply. Well I do not really care if it is shell or python :).
Just tried the code you provided and I get
Script script.adjust_again already running.
What about:
adjust_dim_level:
sequence:
- service: script.turn_off
entity_id: script.adjust_again
- condition: template
value_template: "{{ steps|int > 0 }}"
- service_template: "{{ command }}"
- service: script.adjust_again
data_template:
command: "{{ command }}"
steps: "{{ steps|int - 1 }}"
adjust_again:
sequence:
- service: script.turn_off
entity_id: script.adjust_dim_level
- service: script.adjust_dim_level
data_template:
command: "{{ command }}"
steps: "{{ steps }}"
I was kind of thinking the same thing, but with wait_templates instead of cancellations. My original suggestion only had a wait_template in one of the scripts because I assumed the other would run long enough to not need the wait_template. So I think either could fix the “already running” problem.
But what are your thoughts on the “steps is undefined” error? That just doesn’t make any sense to me at all. Or could it just be a side effect of the scripts not properly waiting for each other?
I’m not even sure where that would come from, unless he’s pressing the “ACTIVATE” button in the UI and not letting the automation handle starting it.
EDIT: It looks like he is using the buttons. That error makes sense when using the buttons.
@sunny, your scripts will not work when you press the AUSFUHREN button. Only activate the script from the slider.
Thats what I’m doing. I just presse the “Ausführen” button to check what it does :).
Still not working with:
adjust_dim_level:
sequence:
- service: script.turn_off
entity_id: script.adjust_again
- condition: template
value_template: "{{ steps|int > 0 }}"
- service_template: "{{ command }}"
- service: script.adjust_again
data_template:
command: "{{ command }}"
steps: "{{ steps|int - 1 }}"
adjust_again:
sequence:
- service: script.turn_off
entity_id: script.adjust_dim_level
- service: script.adjust_dim_level
data_template:
command: "{{ command }}"
steps: "{{ steps }}"
Should I post my whole configuration once again? Maybe there is another bug inside my configs.
I mean, do you have any information in the logs when you move the slider?
You should:
only paste the log lines that were added between steps 1 and 3.
If you mean home-assistant.log --> no entries regarding the slider. I dont even get the ‘steps’ is undefined error any more.
change your logging level to info and try again
2018-07-27 22:39:39 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=switch, service_call_id=1976904400-105, service_data=entity_id=switch.office_light, service=turn_on>
2018-07-27 22:39:39 INFO (Thread-12) [homeassistant.components.switch.command_line] Running command: /home/homeassistant/.homeassistant/shell_scripts/light/office_on-off.sh
2018-07-27 22:39:39 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=switch.office_light, old_state=<state switch.office_light=off; friendly_name=office_light, assumed_state=True @ 2018-07-27T22:38:59.233600+02:00>, new_state=<state switch.office_light=on; friendly_name=office_light, assumed_state=True @ 2018-07-27T22:39:39.251424+02:00>>
2018-07-27 22:39:39 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-105>
2018-07-27 22:39:39 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=group.all_switches, old_state=<state group.all_switches=off; friendly_name=all switches, order=0, assumed_state=True, auto=True, entity_id=('switch.office_light',), hidden=True @ 2018-07-27T22:38:59.244414+02:00>, new_state=<state group.all_switches=on; friendly_name=all switches, order=0, assumed_state=True, auto=True, entity_id=('switch.office_light',), hidden=True @ 2018-07-27T22:39:39.265684+02:00>>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=input_number, service_call_id=1976904400-106, service_data=entity_id=input_number.office_dimmer, value=70, service=set_value>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=input_number.office_dimmer, old_state=<state input_number.office_dimmer=100.0; min=0.0, step=10.0, max=100.0, mode=slider, icon=mdi:lightbulb @ 2018-07-27T22:39:28.481034+02:00>, new_state=<state input_number.office_dimmer=70.0; min=0.0, step=10.0, max=100.0, mode=slider, icon=mdi:lightbulb @ 2018-07-27T22:39:45.674167+02:00>>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-106>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.components.automation] Executing Dim light
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event logbook_entry[L]: name=Dim light, domain=automation, entity_id=automation.dim_light, message=has been triggered>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script Dim light: Running script
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script Dim light: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-107, service_data=command=shell_command.decrease_level_office, steps=3, service=adjust_dim_level>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Running script
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-108, service_data=entity_id=['script.adjust_again'], service=turn_off>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-108>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Test condition template: True
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=shell_command, service_call_id=1976904400-109, service_data=, service=decrease_level_office>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-109>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-110, service_data=command=shell_command.decrease_level_office, steps=2, service=adjust_again>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_again: Running script
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_again: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-111, service_data=entity_id=['script.adjust_dim_level'], service=turn_off>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=script.adjust_dim_level, old_state=<state script.adjust_dim_level=off; friendly_name=adjust_dim_level, last_triggered=2018-07-27T22:39:29.438433+02:00 @ 2018-07-27T22:38:20.402067+02:00>, new_state=<state script.adjust_dim_level=off; friendly_name=adjust_dim_level, last_triggered=2018-07-27T22:39:45.708662+02:00, last_action=call service @ 2018-07-27T22:38:20.402067+02:00>>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-111>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_again: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-112, service_data=command=shell_command.decrease_level_office, steps=2, service=adjust_dim_level>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Running script
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-113, service_data=entity_id=['script.adjust_again'], service=turn_off>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=script.adjust_again, old_state=<state script.adjust_again=off; friendly_name=adjust_again, last_triggered=2018-07-27T22:39:29.408363+02:00 @ 2018-07-27T22:38:20.405674+02:00>, new_state=<state script.adjust_again=off; friendly_name=adjust_again, last_triggered=2018-07-27T22:39:45.774989+02:00, last_action=call service @ 2018-07-27T22:38:20.405674+02:00>>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-113>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Test condition template: True
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=shell_command, service_call_id=1976904400-114, service_data=, service=decrease_level_office>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-114>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-115, service_data=command=shell_command.decrease_level_office, steps=1, service=adjust_again>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_again: Running script
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_again: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-116, service_data=entity_id=['script.adjust_dim_level'], service=turn_off>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=script.adjust_dim_level, old_state=<state script.adjust_dim_level=off; friendly_name=adjust_dim_level, last_triggered=2018-07-27T22:39:45.708662+02:00, last_action=call service @ 2018-07-27T22:38:20.402067+02:00>, new_state=<state script.adjust_dim_level=off; friendly_name=adjust_dim_level, last_triggered=2018-07-27T22:39:45.803645+02:00, last_action=call service @ 2018-07-27T22:38:20.402067+02:00>>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-116>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_again: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-117, service_data=command=shell_command.decrease_level_office, steps=1, service=adjust_dim_level>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Running script
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-118, service_data=entity_id=['script.adjust_again'], service=turn_off>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=script.adjust_again, old_state=<state script.adjust_again=off; friendly_name=adjust_again, last_triggered=2018-07-27T22:39:45.774989+02:00, last_action=call service @ 2018-07-27T22:38:20.405674+02:00>, new_state=<state script.adjust_again=off; friendly_name=adjust_again, last_triggered=2018-07-27T22:39:45.873181+02:00, last_action=call service @ 2018-07-27T22:38:20.405674+02:00>>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-118>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Test condition template: True
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=shell_command, service_call_id=1976904400-119, service_data=, service=decrease_level_office>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-119>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-120, service_data=command=shell_command.decrease_level_office, steps=0, service=adjust_again>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_again: Running script
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_again: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-121, service_data=entity_id=['script.adjust_dim_level'], service=turn_off>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=script.adjust_dim_level, old_state=<state script.adjust_dim_level=off; friendly_name=adjust_dim_level, last_triggered=2018-07-27T22:39:45.803645+02:00, last_action=call service @ 2018-07-27T22:38:20.402067+02:00>, new_state=<state script.adjust_dim_level=off; friendly_name=adjust_dim_level, last_triggered=2018-07-27T22:39:45.902145+02:00, last_action=call service @ 2018-07-27T22:38:20.402067+02:00>>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-121>
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.helpers.script] Script adjust_again: Executing step call service
2018-07-27 22:39:45 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-122, service_data=command=shell_command.decrease_level_office, steps=0, service=adjust_dim_level>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Running script
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Executing step call service
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=script, service_call_id=1976904400-123, service_data=entity_id=['script.adjust_again'], service=turn_off>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=script.adjust_again, old_state=<state script.adjust_again=off; friendly_name=adjust_again, last_triggered=2018-07-27T22:39:45.873181+02:00, last_action=call service @ 2018-07-27T22:38:20.405674+02:00>, new_state=<state script.adjust_again=off; friendly_name=adjust_again, last_triggered=2018-07-27T22:39:45.971784+02:00, last_action=call service @ 2018-07-27T22:38:20.405674+02:00>>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-123>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.helpers.script] Script adjust_dim_level: Test condition template: False
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-122>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=script.adjust_dim_level, old_state=<state script.adjust_dim_level=off; friendly_name=adjust_dim_level, last_triggered=2018-07-27T22:39:45.902145+02:00, last_action=call service @ 2018-07-27T22:38:20.402067+02:00>, new_state=<state script.adjust_dim_level=off; friendly_name=adjust_dim_level, last_triggered=2018-07-27T22:39:46.000272+02:00 @ 2018-07-27T22:38:20.402067+02:00>>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-120>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=script.adjust_again, old_state=<state script.adjust_again=off; friendly_name=adjust_again, last_triggered=2018-07-27T22:39:45.971784+02:00, last_action=call service @ 2018-07-27T22:38:20.405674+02:00>, new_state=<state script.adjust_again=off; friendly_name=adjust_again, last_triggered=2018-07-27T22:39:45.971784+02:00 @ 2018-07-27T22:38:20.405674+02:00>>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-117>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-115>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-112>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-110>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1976904400-107>
2018-07-27 22:39:46 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=automation.dim_light, old_state=<state automation.dim_light=on; friendly_name=Dim light, last_triggered=2018-07-27T22:39:29.576404+02:00 @ 2018-07-27T22:38:25.298000+02:00>, new_state=<state automation.dim_light=on; friendly_name=Dim light, last_triggered=2018-07-27T22:39:46.070308+02:00 @ 2018-07-27T22:38:25.298000+02:00>>
yeah post your whole config again, those calls don’t make sense. I don’t see cancel events and I see adjust dim levels firing before adjust again.
wait, I do see them. Bah
I hope that is enough :).
configuration.yaml
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: !secret home_longitude
longitude: !secret home_latitude
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 150.52
# metric for Metric, imperial for Imperial
unit_system: metric
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: Europe/Berlin
# Customization file
customize: !include customize.yaml
# Enables the frontend
frontend:
# Enables configuration UI
config:
http:
api_password: !secret api_password
# Secrets are defined in the file secrets.yaml
# api_password: !secret http_password
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# base_url: example.duckdns.org:8123
# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
# Optional, allows Home Assistant developers to focus on popular components.
# include_used_components: true
# Discover some devices automatically
discovery:
# Allows you to issue voice commands from the frontend in enabled browsers
conversation:
# Enables support for tracking state changes over time
history:
# View all events in a logbook
logbook:
# Enables a map showing the location of tracked devices
map:
# Track the sun
sun:
# Text to speech
tts:
- platform: google
# Cloud
cloud:
# iOS
ios:
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
# Logging
logger:
default: info
# Custom includes
panel_iframe: !include panel_iframe.yaml
sensor: !include sensor.yaml
rfxtrx: !include rfxtrx.yaml
cover: !include cover.yaml
shell_command: !include shell_command.yaml
input_number: !include input_number.yaml
switch: !include switch.yaml
weather: !include weather.yaml
automations.yaml
# Light office
- alias: Dim light
trigger:
platform: state
entity_id: input_number.office_dimmer
condition:
condition: template
value_template: "{{ trigger.to_state.state != trigger.from_state.state and
trigger.to_state.state is not none and
trigger.from_state.state is not none }}"
action:
service: script.adjust_dim_level
data_template:
command: >
{% if trigger.to_state.state|float > trigger.from_state.state|float %}
shell_command.increase_level_office
{% else %}
shell_command.decrease_level_office
{% endif %}
steps: >
{{ ((trigger.to_state.state|float - trigger.from_state.state|float)|abs / state_attr('input_number.office_dimmer', 'step'))|round }}
cover.yaml
- platform: rfxtrx
devices:
09190603010101110000:
name: Rollos
input_number.yaml
office_dimmer:
min: 0
max: 100
step: 10
icon: mdi:lightbulb
rfxtrx.yaml
device: /dev/serial/by-id/usb-RFXCOM_RFXtrx433_A12IRZ0B-if00-port0
debug: true
scripts.yaml
adjust_dim_level:
sequence:
- service: script.turn_off
entity_id: script.adjust_again
- condition: template
value_template: "{{ steps|int > 0 }}"
- service_template: "{{ command }}"
- service: script.adjust_again
data_template:
command: "{{ command }}"
steps: "{{ steps|int - 1 }}"
adjust_again:
sequence:
- service: script.turn_off
entity_id: script.adjust_dim_level
- service: script.adjust_dim_level
data_template:
command: "{{ command }}"
steps: "{{ steps }}"
shell_command.yaml
decrease_level_office: 'echo -ne "\x0a\x14\x03\x03\x00\x86\x13\x01\x02\x00\x00" > /dev/ttyUSB0'
increase_level_office: 'echo -ne "\x0a\x14\x03\x03\x00\x86\x13\x01\x01\x00\x00" > /dev/ttyUSB0'
switch.yaml
- platform: command_line
switches:
office_light:
command_on: "/home/homeassistant/.homeassistant/shell_scripts/light/office_on-off.sh"
command_off: "/home/homeassistant/.homeassistant/shell_scripts/light/office_on-off.sh"
weather.yaml
- platform: openweathermap
name: Wetter
api_key: !secret openweather_api_key
In case it’s not clear yet, that won’t work because by running the scripts via that button, there’s nothing to create the variables that the scripts need - neither command nor steps. You have to run the scripts via the automation that is triggered by moving the slider. At least, that’s what’s necessary given the way these scripts are written.
Thats what I’m doing.
I think it’s working. I see your shell-commands firing 3 of them and your steps are decreasing from 3 to 0. If you aren’t getting any feedback from your hardware, verify that the shell command works.
Shell scripts are definitly working.
Calling ./office_bright.sh decreases the lights brightness and ./office_light.sh increases.
can you quickly fire 3 shell commands in succession?
Yes, its working without any issues. Still hoping that you and pnbruckner can solve my mysterious problem.
And I really thank you so much for your effort.
Calling the script manually three times in a row, or even three times in one compound command from an OS shell, is probably not the same as HA calling it three times in a row from these scripts and automation. In the latter case, it’s very possible the command executions are overlapping in time. I’d add a one second delay (or longer, depending on how long the commands take to execute) between calls (i.e., in one of the scripts) and see if that makes a difference.
I changed my shell script to check the delay. There is none.
This turns the light from 100% to 10% in 7 calls.
#!/bin/bash
set -e
RFXCOM_DEV=/dev/serial/by-id/usb-RFXCOM_RFXtrx433_A12IRZ0B-if00-port0
REPEAT=1
echo -ne '\x0a\x14\x03\x03\x00\x86\x13\x01\x02\x00\x00' > "$RFXCOM_DEV"
echo -ne '\x0a\x14\x03\x03\x00\x86\x13\x01\x02\x00\x00' > "$RFXCOM_DEV"
echo -ne '\x0a\x14\x03\x03\x00\x86\x13\x01\x02\x00\x00' > "$RFXCOM_DEV"
echo -ne '\x0a\x14\x03\x03\x00\x86\x13\x01\x02\x00\x00' > "$RFXCOM_DEV"
echo -ne '\x0a\x14\x03\x03\x00\x86\x13\x01\x02\x00\x00' > "$RFXCOM_DEV"
echo -ne '\x0a\x14\x03\x03\x00\x86\x13\x01\x02\x00\x00' > "$RFXCOM_DEV"
echo -ne '\x0a\x14\x03\x03\x00\x86\x13\x01\x02\x00\x00' > "$RFXCOM_DEV"
That’s still calling one echo command after another, not multiple echo commands in parallel with overlap, which I believe is possible from HA with an automation and scripts.
EDIT: Given that the commands are sending data on a serial port, even if it’s running at 115200 baud, each command will take about a millisecond, plenty of time for HA to overlap commands.
EDIT2: Not saying that’s the root of the problem, but I think it’s at least worth a try adding a small delay between commands to see if it makes any difference.