InfluxDB With Nodered Help Please

Here’s my setup:
I have a Sunny Webbox that is monitoring my solar power system. I use the Modbus integration to grab data from this box. I put this data into an influxdb database and can use grafana to graph it. All this works. For the most part, I followed instructions I found to do this. I have zero experience with influxdb.

I would like to write a nodered flow that grabs data from the database and acts on it. For example, I’d like to check the daily energy output of the system every evening and send me a message if the output is below a threshold for some number of consecutive days. I think I can handle doing all of the other work for this. What I’m struggling with is how to get data from influxdb. The database is called homeassistant2. I created a user called nodered and set it up with r/w access to the database.

Quite honestly, I’m so lost that I don’t even know where to begin or what questions to ask :). I could sure use a jumpstart. If you’ve done something like this, clue me in please. If you know of an applicable tutorial video, point me to it.

I guess another way of asking this is…
Is there a way to create an entities that have the values I want? Perhaps an automation that regularly queries influxdb? Or maybe a direct link to it? If so, then my nodered flow wouldn’t need to directly access the database. It seems like this would be easier for me to deal with.

If you have HA in the mix, which it seems you’re implying, you can use the influxdb integration to create sensors directly from influx data.

I am using HA. Thanks, I will look at this. I also am having some success with the influxdb node in nodered. I’ll post something here if I can get something working.

Are you using influx as your main database in home assistant? Another approach would be using the nodered companion.

Rather than send the information to influx and then making a sensor from that, you would create a sensor in home assistant. That sensor would then be automatically added and recorded inside influx.

Well, when I first starting using influxdb, I followed instructions in a video to get modbus data into the database and interface grafana to that. So the data is already in an influxdb database even though I have not yet used it in any kind of automation. As I said, I did manage to get data from influxdb using the influxdb in node. I’m working on an automation that uses it. So, I think any remaining issues will have to do more with nodered and not influxdb.
The attached image shows how I set up the node. This gives me one value in an array that is the maximum over the previous 24 hours. My solar monitor produces an increasing value for the total output up until about 8pm, then is zeroes it out. So when I run this at 11pm, I get all the values from 11pm the previous day. The max will be the total for “today”. A bit crude, but it does what I want it to do.