我一直在使用Sonoff Bridge的2个PIR传感器使用此配置来控制Bhaus Sala中的灯光。这很好,但这正常工作24/7。我想控制这种配置以在一天的特定时间或日落直到11pm或23:00停用。关于我如何进行计划的任何帮助?

- alias: Turn on Bhaus Sala if there is movement trigger: - platform: state entity_id: binary_sensor.bhaus_sala_motion, binary_sensor.bhaus_kitchen_motion to: 'on' action: - service: homeassistant.turn_on data: entity_id: - switch.bhaus_sala - service:timer.start数据:entity_id:timer.bhaussala-别名:触发触发器后5分钟关闭bhaus sala: - 平台:event event_type:timer.fined event_data:entity_id:entity_id:timer.bhauss.bhaussala行动: - 服务: -  homeassistant.turn_off data:homeassistant.turn_id:: -  switch.bhaus_sala计时器:bhaussala:持续时间:00:05:00

为您的自动化添加条件。


并且请正确格式化您的代码。

点11
1喜欢

对不起,新手问题@vdrainer我实际上是在搜寻论坛以寻求可能的解决方案,但找不到解决方案。感谢您指导我正确的方式。现在是我的配置:

- 别名:触发触发器后5分钟关闭Bhaus Sala: - 平台:event event_type:timer.fined event_data:entity_id:timer.bhaussala条件:条件:条件:时间:23:00:00之前:17:00:00:00:00:00:00:00:00- 周一 - 周二 - 星期三 - 星期四 - 星期五 - 星期六 - 太阳行动: - 服务:homeassistant.turn_off数据:entity_id:-switch.bhaus_sala

但这给我带来了配置检查中的错误:
[自动化]的无效配置:不允许额外的密钥 @ data ['condition'] [0] ['after']。没有
不允许额外的键 @ data ['condition'] [0] ['''']。没有
这不是字典值 @ data ['condition'] [0] ['条件']的有效值。没有
所需的密钥未提供 @ data ['条件'] [0] ['entity_id’]。没有。(请参阅 /config/configuration.yaml,第375行)。请检查文档//www.sz-tiancheng.com/components/automation/

如果您不格式化代码,就不可能提供帮助。

抱歉,我无法弄清楚如何粘贴代码。现在我发现了。谢谢@vdrainer这是我的代码

- 别名:触发触发器后5分钟关闭Bhaus Sala: - 平台:Event event_type:timer.fined Event_data:entity_id:timer.bhaussala条件: - 条件: - 条件:17:00:00之后:23:00:00:00:00工作日: - 周一 - 周日 - 周三 - 星期四 - 星期五 - 星期六 - 太阳行动: - 服务:homeassistant.turn_off数据:entity_id:-switch.bhaus_sala

将您的时间引用。'17:00:00', 不只是17:00:00

1喜欢

嘿!那就做到了@petro我的配置现在有效。我现在将测试。重新开始哈斯。多谢!

1喜欢

您应该将条件变成“如果有运动”自动化,而不是“关闭”:lyly_smiling_face:

你好@vdrainer,我无法完全掌握你的意思

我正在尝试从17:00-23:00实施,即使未检测到光线的动作。我的旧配置是:

- alias: Turn on Bhaus Sala if there is movement trigger: - platform: state entity_id: binary_sensor.bhaus_sala_motion, binary_sensor.bhaus_kitchen_motion to: 'on' action: - service: homeassistant.turn_on data: entity_id: - switch.bhaus_sala - service:timer.start data: entity_id: timer.bhaussala - service: timer.restart data: entity_id: timer.bhaussala - alias: Turn Off Bhaus Sala 5 minutes after trigger trigger: - platform: event event_type: timer.finished event_data: entity_id: timer.bhaussala行动: - 服务:homeassistant.turn_off数据:entity_id: -  switch.bhaus_sala计时器:bhaussala:持续时间:00:05:00

这是没有条件的。Now with the conditions set, I am monitoring the timer I noticed that the timer doesn’t reset to 5mins even though there is motion detected it just keeps going down until it stays in active although the light stays on but I am feeling there is something wrong here?

Bandicam%202019-06-20%2008-56-03-586Bandicam%202019-06-20%2008-56-08-183