Quantcast
Viewing all articles
Browse latest Browse all 104647

Struggling with sunrise/set and templating

@jazzmonger wrote:

Simple automation, except not… the latest in chicken coop comfort. Chickens leave the coop if it’s light out.

Outcome desired: turn on a heatlamp only when it’s dark and it’s cold. Otherwise keep it off.

If sun has set AND sun has not risen ' it's dark out AND
{{ state_attr('weather.my_house', 'temperature') | int<38}} ' it's cold
Then
Turn on switch.heatlamp
Else
Turn off switch.heatlamp

I’ve been all over the place trying to simplify and make it work. Multiple automations that check temp, sun, scripts, etc. The template evaluates true when it’s cold so that works. Right now I have an automation run every 60 min to test temp, then run a script to turn on the heatlamp for 59 min and then off. Then repeat. Uggg.

- id: '1570151248258'
  alias: chicken heater control > 38 deg < Warmer at night
  trigger:
  - minutes: /60
    platform: time_pattern
  condition:
  - condition: template
    value_template: '{{ state_attr(''weather.my_house'', ''temperature'') | int<38}}'
  action:
  - service: script.1574955861863

'1574955861863':
  alias: Toggle heater light on 59 min
  sequence:
  - data:
      entity_id: switch.022000095ccf7f6a4e91
    service: switch.turn_on
  - delay: 00:59:00
  - alias: ''
    data:
      entity_id: switch.022000095ccf7f6a4e91
    service: switch.turn_off

Any insights? Looking to learn here!

Jeff

Posts: 6

Participants: 5

Read full topic


Viewing all articles
Browse latest Browse all 104647

Trending Articles