Closed gabry1609 closed 2 years ago
So :) I finally was able to play around with APIs, here's what I found:
By calling the homesdata endpoint, without putting anything inside, you'll retrive your house id + the complete list of all the devices connected, in my case I can see the gateway itself (NLG), the remote command "Entra&Esci" (NLT) and also my energy meter (NLPC).
All the devices are listed with their properties, like following:
Now focusing to the getmeasure instuction, which is the one we need to get all the energy values out of the energy meter, I was able to get my readings by passing these params to the function:
I compared the data inside the Netatmo Control page with the output from this call and it's absolutely correct πͺ Here are some screens attached:
for some reason the response is skipping the first measurement, I assume it's something related to the epoch begin calculation but apart from that, all the other measurings are correct. We should only take in count to divide each measurement by 1000 if we want to get kW.
Just few words about the sum_energy_elec$x parameter, under the "types" for getmeasure:
This parameter is supposed to differentiate the energy cost based on tariffs. In some contracts (like mine) there is the possibility to have two different prices, split by two timezones. So, for example in my case I pay more from 8:00 am to 7:00 pm. Therefore, my energy price increases a little and during the remaining time period, the price goes a little bit down. Here is the case I manually configured inside the Netatmo website:
And as you can see the blue bar indicates the on-peak tariff ($1). The white bar, instead, represents the off-peak ($2).
I'm not 100% sure about the correct behaviour for this parameter. I don't know if it's better to have only one tariff ($0) and let Hass change the price dinamically using an automation that triggers a numeric value change inside a numeric helper or directly fetch both the two tariffs. If we choose the last suggested way, at this point I think it's better to have different sensors to fetch all the three tariffs.
I'm pretty sure we should do something like this, so we should ask everytime for the last reading and push it to the energy dashboard. This is something that Hass should do by itself, so the sensor should only display one reading at time, in the shortest time possible in order to get the maximum accuracy, accordingly to API limitations. A more complex approach might also take in count the historical readings inside Netatmo site and use them to refine data inside the energy dashboard, but for sure the sensors must be a sort of "counter" that increases by itself and resets on their own at the end of the day.
Hoping this was helpful, I'm here to discuss more and get suggestions. Can't wait to test these sensors inside HA.
Thanks!
Support added, so I am closing this request. Only minor tweaks needed to get historical values, since at the moment we can retrieve instant power values each 5-6 mins.
Hello and thanks for your precious work.
I tought it would be interesting to report the power consumption coming from energy meters like these. As you already know and can see they're all widely supported by the new API Home+Control from Netatmo. By checking the dev page, I can assume these devices are part of the "Wiring devices with Netatmo / Electrical panel with Netatmo" family, therefore they should use the NLPC (Connected energy meter, according to the chart) API type for connected energy meters. As for the gateway, we can use NLG / NLGS.
There are plenty of settings for this API's scope, including tariff calcualtion and so on. I think that using the "getmeasure" function, we should be able to get power consumption and all the relevant electrical data out of this kind of sensors. Afterwards, pushing this data to a specific energy sensor inside the Home Assistant instance, should give us the ability to track the consumption almost in real time (you know, API limits...) inside our energy dashboard.
A more significant approach should gave us the ability to directly connect to the energy meter and get data in real time (or at least with a really low latency) in order to trigger automations (e.g. switch off high-power demanding outlets / devices if we're asking for more than "X" kW of power, to avoid shutdown by electrical service).
I have an F20T60A connected energy meter available for testing purposes ππ» it's communicating to the network using a K4510C gateway (which is similar to the DIN-mounting version).