Closed hawksj closed 8 months ago
Should have added that I have this code currently running in my HA instance where I sourced the screenshot. I have removed and re-added the integration multiple times in testing and initialization of the sensors hasn't failed.
Hey @hawksj, thanks for the PR. Please see below before I merge.
Hey @gadgetchnnel @plesetsk @atudor2 ,
Given I do not use an Amplifi router anymore would you please test and confirm this PR would work as expected before merge.
Hi @puttyman sure I can give it a test but it can only be next week as I'm away from my HA instance currently
This PR will have to be re-created, foolishly made this from my master branch and further commits are also now included in this PR.
Ignore first PR, I don't regularly work in public repos
Per https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics
Changed sensor.py to import extra objects from homeassistant.components.sensor to enable the entity to have SensorStateClass and SensorDeviceClass attributes. This allows for statistics graphs on the dashboard such as this:![image](https://github.com/puttyman/hass-amplifi/assets/58028821/ed56c21e-2857-416f-99c9-9aba08d0a60b)
I have tried to match the style of the original code by defining variables outside the function. Please suggest changes if the formatting is not correct.