Ok, that sound good. If mqtt with Smappee already running most work is done. The values for consumption and cost are calculated values and not delivered from Smappee. I have the total power value via mqtt. This value will be updated every second. What I do is to sum the total power in a variable as “consumtion in Ws”. In a second variable I divide the ws variable / 3600000 = Kwh ->today. With automation I sum with a trigger at time 00:00:00 KWh_today in variable KWh_month and reset the variable ws_today. In a second automation the trigger is time 00:00:00 with condition day_of_month=1 and reset the KWh_month variable. Same is done for cost calculation. Cost_today is kwh_today *0.25€ (price per KWh) . Month and year calculation same as before. To get a variable option in Hass.io I installed a custom component called “hass-variable” (Link: https://github.com/rogro82/hass-variables) I hope that explained how I did it.
1 Like