Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95482

Sun State change 3 minutes after sunrise event

$
0
0

@xes wrote:

Hi there!

I have a question about sunrise event.
What I try to do is:

  • Create automation that launch my action at sunrise but not before 8 am

For that, I wrote that:

- id: volets_ouverture_default
  alias: Volets Ouverture 8H/Sunrise
  trigger:
  - at: '08:00:00'
    platform: time
  - event: sunrise
    platform: sun
  action:
  - condition: and
    conditions:
    - condition: time
      after: '08:00:00'
    - condition: state
      entity_id: sun.sun
      state: above_horizon
  - entity_id: cover.my_shutter
    service: cover.close_cover

But it doesn’t work.
I did some investigations and I found that sun state changes 3 minutes after the sunrise event.
Is it a normal behavior?

If necessary my automations.yaml tests that show this fact:

- id: test759
  alias: Test 759
  trigger:
  - at: '07:59:00'
    platform: time
  action:
  - service: system_log.write
    data_template:
      message: |
        759
        date_time => {{ states("sensor.date_time") }}
        state => {{ states('sun.sun') }}
        next_rising => {{ state_attr('sun.sun', 'next_rising')}}
		
- id: testsunrise
  alias: Test sunrise
  trigger:
  - event: sunrise
    platform: sun
  action:
  - service: system_log.write
    data_template:
      message: |
        sunrise
        date_time => {{ states("sensor.date_time") }}
        state => {{ states('sun.sun') }}
        next_rising => {{ state_attr('sun.sun', 'next_rising')}}
        
- id: testsunriseplus1
  alias: Test sunrise plus 1
  trigger:
  - event: sunrise
    platform: sun
    offset: '+00:01:00'
  action:
  - service: system_log.write
    data_template:
      message: |
        sunrise +1
        date_time => {{ states("sensor.date_time") }}
        state => {{ states('sun.sun') }}
        next_rising => {{ state_attr('sun.sun', 'next_rising')}}
		
- id: test802
  alias: Test 802
  trigger:
  - at: '08:02:00'
    platform: time
  action:
  - service: system_log.write
    data_template:
      message: |
        802
        date_time => {{ states("sensor.date_time") }}
        state => {{ states('sun.sun') }}
        next_rising => {{ state_attr('sun.sun', 'next_rising')}}

- id: test803
  alias: Test 803
  trigger:
  - at: '08:03:00'
    platform: time
  action:
  - service: system_log.write
    data_template:
      message: |
        803
        date_time => {{ states("sensor.date_time") }}
        state => {{ states('sun.sun') }}
        next_rising => {{ state_attr('sun.sun', 'next_rising')}}
		

An the logs relative to automation tests:

2019-11-28 07:59:00 ERROR (MainThread) [homeassistant.components.system_log.external] 759
date_time => 2019-11-28, 07:58
state => below_horizon
next_rising => 2019-11-28T07:00:07+00:00

2019-11-28 08:00:07 ERROR (MainThread) [homeassistant.components.system_log.external] sunrise
date_time => 2019-11-28, 08:00
state => below_horizon
next_rising => 2019-11-29T07:01:27+00:00

2019-11-28 08:01:07 ERROR (MainThread) [homeassistant.components.system_log.external] sunrise +1
date_time => 2019-11-28, 08:01
state => below_horizon
next_rising => 2019-11-29T07:01:27+00:00

2019-11-28 08:02:00 ERROR (MainThread) [homeassistant.components.system_log.external] 802
date_time => 2019-11-28, 08:01
state => below_horizon
next_rising => 2019-11-29T07:01:27+00:00

2019-11-28 08:03:00 ERROR (MainThread) [homeassistant.components.system_log.external] 803
date_time => 2019-11-28, 08:02
state => above_horizon
next_rising => 2019-11-29T07:01:27+00:00

Thanks!

Posts: 28

Participants: 9

Read full topic


Viewing all articles
Browse latest Browse all 95482

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>