2024年11月24日星期日 下午12:27:04

Create a Basic Automation turn on light at sunset in Home Assistant Step by Step sun

2 年 前
#3506 引用
Create a  Basic Automation turn on light at sunset in Home Assistant Step by Step

https://theprivatesmarthome.com/how-to/create-basic-automation-home-assistant/


Presence-based Lights

https://www.home-assistant.io/integrations/device_sun_light_trigger


I’m trying to write a single automation that will turn on my lights at sunset and then turn them off at sunrise (super easy to do as two automation)

How To Simulate A Sunrise With Home Assistant
https://siytek.com/how-to-simulate-a-sunrise-with-home-assistant/
0
2 年 前
#14348 引用
主要针对带有时延动作的自动化和脚本,引入了“运行模式”属性。该属性有4个选项:
- single,单次,如果已经在运行中,则不会启动新的执行
- restart,重启,停掉已经在运行的自动化/脚本,重新启动
- queued,排队,前面已经在执行的结束之后,再启动一次
- parallel,并行,启动一个独立的进程,和之前已经启动的进程各自独立运行



A timer can have different states:



https://www.home-assistant.io/integrations/script/#script-modes



The timer is Idle when it’s finished, canceled, or never started
The timer is Active when it is currently running
The timer has the state Paused when it is paused



We can check the status of timers using events in Home Assistant. So we can see if the timer is canceled, finished, started, restarted, or paused. We are going to check if the timer is finished or canceled in this example to keep it simple.

In our use case, we are going to use the random function of Home Assistant to turn off the lights after a random time interval between 1 and 30 minutes. In this case, it can happen that Home Assistant gets restarted in between. I will show you that the timer will still be alive after the restart.

I created a simple dashboard that contains the status of the light and the status of the timer so that we can follow the progress of our timer.

https://www.smarthomejunkie.net/how-to-use-timers-perfectly-in-home-assistant/
0
2 年 前
#17604 引用
Lights on when home

https://community.home-assistant.io/t/lights-on-when-home/16158



- alias: 'Lights on when home after sunset'
  trigger:
    - platform: state
      entity_id: group.all_devices
      from: 'not_home'
      to: 'home'
    - platform: sun
      event: sunset
  condition:  
    condition: and
    conditions:
      - condition: sun
        after: sunset
      - condition: state
        entity_id: group.all_devices
        state: 'home'
  action:
    - service: scene.turn_on
      entity_id: scene.evening




0
2 年 前
#17605 引用
And conditions are explicitly “AND” of course, triggers are “OR”.
You want the conditions to be AND, otherwise the lights will switch on at every sunset (even is nobody is home), also the lights will always switch on when entering home (even in broad daylight).
0
2 年 前
#18773 引用
Step 1:


First you need a template sensor:

0
1 年 前
#20927 引用
https://www.home-assistant.io/docs/scripts/service-calls/

service: light.turn_on
entity_id: group.living_room
data:
  brightness: 120
  rgb_color: [255, 0, 0]





alias: New Automation - brightness test
description: ""
trigger: []
condition: []
action:
  - service: light.turn_on
    target:
      area_id: book_bedroom
      device_id: 6b0a70321874b26bc5cb18ca9153c4a5
    data:
      brightness: 12
      color_name: white
      color_temp: 1
      rgb_color: [255, 255, 255]
mode: single
0
1 年 前
#20949 引用







[test1] "1 2023-07-05 20:16:14.777941+08:00binary_sensor.aqara_high_accuracy_sensor_cn_version_rtcgq13lm_6: on"
[test1] "2 2023-07-05 20:17:44.811252+08:00binary_sensor.aqara_high_accuracy_sensor_cn_version_rtcgq13lm_6: on"

[test1] "1 2023-07-05 20:35:28.565744+08:00binary_sensor.aqara_high_accuracy_sensor_cn_version_rtcgq13lm_6: on"
[test1] "1 2023-07-05 20:36:47.003735+08:00binary_sensor.aqara_high_accuracy_sensor_cn_version_rtcgq13lm_6: on"
[test1] "1 2023-07-05 20:36:57.038242+08:00binary_sensor.aqara_high_accuracy_sensor_cn_version_rtcgq13lm_6: on"




0