Sorry if this is a total noob question. I am quite inexperienced in Javascript.
I’ve made a function to “replicate” Philips Hue’s built-in “Dynamic scene” where the lights changes scenes automatically at a given time with a slow transition. The function works somewhat fine but for debugging purposes I need to show the next timeswitch and found out that it could be done via node.status()
(so I don’t need to have debugging nodes open all the time).
However I get a strange error message whenever i put in a variable in the "text"
argument of node.status()
:
No overload matches this call.
Overload 1 of 2, ‘(status: NodeStatus): any’, gave the following error.
Type ‘() => string’ is not assignable to type ‘string | number | boolean’.
Overload 2 of 2, ‘(status: string | number | boolean): any’, gave the following error.
Argument of type ‘{ fill: string; shape: string; text: () => string; }’ is not assignable to parameter of type ‘string | number | boolean’.(2769)
Here is the code:
let nextTimeSwitch;
nextTimeSwitch = new Date(dtSubstring + nextEndTime);
node.status({fill:"green",shape:"dot",text: nextTimeSwitch.toTimeString});
There’s a lot more in this function but I boiled it down to where the issue is. The nextTimeSwitch
variable is made up of two substrings but this is not the issue since it is returned to msg.delay which is later used in a delay node, and this works just fine.
How do I fix this issue?