I have installed a Powerfox poweropti on my electric meter to read the consumption etc. I have set everything up and can read the current power consumption. But now I’m trying to read the monthly values to display them in a chart. I’ve added a new channel to my meter thing and created an item for the monthly values. The item always reads UNDEF.
The Stromzaehler_AktuellerLeistungswert channel works correctly and retrieves the correct value. The MonatlicheVerbrauch channel should retrieve all the available monthly values.
Delta holds the values I’m trying to retrieve. So is the state transformation correct? stateTransformation: JSONPATH:$.Consumption.ReportValues[*].Delta
Or do I have to do something differently since I’m retrieving two values?
How are you expecting to represent two number values in one number channel?
Really that doesn’t matter, because the JSONPATH transformation can only return a single string, not a real array.
It’s usually smart to experiment with a string type channel to begin with, then you can see what is coming out of your transform even if it is not strictly numeric. You’re probably getting a string like “[120.6, 40.6]”.
I will definitely post my solution as it is not as easy as I thought it would be, or I’m just not thinking in the right direction. Do you have any pointers for me? I need to get the monthly values into an item that stores the values in persistence. Once a month is enough. At the end of each month the Delta value is at its maximum. Do I have to do this via a time-based rule that triggers at midnight every month?
Any rough pointer would be greatly appreciated. I haven’t found a helpful example so far. Still searching though.
I’ve no idea what your data means. From an outsiders view, you’ve multiple identically-named data elements with different timestamps. What do you need to extract?
I need to extract the Deltas = energy consumption per month. So for example, "Delta": 40.06200000000001 shows the cumulative consumption at the end of last month. Therefore, it is will now never change as it represents the final value for the last month. The "Delta": 127.49199999999996 is the difference between the consumption from last month and the current month. So I want to store the value at the end of each month and display these in a nice chart. In June there will obviously be three Delta values. So I don’t have to calculate anything. Just store the date on a monthly basis.
Okay, so there are many ‘Delta’ values. How can you know which is what? You have to use the associated timestamp.
So to get any meaning from Delta you have to also get its associated timestamp, and keep the association. It’s no good jumbling this Delta with that timestamp.
Which means extracting the data at the channel is useless here; isolated single chunks of data is no use.
Process the JSON in a rule, as per the linked example. It won’t be easy.
There might be a fingers-crossed cheat, just get all the Deltas and assume the biggest one is the most recent one.
hope you meanwhile managed to get the relevant data
Do you also have extracted current data into items? I am looking to identify when iam feeding power from my solar panel back into the provider network - to enable elements like washing machine or others to kick off running.