Skip to content

time inject

Hypnos edited this page Sep 27, 2021 · 3 revisions

Injects a message into a flow either manually or at timestamps which can also depending on the sunset, sunrise, or moon set and rise. The message payload can be a variety of types, including strings, JavaScript objects, the current time or the current sun or moon position.

time-inject-example

[{"id":"d3c04d4e.ce3e3","type":"debug","z":"de4e9c38.0d942","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":570,"y":2100,"wires":[]},{"id":"586e4ae2.5b4f14","type":"debug","z":"de4e9c38.0d942","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":570,"y":2160,"wires":[]},{"id":"1b71d0e5.35b02f","type":"debug","z":"de4e9c38.0d942","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":570,"y":2220,"wires":[]},{"id":"3e4d36c0.620e7a","type":"time-inject","z":"de4e9c38.0d942","name":"","positionConfig":"bdf7c4a.9ca6c38","time":"nadir","timeType":"pdsTime","timeDays":"*","offset":0,"offsetMultiplier":60,"payload":"","payloadType":"date","topic":"","x":320,"y":2100,"wires":[["d3c04d4e.ce3e3"]]},{"id":"c11713e.db07ef","type":"time-inject","z":"de4e9c38.0d942","name":"","positionConfig":"bdf7c4a.9ca6c38","time":"dawn","timeType":"pdsTime","timeDays":"*","offset":0,"offsetMultiplier":60,"payload":"","payloadType":"date","topic":"","x":320,"y":2160,"wires":[["586e4ae2.5b4f14"]]},{"id":"b227cadc.dcf8c8","type":"time-inject","z":"de4e9c38.0d942","name":"","positionConfig":"bdf7c4a.9ca6c38","time":"rise","timeType":"pdmTime","timeDays":"1,4,0","offset":0,"offsetMultiplier":60,"payload":"{\"bool\":true}","payloadType":"json","topic":"","x":340,"y":2220,"wires":[["1b71d0e5.35b02f"]]},{"id":"bdf7c4a.9ca6c38","type":"position-config","z":"","name":"","longitude":"13.71587","latitude":"51.01732","angleType":"deg"}]

time-inject - Node settings

time-inject-settings

  • Position connects to the central configuration node, which contains the current position, but also handles internal shared functions

  • Payload defines the payload of the message object send to the output

  • Topic defines the topic of the send message

  • Time An optional property that can be configured when the inject node should emit a message on that timestamp.

    • if a time is choose additional settings available image
    • Offset An optional property which is only available if an time is chosen. The offset can be a positive or negative and defines a time offset to the chosen time.
    • valid days There can be defined on which days a msg should be emitted.
    • special days There can be defined if the msg should only be emitted on even or odd days.
    • valid month There can be defined on which month a msg should be emitted.
    • valid date range There can be defined if the message should be only emitted between two dates. The defined year will be ignored. There are two options:
      • starting day.month is less than end day.month - then the start and end date will be every time the current year
      • end day.month is less than start day.month then the message will be send this year from 1.1. to end month and year and from starting date to end month and day next year
  • Property optional here can be defined a condition under which a alternate time should be used.

  • Alternate time optional defines an alternate start time which will be used if the condition applies. This can be used for different times for example of holidays/weekend.

  • Additional Inject on Start If this checkbox is set the inject node can emit the message on Node-Red Start or on any deploy of this node. There can be defined a delay after the emit should be done. This can be useful for initializing any flow.

  • Set additional With this selection you can

    • set global, flow context or set additional property of the message object (if the property is payload the payload will be overridden.)
    • for any timestamp properties like timestamp, sun time, moon time there are a lot of possibilities to influence this. You can add an offset or select the days wherefore the timestamp should be calculated. The output format could be Unix, ECMA timestamp, object or the time difference between timestamp and emit the message. This is useful to to send a payload of true on sunset with an additional message property as on time with the seconds until sunrise. see Possible Node Output Formats for possible information

time-inject - Node Input

It has only a button as input, where the massage could injected into a flow manually.

time-inject - Node Output

The output is a message with the defined payload and topic in the settings.

time-inject - Node Status

  • red on error
  • green
    • the color of the status is green, if the next trigger time is soon (< 36h).
    • type of the status
      • dot The next trigger time is normal time. (But that doesn't mean that an inject really takes place.)
      • ring The next trigger time is alternate time. (But that doesn't mean that an inject really takes place.)
  • blue
    • the next trigger (alternate or normal time) is far in the future (>36h).
    • type of the status
      • dot The next trigger time is normal time. (But that doesn't mean that an inject really takes place.)
      • ring The next trigger time is alternate time. (But that doesn't mean that an inject really takes place.)