Closed manustars closed 2 years ago
You can use a Home Assistant component, "Integration - Riemann sum integral" see https://www.home-assistant.io/integrations/integration/ this component use the meross energy sensor and calculate the KWH consumed:
see my example, in this case, sensor.meross_presa1_lavatrice_power is the power provided by the meross lan integration. and Consumo_Presa_1_Kwh is the caluleted energy in KWH, used to sum the daily, week , month .... energy.
- platform: integration
source: sensor.meross_presa1_lavatrice_power
name: Consumo_Presa_1_Kwh
method: trapezoidal
unit_prefix: k
round: 2
and you can use a "utility meter" see https://www.home-assistant.io/integrations/utility_meter/ to have the total energy by day, week, month etc:
see my example:
utility_meter:
presa_1_daily_energy:
source: sensor.consumo_presa_1_Kwh
cycle: daily
presa_1_weekly_energy:
source: sensor.consumo_presa_1_Kwh
cycle: weekly
presa_1_monthly_energy:
source: sensor.consumo_presa_1_Kwh
cycle: monthly
presa_1_quarterly_energy:
source: sensor.consumo_presa_1_Kwh
cycle: quarterly
presa_1_yearly_energy:
source: sensor.consumo_presa_1_Kwh
cycle: yearly
This is the result for the weekly counter:
I know this solution for convert and utility meter, but on the app meross i can see all consumation without reset value (utility meter max 1 year). it is possible to take that data that it generates on the application?
If you add the utility meter to the energy panel HomeAssitant store the data and you can see for example the last year.
In my case is not complete the year, I added the Meross device on october 2021.
Hello @manustars , The plug itself (when queried by meross_lan or the app for the matter) usually reports the last 30 days (1 month) worth of data so these 'year long' sonsumption data are likely saved on the meross cloud (Just guessing since I'm not using the plugs with meross cloud and I can't check)
In meross_lan I only take care of the current day reading since it would be a bit awful to expose a sensor for every past day of energy consumption (this is the only way the data could be carried on in HA: 1 entity for every reading). It might be possible though to add the past days readings as attributes to a single sensor entity and then you could use HA templates to extract these info but..as @F74 pointed out....
You can leverage the 'Energy dashboard' in HA to track life-long statistics of any of your devices (or sensors generally reporting energy usage) and this very easy, powerful, and complete. In the dashboard you could then query over past periods and compare you energy usage. Also, the unit would then be converted to kWh automatically and without any 'conversion pain'
This points me to your first question: have the sensor reading in kWh. Changing the unit in meross_lan code (even if possible and easily implemented) would 'invalidate' previous sensor readings in HA db since this is how HA works: sensor values are 'numerically' saved in history. The unit is a 'property' of the sensor and is not saved to the db. Should meross_lan allow you to change the unit, the new readings would be saved 'numerically' in the history log and you'll see a change of scale in the underlying data with no way to manage this (i.e. you'll see previous Wh saved in the history now shown as kWh but without proper conversion: for example 1000 Wh yesterday would be shown as 1000 kWh)
Thats why I 'should say' : no it is not possible to change the energy reading to kWh. In order to manage unit conversions we'll have to wait the HA team to (likely) implement this for energy sensors (they've already implemented unit conversions for temperatures so this could be on the todo list for the main team) Also, the energy dashboard already gives you a powerful tool to manage energy readings. Also, if you really need the sensor to have (and show in your UI) kWh you could still implement a template sensor in HA using the original Wh from the meross_lan sensor and use that sensor instead for your UI
thank you very much and congratulations for the work you do
it is possible to see the "total consumption" sensor and convert everything into kwh