hif2k1 / battery_sim

Home assistant home battery simulator - allows you to model how much energy you would save with a home battery
106 stars 13 forks source link

Integration is using deprecated `DEVICE_CLASS_*` constants #53

Closed frenck closed 1 year ago

frenck commented 1 year ago

This custom integration uses deprecated DEVICE_CLASS_* constants in its codebase.

The DEVICE_CLASS_* constants have been deprecated and replaced in Home Assistant Core 2021.12 (over a year ago). I would highly suggest updating/migrating this integration to the new enums.

For example, for the device classes supported by the sensor platform, there is now a SensorDeviceClass enum. So if a sensor previously used the DEVICE_CLASS_ENERGY constant, it should now use SensorDeviceClass.ENERGY. Other platforms (like binary_sensor, and number) provide similar enumerations for their supported device classes.

The migration thus only consists of replacing constants with an enumeration member and is, therefore, very low impact and should be fairly straightforward.

If I can help resolve any questions regarding this change or migration, feel free to ask or respond to this issue. I'm happy to help!

Kindest regards,

../Frenck

hif2k1 commented 1 year ago

Thanks, I appreciate all advice about how to improve the code as I'm new to HA. Is there any source of documentation for this stuff? Doesn't seem to be good documentation on creating integrations in general.

hif2k1 commented 1 year ago

Found it now. Ignore that message.

hif2k1 commented 1 year ago

Hopefully resolved now