Offset in Node-Red

Today I was playing with Node-Red and deciced to transfer some YAML automations to Node-Red, At some point I came into an old automation which used a minus offset as trigger and I was wondering if there is a way to achieve this within Node-Red.

For reference I pasted the YAML automation below:

  - alias: "LED ON" 
    trigger:
      - event: sunset
        offset: -00:30
        platform: sun
    action:
      - service: switch.turn_on
        entity_id: switch.slaapkamer_led

The timerange function will support negative offsets, you will need to inject a timestamp using an inject node. Or you could look at node-red-contrib-sun-position which has a time-inject node and sun position node, -30 min might correspond roughly to sunsetStart.

1 Like

Thanks, I will look into it

Look at the schedx node

1 Like