Automation triggered via anzimuth not working

Hi,

I’m trying to trigger a automation via sun.sun state.attributes.anzimuth:

automation:
- alias: 'Raffstore Ost runter'
  initial_state: true
  hide_entity: True
  trigger:
    platform: numeric_state
    entity_id: sun.sun
    value_template: '{{ state.attributes.anzimuth }}'
    above: 31
  condition:
    condition: state
    entity_id: input_boolean.raffstore_sommermodus
    state: 'on'
  action:
    - service: cover.close_cover
      entity_id: cover.cover_eg_kueche, cover.cover_eg_ezs, cover.cover_og_le, cover.cover_eg_sz
    - service: notify.mail
      data:
        title: 'Raffstore Ost runter'
        message: 'test'

- alias: 'Raffstore Ost runter test'
  initial_state: true
  hide_entity: True
  trigger:
    platform: template
    entity_id: sun.sun
    value_template: '{{ state.attributes.anzimuth > 31 }}'
  condition:
    condition: state
    entity_id: input_boolean.raffstore_sommermodus
    state: 'on'
  action:
    - service: cover.close_cover
      entity_id: cover.cover_eg_kueche, cover.cover_eg_ezs, cover.cover_og_le, cover.cover_eg_sz
    - service: notify.mail
      data:
        title: 'Raffstore Ost runter'
        message: 'test'

but they are both not working!
How can this be implemented?

Do you mean azimuth?

damn it, your right it’s azimuth!

I’ll try it with the correct spelling, strange that the config is valid with a non existing state…

Probably can’t evaluate it on that level

It’s working!
Thanks

Some times you just get blind looking for errors :slight_smile:

The automation is triggerd when I set
sun.sun to

{
  "azimuth": 30
}

and then to

{
  "azimuth": 31
}

via the developer tools --> states in HA
but not when the sun component is actually changing!

Perhaps the suggestion in this post will help you

I’l give the float a try

float doesn’t help.

I fixed it with moving the automation part from

.homeassistant/packages/raffstore.yaml

to

.homeassistant/automation.yaml

which shouldn’t make any difference, since I have some other yaml files in the packages directory, included it in configuration.yaml and they are working fine.

packages: !include_dir_named packages

So there is a problem with sun.azimuth inside a package.

You have to name files according to what you keep in them if you use !include_dir_named.

!include_dir_named will return the content of a directory as a dictionary which maps filename => content of file.

Parsing the configuration files has nothing to do with the sun component.