node-red-contrib-sun-position icon indicating copy to clipboard operation
node-red-contrib-sun-position copied to clipboard

Manually specify time to check in within-time for debugging

Open geryxyz opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

I like to create several flows based on the current "part of the day" (night, dawn, etc.). Naturally, I have to check the time against a time range, which I try to accomplish with the "within-time" node. Being a software developer, I prefer to test (or at least try) my programs before publishing them to the production environment. However, I fail to inject the time to check into the "within-time" node; it always uses the current time.

Describe the solution you'd like

I prefer if the "within-time" will accept input from the payload or any other properties of the incoming message.

Describe alternatives you've considered

I checked the source of the within-time node and deduced that the getIntDate is responsible for getting the current time. If I am right, the choice is based on the value of the tsCompare setting key. So I added a new line to the settings.js file. I also try as an integer and as a string (with and without quotes). If I do not miss anything, the value 3 will represent the message property time. It does not make any difference. The within-time node still seems to use the system time.

/*******************************************************************************
 * Node Settings
*/

//....

    // Sun-position modul config
    tsCompare: "3",

Additional context

image image

https://github.com/rdmtc/node-red-contrib-sun-position/blob/40f7579987e89691fe19dd2f7f1db23e0b4a2087/nodes/21-within-time-switch.js#L107 https://github.com/rdmtc/node-red-contrib-sun-position/blob/40f7579987e89691fe19dd2f7f1db23e0b4a2087/nodes/21-within-time-switch.js#L538 https://github.com/rdmtc/node-red-contrib-sun-position/blob/40f7579987e89691fe19dd2f7f1db23e0b4a2087/nodes/21-within-time-switch.js#L364 https://github.com/rdmtc/node-red-contrib-sun-position/blob/40f7579987e89691fe19dd2f7f1db23e0b4a2087/nodes/21-within-time-switch.js#L554 https://github.com/rdmtc/node-red-contrib-sun-position/search?q=tsCompare

geryxyz avatar Aug 28 '22 10:08 geryxyz