fabridelo
(Fabrizio)
November 23, 2018, 11:53am
1
Hello
I want switch on a strip led with my raspeberry and i want use “Sun event related timers” write to daenny is possible?
I’m new in Home Assistant my config Raspberry is this:
switch:
platform: rpi_gpio
ports:
11: Luce principale
Thank you all
keithh666
(Keith Hull)
November 23, 2018, 1:21pm
2
Hi,
This should really be in the config topic, not share your projects!
Could you please format your code wrt the big blue box at the top of every post?
Have you looked at the docs…
fabridelo
(Fabrizio)
November 23, 2018, 3:02pm
3
Thank you
Sorry I’m new.
I will read the documents more carefully
keithh666
(Keith Hull)
November 23, 2018, 4:11pm
4
So I’ve modified the automation in the docs to suit what you want to do…
automation:
alias: Turn on the LED lights when the sun sets
initial_state: True
hide_entity: False
trigger:
platform: sun
event: sunset
action:
service: switch.turn_on
entity_id: switch.luce_principale
The above should turn on the LED strip when the sun sets.
For more inspiration see…
and of course search thru’ the forums
fabridelo
(Fabrizio)
December 14, 2018, 6:22pm
5
Hello
I modify “Sun event related timers” write to daenny for switch on a led in the morning and switch off in the sunset, but if I restart raspberry the led is always switch off.
who can help me?
Thank you
Best Regards
sensor:
platform: dht
sensor: DHT11
pin: 24
monitored_conditions:
platform: template
sensors:
auto_light_start:
friendly_name: 'Accendi luci ’
value_template: ‘{{ (as_timestamp(states.sun.sun.attributes.next_rising) + (states(“input_number.auto_light_offset_off”) | int) * 60) | timestamp_custom("%H:%M") }}’
auto_light_stop:
friendly_name: 'Spegni luci ’
value_template: ‘{{ (as_timestamp(states.sun.sun.attributes.next_setting) + (states(“input_number.auto_light_offset_on”) | int) * 60) | timestamp_custom("%H:%M") }}’
platform: time_date
display_options:
Cloud
cloud:
switch:
platform: rpi_gpio
ports:
11: luce principale
input_number:
auto_light_offset_on:
name: Minuti dopo il tramonto
icon: mdi:timer
initial: 0
min: -480
max: 480
step: 10
auto_light_offset_off:
name: Minuti dopo l’alba
icon: mdi:timer
initial: 0
min: -480
max: 480
step: 10
automation:
alias: “auto_light_on enabled”
trigger:
platform: state
entity_id: input_number.auto_light_offset_on, input_number.auto_light_offset_off
action:
service: homeassistant.turn_on
data:
entity_id:
- automation.auto_light_off
service: homeassistant.turn_on
data:
entity_id:
- automation.auto_light_on
alias: ‘auto_light_on’
initial_state: True
trigger:
platform: time
minutes: ‘/1’
seconds: 10
condition:
condition: and
conditions:
condition: template
value_template: ‘{{ (now().strftime("%s") | int | timestamp_custom("%H:%M")) == states.sensor.auto_light_start.state }}’
value_template: ‘{{ (now().strftime("%s") | int | timestamp_custom("%H:%M")) > states.sensor.auto_light_start.state }}’
condition: template
value_template: ‘{{ (now().strftime("%s") | int | timestamp_custom("%H:%M")) < states.sensor.auto_light_stop.state }}’
condition: state
entity_id: group.automatic_lights_outside
state: ‘on’
action:
service: homeassistant.turn_on
entity_id: group.automatic_lights_outside
alias: ‘auto_light_off’
initial_state: True
trigger:
platform: time
minutes: ‘/1’
seconds: 10
condition:
condition: and
conditions:
condition: template
value_template: ‘{{ (now().strftime("%s") | int | timestamp_custom("%H:%M")) == states.sensor.auto_light_stop.state }}’
value_template: ‘{{ (now().strftime("%s") | int | timestamp_custom("%H:%M")) > states.sensor.auto_light_stop.state }}’
condition: template
value_template: ‘{{ (now().strftime("%s") | int | timestamp_custom("%H:%M")) < states.sensor.auto_light_start.state }}’
condition: state
entity_id: group.automatic_lights_outside
state: ‘off’
action:
service: homeassistant.turn_off
entity_id: group.automatic_lights_outside
group:
Automatic Lights Outside:
name: Automatic Lights Outside
entities:
- switch.luce_principale
Timer Light:
name: Timer Light
control: hidden
entities:
- automation.auto_light_off
- automation.auto_light_on
- input_number.auto_light_offset_on
- sensor.auto_light_start
- input_number.auto_light_offset_off
- sensor.auto_light_stop