-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lost total daily energy sensor in v2 plug #82
Comments
Right. The icon with the "24" number makes a lot of sense to me, the name "Total Energy Since Boot" however not so... |
Iirc the plugs have one reading that is supposed to be the 'daily' reading (but it's crap as if you reboot or flash it goes back to zero also) and another that is the Total sensor (kind of like a lifetime total). IMHO best option was to ditch them all and move to using a custom component that gives a daily, yesterday, weekly, monthly and yearly sensor. |
What's the custom component you are using? |
Have a look at the configuration that I run: Note that these configs call other yaml to then compile the 'full' yaml for each device, namely these plugs call: Base Config, that applies the same set of standard sensors that ALL my esphome devices have: WiFi Config, sets up WiFi and adds the WiFi sensors I use: Athom Plug config, allows having one file with all the athom plug specific settings in it, instead of seperate per version to maintain: In the athom plug config, I call the custom component (based off Dentra's, but expanded) using:
Then from line 193 to 233 I call the sensors this adds: https://github.com/Roving-Ronin/myHomeAssistant/blob/cfbc444b6f77b36c1b5101c47481f049117d9b0b/esphome/sensors/athom-power-plugs.yaml#L193 I keep the existing Total Energy sensor (that roughly shows the lifetime kWh..or at least to some reflash stuffs it) at: https://github.com/Roving-Ronin/myHomeAssistant/blob/cfbc444b6f77b36c1b5101c47481f049117d9b0b/esphome/sensors/athom-power-plugs.yaml#L193 I also keep the existing Energy sensor (that I think you refer to as the 24hr one, but its useless as it resets when rebooted / flashed etc), but just change it to be 'internal', so it works within the ESP device and other sensors can call it if needed, but otherwise it isn't visible on the web GUI or published to HA: https://github.com/Roving-Ronin/myHomeAssistant/blob/cfbc444b6f77b36c1b5101c47481f049117d9b0b/esphome/sensors/athom-power-plugs.yaml#L185 I also use webserver v3 (instead of v2 your used to seeing) that allows sorting the order of sensors in the WebGUI (not HA) and if you click on a sensor it will show a graph of its data. Oh and in my Base config I also run an extra text sensor that allows defining the 'Power Circuit' (I have 3 phase and 3 different circuits for wall outlets in the house), that allows filtering ESP devices by the circuit they're on / turning devices off if they are on a certain phase etc. I have to update my template for one thing currently, one I sort out this issue: #87 pending that you can just apply it and make sure to update the selector in 'Power on State' to what you want. Web Server GUI looks like: Note:
Could I ask that if you use this component, you let me know if this is working when booting/flashing in future. It should but feedback/confirmation appreciated. |
If you want to use the above, you can either FORK my repository and pull off your own repository, or else here's the yaml I use for a device to work in my ESPHome/HA and pull the code for the above. Please remember to update the substitutions to reflect the names / HA zone location / Power Circuit of your own device(s). Smart Plug v2
Smart Plug v3
PS. I have set the refresh (to check for updates on my repo) to 5 days, so any updates I make DON'T flow through to you immediately, in case I end up removing them / roll back. |
BTW if you don't want to have your HA storing the device uptimes, WiFi IP and other things that aren't needed. Add this into your recorder.yaml and restart.
|
Thank you so much for this detailed response! This answers almost all of my questions. I think I'll stick to the original yaml for the moment, I just need to adjust the new "Total Energy Since Boot" entity, although I don't really use / need it anyway. |
If of any interest to people, I've added in:
If you want to make this time period longer, run off your own fork and just change the 300 (5min in seconds) into something longer, at: https://github.com/Roving-Ronin/myHomeAssistant/blob/4bb6a50061d496e6e782849109831cdd588173db/components/energy_statistics/energy_statistics.h#L33. PS. If you do this you should also change the following line in the athom yaml to match, so the Energy Total defined in globals is saving at the same frequency:
Can't work out how to get it to work properly atm, but would like to see if I can add a number input (or pull down with 5min / 15min / 30min etc options) that displays on the WebGUI/HA, that the component would then read and dynamically change the save period.
BTW there's other sensors to do the same for Water (L) and Gas in m3 and megajoules (MJ) - see screenshot below. If anyone wants to test, it would be appreciated. Note: As gas / water usage and water readings aren't as frequent compared to power, these run with a 15min time period between saving to ESP flash / lifespan. Next I have to see about:
PS. Was we have mandatory rain water tanks, that are used for things like laundry / garden water, the 'normal' Water above is labelled "Town Water", as I intend to add a "Tank Water" in future (with a pulse meter added into the supply from rain water tank), so it will also then show daily/weekly etc for the Rain/Tank Water, and probably then have a 'Water' sensor that shows shows combined usage for all water types in total, plus daily/weekly etc. If this is of use to people please shout out, wondering if this is something that others see value in and if it should be submitted as a built in component for ESPHome? |
since updating to the latest esphome in home assistant and reinstalling the latest athom-smart-plug-v2.yaml script, i’ve lost my total_daily_energy sensors.
here is my config yaml:
EDIT: it looks like it's actually turned into "Total Energy Since Boot". Use of the word "boot" vs. "daily" is a regression imo, because boot implies energy consumed during entire uptime.
The text was updated successfully, but these errors were encountered: