Hi all, first post. I tried looking this up myself but couldn’t find anything specific that I’ve done wrong. The following two automations either work randomly, or flat out don’t trigger with the sun conditions. if I remove the condition of sun, they fire without a hitch. I am using MQTT as the trigger so as to make a failsafe (no missed event) automation, as the aquarium is a critical process. In my Vera hub, I used a plugin called Reactor to do this and it was pretty straightforward. I have used both the Automations UI and tried just typing the code in myself to no avail. It sometimes works and sometimes doesn’t. MQTT topic updates every 300 seconds and is showing, confirmed. Even if I force it (status in tasmota console) it still just randomly decides to work or not work.
- id: '1588720799099'
alias: Aquarium UV On
description: ''
trigger:
- platform: mqtt
topic: aquarium/uvlamp/STATE
condition:
- condition: and
conditions:
- after: sunrise
after_offset: -01:00:00
before: sunset
before_offset: +01:00:00
condition: sun
- condition: state
entity_id: switch.uv_lamp
state: 'off'
action:
- device_id: de96698250fd45b294e224738295affe
domain: switch
entity_id: switch.uv_lamp
type: turn_on
- id: '1588721351891'
alias: Aquarium UV Off
description: ''
trigger:
- platform: mqtt
topic: aquarium/uvlamp/STATE
condition:
- condition: and
conditions:
- after: sunset
after_offset: +01:01:00
before: sunrise
before_offset: -01:01:00
condition: sun
- condition: device
device_id: de96698250fd45b294e224738295affe
domain: switch
entity_id: switch.uv_lamp
type: is_on
action:
- device_id: de96698250fd45b294e224738295affe
domain: switch
entity_id: switch.uv_lamp
type: turn_off