Hello,
I am on Home Assistant 0.114.4 Running Ubuntu 19.10 with a python virtual environment and am having an issue where HA decides to reformat my automation making it less readable;
I’ve my automation like this
- id: '2'
alias: WC light TimeBased
trigger:
platform: state
entity_id: binary_sensor.shenzhen_neo_electronics_co_ltd_battery_powered_pir_sensor_v2_sensor_2
to: 'on'
action:
service: light.turn_on
data_template:
entity_id: light.wclicht
brightness_pct: >
{% if now().hour in [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21] %}
100
{% elif now().hour in [22, 23] %}
70
{% elif now().hour in [0, 1, 2, 3, 4, 5, 6, 7, 8] %}
30
{% endif %}
After a while I look at my Automation.yaml again and see that the formatting has changed to this;
- id: '2'
alias: WC light TimeBased
trigger:
platform: state
entity_id: binary_sensor.shenzhen_neo_electronics_co_ltd_battery_powered_pir_sensor_v2_sensor_2
to: 'on'
action:
service: light.turn_on
data_template:
entity_id: light.wclicht
brightness_pct: "{% if now().hour in [9, 10, 11, 12, 13, 14, 15, 16, 17, 18,\
\ 19, 20, 21] %}\n 75\n{% elif now().hour in [22, 23] %}\n 50\n{% elif now().hour\
\ in [0, 1, 2, 3, 4, 5, 6, 7, 8] %}\n 30\n{% endif %}\n"
This kind of triggers me, as it less readable and I have to search for the light % if I want to change something.
How can I prevent this?