jason0x43 / hacs-hubitat

A Hubitat integration for Home Assistant
MIT License
191 stars 46 forks source link

Integration is using deprecated `DEVICE_CLASS_*` constants #191

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,

jason0x43 commented 1 year ago

I had started that a few weeks ago while making another update, and I just haven't gotten back to it yet. I'll work on that. 😄

PeteRepeat77 commented 1 year ago

Excuse the novice question.. but is this why all my Hubitat buttons in HA have been deactivated? Hubitat buttons no longer trigger automations all of sudden for me.

jason0x43 commented 1 year ago

Did you recently update the integration? The release 3 days ago (v0.8.4) makes the update described here.

jason0x43 commented 1 year ago

I’m running the latest release, and Hubitat buttons are firing events in HA. Is it possible that something on your network has changed so that Hubitat can’t send events to HA?

PeteRepeat77 commented 1 year ago

When I go into a button device (in HA) in the integration, all entities in the sensor section are hidden. If I click to show the hidden entities, and open up "pushed" for instance, it says it's disabled. All button entities are.

PeteRepeat77 commented 1 year ago

I'll explore a little more as it seems I may be an isolated case..

frenck commented 1 year ago

Excuse the novice question.. but is this why all my Hubitat buttons in HA have been deactivated? Hubitat buttons no longer trigger automations all of sudden for me.

This specific change or reported issue, cannot influence that. Both old and new styles constants are still fully supported. Nothing in this report is breaking or will cause breakage.

This issue was raised by me to prevent possible future breakage.

../Frenck

jason0x43 commented 1 year ago

Closing this as resolved in v0.8.4.

@PeteRepeat77 As @frenck points out, this particular issue wouldn't cause the problem you're experiencing, but feel free to open a new issue if things still aren't working!

frenck commented 1 year ago

Thanks for resolving this matter @jason0x43 👍

../Frenck