kevinvincent / ha-wyzesense

A Home Assistant Component to interface with the WYZE Sense hub and sensor system
368 stars 97 forks source link

Core 2022.4.0 looses sensor attributes #223

Closed sweichbr closed 2 years ago

sweichbr commented 2 years ago

I know this project is technically dead, but I just updated my HA to 4.0 and all wyze sense attributes are gone (and we all know how important the battery level is).

Anyone know what the issue may be?

sweichbr commented 2 years ago

Falling back to 3.8 and the sensors are back.

stanwebber commented 2 years ago

i can confirm this behavior. i'll wait to see if anything changes in 2022.4.1, but if not i'll be rolling back to 2022.3.8 and staying there maybe indefinitely.

bschatzow commented 2 years ago

Same for me. I did not notice it on the beta ( I wish I had seen it there and reported it).

strikeir13 commented 2 years ago

This is because of the change from device_state_attributes to extra_state_attributes. There is an open pull request to resolve this, but the change in the pull request can also be manually added to address the error: https://github.com/kevinvincent/ha-wyzesense/pull/218

stanwebber commented 2 years ago

i have the fix in #218 applied, but the sensor attributes are still lost in 2022.4.0.

bschatzow commented 2 years ago

I manually changed my file and the attributes are back.

sweichbr commented 2 years ago

Yup. Worked for me too. Thanks @strikeir13 for the tip.

stanwebber commented 2 years ago

well hell. thought i had merged a pull request with this fix in my fork back in jan, but i must have forgotten about it. merged the fix and updated my custom components, but the attributes are still missing. not sure what to look at next.

sweichbr commented 2 years ago

I just went into the wyzesense/binary_sensor.py and made the change. Then restarted HA and they reappeared.

On Thu, Apr 7, 2022, 9:33 PM stanwebber @.***> wrote:

well hell. thought i had merged a pull request with this fix in my fork back in jan, but i must have forgotten about it. merged the fix and updated my custom components, but the attributes are still missing. not sure what to look at next.

— Reply to this email directly, view it on GitHub https://github.com/kevinvincent/ha-wyzesense/issues/223#issuecomment-1092353838, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKI5HDGP3WIXWPABGIVPST3VD6EHDANCNFSM5SXLRI6Q . You are receiving this because you modified the open/close state.Message ID: @.***>

bastero commented 2 years ago

I manually changed my file and the attributes are back.

Forgive my ignorance...Can you be more specific about the change in 'custom_components/wyzesense/binary_sensor.py' ?

What I understand is to change the function's name i.e. 'device_state_attributes' to 'extra_state_attributes'. save and reboot HA. If there is any other change(s) required please advise.

However, this change below doesn't show the attributes once I reboot HA. Please clarify, thank you.

   def extra_state_attributes(self):
        """Attributes."""
        attributes = self._data.copy()
        del attributes[ATTR_STATE]
        del attributes[ATTR_AVAILABLE]
bschatzow commented 2 years ago

The only change I made to my binary_sensor.py file was

    @property
    def extra_state_attributes(self):

Make sure that you used a text editor and did not change any of the spaces. Mine worked as soon as I did a restart or HA

Kev7274 commented 2 years ago

I manually changed my file and the attributes are back.

Forgive my ignorance...Can you be more specific about the change in 'custom_components/wyzesense/binary_sensor.py' ?

What I understand is to change the function's name i.e. 'device_state_attributes' to 'extra_state_attributes'. save and reboot HA. If there is any other change(s) required please advise.

However, this change below doesn't show the attributes once I reboot HA. Please clarify, thank you.

   def extra_state_attributes(self):
        """Attributes."""
        attributes = self._data.copy()
        del attributes[ATTR_STATE]
        del attributes[ATTR_AVAILABLE]

Same here,doesn't work.

bastero commented 2 years ago

The only change I made to my binary_sensor.py file was

    @property
    def extra_state_attributes(self):

Correction: It actually took some time but its now indicating battery attributes as it did previously. Thank you!!

stanwebber commented 2 years ago

it's been 2 days and i've restarted the host and hass a couple times, but i'm not seeing any attributes. i even pulled the custom components folder via sftp to manually verify the binary_sensor.py file had the fix and it did.

Kev7274 commented 2 years ago

Everything seems to be working again. I had to retrigger the sensors for them to show up.

stanwebber commented 2 years ago

working now--all devices need to be physically triggered after the change. i lost a contact sensor (dead even with fresh battery) which added to the confusion.