mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-02-22 00:55:18 +00:00
Changed the logic from OR to AND. Should work now.
This commit is contained in:
parent
db44d44a6e
commit
24d7d1600a
@ -2,7 +2,7 @@
|
|||||||
### Detect when lights are turned on and adjust them accordingly based on time.
|
### Detect when lights are turned on and adjust them accordingly based on time.
|
||||||
### Code by @JesseWebDotCom
|
### Code by @JesseWebDotCom
|
||||||
##############################################################################
|
##############################################################################
|
||||||
- alias: detect lights and adjust the brightness when turned on based on time.
|
- alias: detect lights and adjust the brightness when turned on based on time
|
||||||
trigger:
|
trigger:
|
||||||
- platform: event
|
- platform: event
|
||||||
event_type: state_changed
|
event_type: state_changed
|
||||||
@ -37,11 +37,11 @@
|
|||||||
entity_id: "{{ trigger.event.data.entity_id }}"
|
entity_id: "{{ trigger.event.data.entity_id }}"
|
||||||
brightness: >
|
brightness: >
|
||||||
{% set hour=states("sensor.time").split(':')[0] | int %}
|
{% set hour=states("sensor.time").split(':')[0] | int %}
|
||||||
{%- if hour >= 5 or hour < 8 -%}
|
{%- if hour >= 5 and hour < 8 -%}
|
||||||
50
|
50
|
||||||
{%- elif hour >= 8 or hour <20 -%}
|
{%- elif hour >= 8 and hour <20 -%}
|
||||||
255
|
255
|
||||||
{%- elif hour >= 20 or hour <24 -%}
|
{%- elif hour >= 20 and hour <24 -%}
|
||||||
40
|
40
|
||||||
{%- else -%}
|
{%- else -%}
|
||||||
15
|
15
|
||||||
|
Loading…
x
Reference in New Issue
Block a user