New Error messages in Node Red

I have started getting

So I search for the Invalid Nodes and the only commonality I can find is that they are all OK and I can’t find why invalid.

So

Except I cannot find a setting for rate or randomfirst or random last I am certainly not using them in the node

[{"id":"0f443f6688dafda5","type":"delay","z":"6beb78afd8ae31b9","d":true,"name":"Wait 4 seconds","pauseType":"delay","timeout":"4","timeoutUnits":"seconds","rate":"","nbRateUnits":"","randomFirst":"","randomLast":"","randomUnits":"seconds","allowrate":false,"outputs":1,"x":1500,"y":160,"wires":[["68cd4591e5de651d","e648ab5f6a2ede46","cfb2e516cbb987fa"]]}]

I am also getting

[{"id":"batteryCalc","type":"function","z":"7cb6c4c386ff32ae","name":"Battery Forecast Check","func":"// ------- CONFIGURATION -------\nconst batterySize_kWh = 20;       // Total battery capacity\nconst minSOC_pct = 20;            // Minimum allowed SOC (%)\nconst avgHouseUse_kWh_per_hr = 0.8; // Consumption estimate\nconst offPeakStart = \"23:30\";     // When cheap power resumes\n\n// ------- GET CURRENT SOC -------\nlet soc = Number(global.get(\"house_SOC\"));\n\nif (!soc || soc <= 0) {\n    msg.payload = \"⚠️ Battery forecast error: SOC value missing.\";\n    msg.alert = true;\n    return msg;\n}\n\n// ------- CALCULATE USABLE ENERGY -------\nconst usablePercent = soc - minSOC_pct;\nlet usableEnergy_kWh = (usablePercent / 100) * batterySize_kWh;\n\nif (usableEnergy_kWh < 0) usableEnergy_kWh = 0;\n\n// ------- FIND TIME UNTIL OFF-PEAK -------\nconst now = new Date();\nconst today = new Date(now.toDateString());\n\n// Construct time object for off-peak\nconst [offHr, offMin] = offPeakStart.split(\":\").map(Number);\nconst offPeakDate = new Date(today);\noffPeakDate.setHours(offHr, offMin, 0, 0);\n\n// If past 23:30, assume next day\nif (now > offPeakDate) offPeakDate.setDate(offPeakDate.getDate() + 1);\n\nconst hoursRemaining = (offPeakDate - now) / (1000 * 60 * 60);\n\n// ------- FORECAST -------\nconst canRunHours = usableEnergy_kWh / avgHouseUse_kWh_per_hr;\nconst shortage_kWh = Math.max(0, (hoursRemaining - canRunHours) * avgHouseUse_kWh_per_hr);\n\nlet message = `🔋 HOUSE BATTERY FORECAST\\n`;\nmessage += `--------------------------------\\n`;\nmessage += `Current SOC: ${soc}%\\n`;\nmessage += `Usable Energy: ${usableEnergy_kWh.toFixed(2)} kWh\\n`;\nmessage += `Hours until off-peak: ${hoursRemaining.toFixed(2)} hrs\\n`;\nmessage += `Estimated Runtime: ${canRunHours.toFixed(2)} hrs\\n\\n`;\n\nif (canRunHours >= hoursRemaining) {\n    message += `✅ Battery capacity is sufficient until Off-Peak power starts.`;\n    msg.alert = false;\n} else {\n    message += `⚠️ Battery will run out before Off-Peak!\\n`;\n    message += `⚡ Shortfall: ${shortage_kWh.toFixed(2)} kWh`;\n    msg.alert = true;\n}\n\nmsg.payload = message;\nmsg.runtimeHours = canRunHours;\nmsg.shortfall = shortage_kWh;\n\nreturn msg;","outputs":1,"timeout":"","noerr":2,"initialize":"","finalize":"","libs":[],"x":463,"y":711,"wires":[["a7aa06e420dbbd05"]]}]

Where the node is operating fine without error but I keep getting told.

Also, what is going on with the 90+ warnings I have in play which seems to indicate that boolean string and number will not longer be supported in v1.

