Skip to content
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

Update for new energy dashboard & timeouts #9

Open
anthonywalker75 opened this issue Aug 13, 2021 · 7 comments
Open

Update for new energy dashboard & timeouts #9

anthonywalker75 opened this issue Aug 13, 2021 · 7 comments

Comments

@anthonywalker75
Copy link

Add necessary attributes to allow home assistant's new energy dashboard to use lightwaverf energy monitor sensor data

Also seem to experience excessive timeouts events. see below:

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:657
First occurred: 4:02:20 (559 occurrences)
Last logged: 21:36:12

Update of sensor.electricity_current_usage_w is taking over 10 seconds
Update of sensor.electricity_energy_today_usage_kwh is taking over 10 seconds

@asantaga
Copy link
Owner

The timeouts occur because I only wait for 10s before releasing back to HA. This is so we're not blocking unnecessarily. I could rewrite the component using async but "time poor".

I'll look into the attributes for the new energy dashboard, this is a good idea

@proffalken
Copy link
Contributor

FWIW, https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics is the link to the new stats setup, if I find time I'll try and take a stab at this, but not sure when that might be at the moment...

@proffalken
Copy link
Contributor

OK, I've had a couple of attempts at this without any luck this morning, the documentation seems to be... lacking... so I've asked for help on the forum

@dsymons
Copy link

dsymons commented Sep 2, 2021

As a temporary 'fix' I create an integration sensor using the following YAML:

  • platform: integration
    source: sensor.electricity_current_usage_w
    name: Grid Power Consumption
    unit_prefix: k
    unit: kWh
    round: 2

You then need to customise the entity (Configuration -> Customisations) and set the device class to energy (you can't seem to fo that directly in the YAML)

That allowed me to get the usage into the Energy tab.

Ideally the parameters should be set on the today usage measurement. The key I think is the last reset and making sure all the clocks agree but I haven't had time to look at that.

To get rid of the timeout errors and drop out in communications I edited the code to give a longer timeout to receive the data, bad I know but all working atm!

David

@asantaga
Copy link
Owner

asantaga commented Sep 2, 2021

Hey , nice workaround

I'll get this done asap, I was on a 2 week vacation in Tenerife with the kids. I did look at the spec and it looks really easy to tweak so I'll get this out of the door quite quickly..

thanks for pursuing! and using the integration. This one is simple enough that I may make it into a full blown HA component (not a fan of the process though)

@anthonywalker75
Copy link
Author

I was using the workaround and found that since the upgrade to 2021.9.1 the energy dashboard was complaining that the kwh integration was not using the correct state class.

I made a change to the customize.yaml file and this appeared to fix it.

configuration.yaml:
- platform: integration source: sensor.electricity_current_usage_w name: energy_spent unit_prefix: k round: 2

customize.yaml:
sensor.energy_spent: device_class: energy state_class: total_increasing ** was set to measurement prior to upgrade ** last_reset: '1970-01-01T00:00:00+00:00'

Hope this helps

Anthony

@asantaga
Copy link
Owner

asantaga commented Sep 6, 2021

started working on this, but got issues with my server. will debug tomorrow damm docker
@anthonywalker75 , so you've set the electricity_current_usage_w to total_increasing?? I thought this would be a measure..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants