home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.34k stars 29.88k forks source link

Automation editor formats to inconsistent apostrophes on time values #20975

Closed 2rs closed 5 years ago

2rs commented 5 years ago

Home Assistant release with the issue:

homeassistant: 0.86.4

Last working Home Assistant release (if known): Only noticed inconsistent formating recently

Operating environment (Hass.io/Docker/Windows/etc.):

Hass.io raspberry pi

Component/platform:

Description of problem:

Automation Editor behaves inconsistent when encapsulating time values with apostrophes. Sometimes with and sometimes not. I've noticed this with time values. If I clean up my automations.yaml manually the editor wil remove my clean up and back to inconsistent encapsulation the next time the editor is started.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):


[- id: '1548785885000'
  alias: Light plantlight off
  trigger:
  - at: '21:00:00'
    platform: time
  condition: []
  action:
  - data:
      entity_id: light.plantlight_group
    service: light.turn_off
- id: '1548787329983'
  alias: Light plantlight on
  trigger:
  - at: 08:00:00
    platform: time
  condition: []
  action:
  - data:
      entity_id: light.plantlight_group
    service: light.turn_on
- id: '1548787451454'
  alias: Light terrasse off
  trigger:
  - at: 00:00:00
    platform: time
  condition: []
  action:
  - data:
      entity_id: light.terrasse
    service: light.turn_off
- id: '1548787611548'
  alias: Light terrasse on
  trigger:
  - event: sunset
    platform: sun
  condition: []
  action:
  - data:
      entity_id: light.terrasse
    service: light.turn_on
- id: '1548787710871'
  alias: Light garden off
  trigger:
  - event: sunrise
    platform: sun
  condition: []
  action:
  - data:
      entity_id: switch.light_garden
    service: switch.turn_off
- id: '1548787754899'
  alias: Light garden on
  trigger:
  - event: sunset
    platform: sun
  condition: []
  action:
  - data:
      entity_id: switch.light_garden
    service: switch.turn_on
- id: '1548787839196'
  alias: Light porch on
  trigger:
  - entity_id: binary_sensor.pir_porch
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: sunset
    condition: sun
  - after: sunset
    before: sunrise
    condition: sun
  action:
  - data:
      entity_id: switch.light_porch
    service: switch.turn_on
- id: '1548787891801'
  alias: Light porch off
  trigger:
  - entity_id: binary_sensor.pir_porch
    for: 00:05:00
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data:
      entity_id: switch.light_porch
    service: switch.turn_off
- id: '1548788131090'
  alias: Light entrance on
  trigger:
  - entity_id: binary_sensor.pir_entrance
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      entity_id: light.entrance
    service: light.turn_on
- id: '1548788215043'
  alias: Light entrance off
  trigger:
  - entity_id: binary_sensor.pir_entrance
    for: 00:02:00
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data:
      entity_id: light.entrance
    service: light.turn_off
- id: '1548788618767'
  alias: Light shed off
  trigger:
  - entity_id: binary_sensor.pir_shed
    for: 00:15:00
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      entity_id: light.shed
    service: light.turn_off
- id: '1548795677739'
  alias: Light shed on
  trigger:
  - entity_id: binary_sensor.pir_shed
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      entity_id: light.shed
    service: light.turn_on
- id: '1548795749589'
  alias: Light aquarium off
  trigger:
  - at: '23:00:00'
    platform: time
  condition: []
  action:
  - data:
      entity_id: switch.light_aquarium
    service: switch.turn_off
- id: '1548795820146'
  alias: Light aquarium on
  trigger:
  - at: '12:00:00'
    platform: time
  condition: []
  action:
  - data:
      entity_id: switch.light_aquarium
    service: switch.turn_on
- id: '1548795943113'
  alias: Light kitchen on day
  trigger:
  - entity_id: binary_sensor.pir_kitchen
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: 07:00:00
    before: '22:59:59'
    condition: time
  action:
  - data:
      brightness_pct: 100
      entity_id: light.kitchen
    service: light.turn_on
- id: '1548796005176'
  alias: Light kitchen off
  trigger:
  - entity_id: binary_sensor.pir_kitchen
    for: 00:15:00
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data:
      entity_id: light.kitchen
    service: light.turn_off
- id: '1548796266933'
  alias: Light hallway on night
  trigger:
  - entity_id: binary_sensor.pir_hallway
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: 00:00:00
    before: 06:59:59
    condition: time
  action:
  - data:
      brightness_pct: 10
      entity_id: light.hallway
    service: light.turn_on
- id: '1548796332064'
  alias: Light hallway off
  trigger:
  - entity_id: binary_sensor.pir_hallway
    for: 00:05:00
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data:
      entity_id: light.hallway
    service: light.turn_off
- id: '1548796401433'
  alias: Light diningroom on day
  trigger:
  - entity_id: binary_sensor.pir_diningroom
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: 07:00:00
    before: '23:00:00'
    condition: time
  action:
  - data:
      brightness_pct: 100
      entity_id: light.diningroom
    service: light.turn_on
- id: '1548796464197'
  alias: Light spsiestue off
  trigger:
  - entity_id: binary_sensor.pir_diningroom
    for: 00:30:00
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data:
      entity_id: light.diningroom
    service: light.turn_off
- id: '1548796566142'
  alias: Light pantry on
  trigger:
  - entity_id: binary_sensor.pir_pantry
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      entity_id: light.pantry
    service: light.turn_on
- id: '1548796621769'
  alias: Light pantry off
  trigger:
  - entity_id: binary_sensor.pir_pantry
    for: 00:02:00
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data:
      entity_id: light.pantry
    service: light.turn_off
- id: '1548796686594'
  alias: Light sauna on
  trigger:
  - entity_id: switch.oven_sauna
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      entity_id: light.sauna
    service: light.turn_on
- id: '1548796746841'
  alias: Light sauna off
  trigger:
  - entity_id: switch.oven_sauna
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data:
      entity_id: light.sauna
    service: light.turn_off
- id: '1548796819052'
  alias: Sauna auto off
  trigger:
  - entity_id: switch.oven_sauna
    for: 04:00:00
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      entity_id: switch.oven_sauna
    service: switch.turn_off
- id: '1548844649466'
  alias: Light bathroom on day
  trigger:
  - entity_id: binary_sensor.pir_bathroom
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: 08:00:00
    before: '23:59:59'
    condition: time
  action:
  - data:
      brightness: 100
      entity_id: light.bathroom
    service: light.turn_on
- id: '1548844718862'
  alias: Light bathroom off
  trigger:
  - entity_id: binary_sensor.pir_bathroom
    for: 00:05:00
    from: 'on'
    platform: state
    to: 'off'
  condition: []
  action:
  - data:
      entity_id: light.bathroom
    service: light.turn_off
- id: '1548899908163'
  alias: Light hallway on day
  trigger:
  - entity_id: binary_sensor.pir_hallway
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: 07:00:00
    before: '23:59:59'
    condition: time
  action:
  - data:
      brightness_pct: 100
      entity_id: light.hallway
    service: light.turn_on
- id: '1548900953061'
  alias: Light dining room night
  trigger:
  - entity_id: binary_sensor.pir_diningroom
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: '23:00:00'
    before: 06:59:59
    condition: time
  action:
  - data:
      brightness_pct: 10
      entity_id: light.diningroom
    service: light.turn_on
- id: '1548901107723'
  alias: Light kitchen night
  trigger:
  - entity_id: binary_sensor.pir_diningroom
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: '23:00:00'
    before: 06:59:59
    condition: time
  action:
  - data:
      brightness_pct: 10
      entity_id: light.kitchen
    service: light.turn_on
- id: '1548965122964'
  alias: Light bathroom on night
  trigger:
  - entity_id: binary_sensor.pir_bathroom
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: 00:00:00
    before: 07:59:59
    condition: time
  action:
  - data:
      brightness_pct: 10
      entity_id: light_bathroom
    service: light.turn_on
]

Traceback (if applicable):

Additional information: I placed this by error in the home-assistant-polymer, but closed it and reposted here.

awarecan commented 5 years ago
  trigger:
  - at: 08:00:00
    platform: time

This should not be able to work. 08:00:00 without quotation marks will be interpreted as 28800, e..g. 8 60 60 seconds. It is not valid for at field which requires a time value.

2rs commented 5 years ago

Well, I have tried several times to correct it by manually encapsulating all occurences that was missing apostrophes, but as soon as I do something in the automations editor and save the changes then the yaml will look like it used to - that is, broken like my example.

robmarkcole commented 5 years ago

I have also observed this issue. I wonder if https://github.com/home-assistant/home-assistant/issues/20976 is related to this issue also, as I see the same happening in their config

stale[bot] commented 5 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.