My emonCMS runs on the emonPI, not the hosted version.
I have some pickups on my central heating zone valves, and pump (optical isolators that feed a PIZero which makes API calls to the emonPI). As the data changes infrequently the PI only makes an API call to the emon on state change or every 10 minutes.
As the data changes so infrequently I process the input as PHPTIMESERIES, this works fine, except when I want to graph the data, the emon connects the infrequent points by lines and I get a âsawtoothâ plot (pic 1). itâs hard to see whatâs going on.
What I want to see is the value graphed held the same until the next change, so I get a âstepâ. I can do this myself with a bit of post processing in Python/Pandas, (pic2) itâs a lot easier to see the timing of the valve opening then the pump running.
Is there a way to do this in emonCMS?
PS if not possible and anyone wants it a little example of how to do this is attached, it uses dumped data but can also be used with the API reading scripts I shared earlier.
I tried this and got attached, it now draws a line vertically from 0 to the point? I donât think itâs what I am looking for. Below explains what I am looking for zoomed in on a small time frame for one signal the heating valve, There are three points written to the emon
2023-02-24 19:52:50, 0 (valve has been closed for > 10 mins)
2023-02-24 19:55:10, 1 (valve opens)
2023-02-24 19:59:10, 0 (valve closes)
Between 19:55:10 and 19:59:10 the valve is open, if I were to look at the value of the feed âliveâ between these times it would be 1, i.e. the last value.
When I later plot the data , I would like the value between these times to be 1, not an interpolated line. Iâve drawn on the screenshot in red what I am looking for.
I could probably do this by changing the interface to write every 10 seconds and use PHPFINA for the feed, but this seems wasteful both in terms of storage and also the number of calls the interface has to write.
Industrially on control systems process historians etc it is quite common when acquiring the data to get sparse non frequent data sent/stored to reduce bandwith, power and storage. saving a value only on state change as the valve example here, or in the case of analogue signals if they change by more than a certain deadband or itâs more than a certain time since the last one.
There is then a setting in the signal meta data such that when it is queries/visualized the returned value between the set points can either be an interpolation, or the last value. In the case of last value itâs sometimes called a âstep trendâ
I see what youâre trying to get, but thereâs no specific âstepâ mode for the graphs.
One way that might work is to set the interval to 10 seconds, check âFixâ and untick âLimit to data intervalâ and press reload. This fetches the data at 10 s interval and fills in the missing points.
This technique works well up to a certain zoom, and then it complains about too many points.
The other thing to try is a setup a PHPFINA feed with 10s interval, and use the âLog to feed (Join)â process step. This will allow you to upload new data periodically, and the feed will automatically fill in the missing points. Still a wasteful on space, but doesnât take much more processing.
The tricky thing here is that it adds âmissing data points with a straight line between the newest value and the previous valueâ, which isnât quite what you want. If you can upload both old and new values each time the value changes, than it will hopefully create data in a stepped shape:
2023-02-24 19:52:50, 0
âŚtime passesâŚ
2023-02-24 19:55:10, 0 â old value
2023-02-24 19:55:10, 1 â new value
âŚtime passesâŚ
2023-02-24 19:59:10, 1 â old value
2023-02-24 19:59:10, 0 â new value
Neither are ideal solutions, but maybe one will work for you.
I found that I also needed to graph some data this way, so I had a go at adding this to the Graph module. It turned out to be really easy, so I submitted a pull request:
Should work on all feed types. Looks great with data from Agile OctopusâŚ
Well done this is exactly what I was looking for! How do you define a feed as âStepâ? Excuse my ignorance, I have never really understood git, but whatâs the process now - does it end up in the âmain buildâ of emon and I can add to the emonPI with an update?
When the maintainers of EmonCMS approve this request, it will be merged into the main build, and then youâll be able to update your emonPi. I donât know how long weâll need to wait for that; theyâre often busy with other things.
The new step type will appear in the Graph module; you wonât need to change any feeds.
I would use this too, I donât see it in my Graphs page (emonpi) so either it didnât make it, or I havenât properly updated my emonpi installation.
Hello @fascenda this was merged into the master branch in March but not Stable. Iâve merged it now into Stable, if you can run a full update again that should sort it.
Thanks, I have it now, looks great. Here is simple example, using VARIABLE feed type. Garage door sends a message when state changes, the two variables are (1) status change (open or close event are the usual), and (2) interval where that status is open (to view when the door stays open). With variable type I donât need to poll the device, it issues an MQTT message only when status changes (which of course is infrequent).