[{"id":"10f94718b7700e71","type":"server-state-changed","z":"f333c5f029164df3","name":"Lounge Presence","server":"6b73601d.45674","version":6,"outputs":2,"exposeAsEntityConfig":"","entities":{"entity":["binary_sensor.lounge_presence_occupancy"],"substring":[],"regex":[]},"outputInitially":false,"stateType":"str","ifState":"Detected","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":160,"y":2640,"wires":[["e8a60f18b5c748fc"],[]]},{"id":"6b73601d.45674","type":"server","name":"Home Assistant","addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"","connectionDelay":false,"cacheJson":true,"heartbeat":true,"heartbeatInterval":"60","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"","statusYear":"numeric","statusMonth":"2-digit","statusDay":"2-digit","statusHourCycle":"h23","statusTimeFormat":"h:m:s","enableGlobalContextStore":true},{"id":"f6d04423e35f3404","type":"global-config","env":[],"modules":{"node-red-contrib-home-assistant-websocket":"0.80.2"}}]

So apparently I can no longer use Node Red to control lighting where a motion sensor returns True or False for motion detection.

Any insights into these errors and warnings?

The first image is complaining about the function. If you open the function, it tells you you are trying to perform a mathematical operation on a date obj. Use Date.now() for the time in milliseconds.

As far as the delay, have you tried deleting it, deploying and dragging a new delay to the work space?

Thank you for replying.

Still getting my head around Node Red - so much appreciated.

I have opened the Function and looking where it tells me I am trying to perform a mathematical operation on a date obj.

This is the most complex one I have done to date :slight_smile:

I cannot see any indicator but if it is time function then I guess it is somewhere here it having an issue with (despite working)

// ------- FIND TIME UNTIL OFF-PEAK -------
const now = new Date();
const today = new Date(now.toDateString());

// Construct time object for off-peak
const [offHr, offMin] = offPeakStart.split(":").map(Number);
const offPeakDate = new Date(today);
offPeakDate.setHours(offHr, offMin, 0, 0);

// If past 23:30, assume next day
if (now > offPeakDate) offPeakDate.setDate(offPeakDate.getDate() + 1);

const hoursRemaining = (offPeakDate - now) / (1000 * 60 * 60);

// ------- FORECAST -------
const canRunHours = usableEnergy_kWh / avgHouseUse_kWh_per_hr;
const shortage_kWh = Math.max(0, (hoursRemaining - canRunHours) * avgHouseUse_kWh_per_hr);

I used your feedback and ChatGPT gave me this change

// ------- FIND TIME UNTIL OFF-PEAK -------
const now = new Date();
const timestampNow = now.getTime(); // safe ms timestamp

// Parse off-peak time for today
const [offHr, offMin] = offPeakStart.split(":").map(Number);
const offPeakToday = new Date();
offPeakToday.setHours(offHr, offMin, 0, 0);
offPeakToday.setMilliseconds(0);

let offPeakTimestamp = offPeakToday.getTime();

// If already past the off-peak time, move to tomorrow
if (timestampNow > offPeakTimestamp) {
    offPeakTimestamp += 24 * 60 * 60 * 1000;
}

// Hours remaining until next off-peak
const hoursRemaining = (offPeakTimestamp - timestampNow) / (1000 * 60 * 60);

// ------- FORECAST -------
const canRunHours = usableEnergy_kWh / avgHouseUse_kWh_per_hr;
const shortage_kWh = Math.max(0, (hoursRemaining - canRunHours) *

and now no complaints from Node Red - Many thanks !!! I’ll compare the two and take it as a learning opportunity :slight_smile:

Creating another 4 second delay and replacing the one that was complaining worked! Ok will try that trick on others when I see it :slight_smile:

As for the ‘State Type’ setting will be removed in version 1.0. As far as I can tell I have updated the config but still getting the warning.

What else is required to be changed?

Uploading: Screenshot 2025-11-16 at 15.32.30.png…

I have gone through loads of these but they are still showing a warning, so missing something here.

Sorry to be a pain and being really stupid - but I cannot fathom how to address the issue from the warning message.

Thanks again for your help

If you look at the state of the entity in devtools, more than likely it’s a string "on". It not actually a boolean. The state type needs to be set to string. The comparator needs to be changed to is and the value on.

image

Read the 5th post in the “State type is depreciated…” link provided above. It’s an excellent write-up of what is happening, and explains exactly what needs to be done to fix it.

1 Like

uggggh that is a lot of nodes to update that were working and need updating to keep them working :frowning:

Thanks for the pointer

So it looks like I go through the list of Issues with ‘State type is depreciated …’ look up the entity in Dev Tools to determine the output and if it sends on/off for motion previously triggering a boolean and change the node to ‘If state is on’ and change output to msg.payload Boolean True to keep it working in v1.0

example

Having done this should it reset the Warning state after a Node Red Resart?

At the bottom of that node, depreciated settings where the yellow text is, change the state type from boolean to string.

Will do, thanks for the pointer.

I think I have got it….

Thank you for your support and patience

1 Like