skelgaard / homeassistant-apsystems

An APsystems Sensor for Home Assistant
Apache License 2.0
25 stars 9 forks source link

Update energy_day to work with energy dashboard #21

Closed freaksdotcom closed 1 year ago

freaksdotcom commented 1 year ago

Update the device class and state_class so the integration can be used with HA's energy dashboard.

Additional improvements:

  1. Format using black
  2. Run isort on includes.
  3. Add type hints in some places.
  4. Remove unused includes.
  5. Define OFFSET_SECONDS using datetime.timedelta to make the value and units clearer.
  6. Sort globals by name
  7. Use a NamedTuple for config metadata for attribute access to fields.
  8. Use f-strings instead of str.format()
skelgaard commented 1 year ago

i will test it out and look into it tomorrow :)

freaksdotcom commented 1 year ago

There's a bug in this PR, I'll sort it out and send an update. With the fixes it's working quite well though.

image

skelgaard commented 1 year ago

there is some sort of bug for sure... i can't see any production today and there is production

icecreamfarmer commented 1 year ago

There's a bug in this PR, I'll sort it out and send an update. With the fixes it's working quite well though.

image

Has this now been resolved or integrated. Because it doesn't work with my fresh install.

skelgaard commented 1 year ago

no there is still bugs in this, but i have taken the good parts and build it in manually in my version and will put that in the next version