atm iam trying to readout my values from my Inverter. The Inverter shuts down if there isnt enought input from the Solar panls. At this point i want to send the last value that was readed since the inverter ist back online.
To lookup for the Inverter iam pinging it and if there isnt any response i want to repeat the last value that was stored to influx-db.
If the Inverter is offline there should be stored a "0" in the Database for actpower, but it wont be stored. any suggestions what iam doing wrong? Or will InfluxDB delete the "0" for performance?
So you know if it is offline so connect a change node to create the data you want in a msg and then connect it's output to the flow where it would send the data to the influx-db.
It is if you look at the first Picture from my first post^^
Ill think it could be a problem with the format, for the datas that iam storing if the Inverter is online iam using this to convert it to numbers: $number(payload)
If iam selecting converting it to number directly it wont work
In the offline-method iam injecting a number directly maybe this can be the problem.
But the most common problem ist to repeat the value total_produce since the inverter is back online
//EDIT
Easy explaination:
If the response of the ping is false i want to repeat the last sended value of total_produced. This should be done since the Inverter is back online
How are you pinging the device and what result do you get if it is offline? You will need to store the data each time a reading occurs (look into flow context), then when you determine it os offline, retrieve the data you stored and send it thru.
Ok so you can test the result to see if if it is online or offline. So when it is online, you need to start the current reading in a context variable (see Working with context : Node-RED).
Then when you find it is offline, you will retrieve the context data and send that to the database.
Perhaps all you need to do is use a Trigger node configured as below at the appropriate point in your flow.
That sends on the message each time one comes in, but if there is no input for 1 minute then it will resend the last one every minute. Adjust the timeout as appropriate obviously.