I am a new to Node Red and so far I am really enjoying it. Coming from a PLC and electrical background, the ‘ladder logic’ type layout is much easier for me to understand compared to YAML files.
I am currently struggling with one particular element of an automation flow however. I have a set of batteries that came out of equipment for the winter that are on a charger that is connected to a Kasa EP25 outlet with energy monitoring. I would like the automation to work as follows:
- Charger turns on and begins charging the batteries (electrical consumption grows to 50+ watts)
- Batteries begin to reach full charge (may take hours or days) and the electrical consumption steadily drops
- Once the electrical consumption reaches less than 5w and stays under 5 watts for 2 hours, turn off the outlet
- Start a timer for 14 days
- Restart the process
What I am unable to figure out how to implement is the 2 hours where the electrical consumption stays under 5w. The issue I am running into is when the batteries are nearing 100%, they bounce around from 8-5 watts for a long time, so I cannot just use a timer that triggers at 5w. I’d like a way to watch the electrical consumption for a rolling consecutive 2 hours and if the electrical consumption has been under 5 for the last 2 hours, proceed to the next step. How might I implement that?
A similar use case I have would be humidity in the bathroom. I’d like to turn on the fan at a high level value, and run the fan until it has been below the low value level for a consecutive 15 minutes.
Similar to a hysteresis, but with time rather than an analog value.