Repeat last value if no value submited

Hey @ll,

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.

This is may actual Node:

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?

I'll hope someone can help me out^^

How do you determine if the inverter is off line?
You should be able to use that to trigger a flow setting the data you want and sending it on.

ping

this way

i think that there could be a problem with the msg that should be send. Ill take a deeper look if the Inverter is offline.

But how can i repeat the last value if the Inverter ist offline? For maybe total_produce.

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.

not sure what you mean by

Iam using the ping-node to send a ping to the Inverter, i dont know what should i explain about this.

If the inverter is online iam getting the ms as result, if its offline iam getting the boolean false.

If its online iam getting the status.html of my Inverter an reading out the needed informations.

If its off iam wanted to use the last sended value of total_produce to repeat it since the inverter is back online.

I think you mean -> repeat it UNTIL the inverter is back online.

yes my fail^^

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.

/start/store/

Ok, but without any good explaination that isnt 100% theoretical like the explaination on the site you linked i wouldnt understand how it works^^

Sry iam from Germany and my English isnt perfect, so such explainations like on the linked Site i dont understand to 100%

@dceejay
your explaination isnt enought to understant anything sry

Perhaps all you need to do is use a Trigger node configured as below at the appropriate point in your flow.

image

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.

ok i think this should be the answer, thanks for help.
I'll mark it as solution if it works

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.