shenxn / ha-dyson

HomeAssitant custom integration for dyson
MIT License
312 stars 59 forks source link

0.16.4-3 broke again :( #122

Closed Anto79-ops closed 2 years ago

Anto79-ops commented 2 years ago

Hey!

thanks for the hard work in resolving the last issue with upgrading to 2022.4. My intergration was working well using 0.16.3 on 2022.4.1, then i upated to 0.16.4-3 and now i get the error below on HAOS via HACS.

This error originated from a custom integration.

Logger: homeassistant.loader
Source: custom_components/dyson_local/sensor.py:330
Integration: Dyson Local (documentation, issues)
First occurred: 12:30:38 PM (3 occurrences)
Last logged: 12:30:40 PM

Unexpected exception importing platform custom_components.dyson_local.sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 603, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 620, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/dyson_local/sensor.py", line 325, in <module>
    class DysonHCHOSensor(DysonSensorEnvironmental):
  File "/config/custom_components/dyson_local/sensor.py", line 330, in DysonHCHOSensor
    _attr_device_class = SensorDeviceClass.NONE
  File "/usr/local/lib/python3.9/enum.py", line 429, in __getattr__
    raise AttributeError(name) from None
AttributeError: NONE

as for what is actually happening, it seems none of my sensors are avialable (all sensors show "unvaiable" BUT I can control the thermostats.

Kakise commented 2 years ago

I swear to god my computer just doesn't allow me to write proper code, it's gonna kill me.

Anyway v0.16.4-4 works on my instance, does it fix the issue ?

Anto79-ops commented 2 years ago

@Kakise please no, lol! Your work and others is always appreciated here!

HACS hasnt pushed 16.4-4 to me yet (even after updating information), so i'll keep checking, as they are likely throttling me.

Anto79-ops commented 2 years ago

so weird that HACS is still not showing me that V0.16.4-4 is available. I keep pressing update information but its not show that an update is avilalble. Sorry, no updates yet but lookis like v0.16.4-4 is working for others so I suspect it will work for me.

EDIT: im starting to think that HACS doesn't recognize the update are available when its in this format v0.16.4-x and it doesn;t recognize the changes in numbers in x, because updating from v0.16.3 to v0.16.4-x worked no problem, but updating v0.16.4-x to v0.16.4-y hmmm still not showing up.

since the changes from v0.16.4-3 to v0.16.4-4 are minor:

  1. custom_components/dyson_local/manifest.json
    -  "version": "0.16.4",
    + "version": "0.16.4-4",
  2. custom_components/dyson_local/sensor.py

add empty line on line 325

-                 _attr_device_class = SensorDeviceClass.NONE
+ line 331    _attr_device_class = SensorDeviceClass.VOLATILE_ORGANIC_COMPOUNDS
....
 -                    return self._device.formaldehyde 
+ line 337        return self._device.formaldehyde

note sure what was done on line 337 as it was deleted but then added again the same line

i just made sure it matched this as in the final file with the last line being 337

    @environmental_property
    def state(self) -> int:
        """Return the state of the sensor."""
        return self._device.formaldehyde

wonder if I can just to do the changes manually, say using file editor?

EDIT 2

OK all good now, I manually did the changes using the change manifest from v0.16.4-3 to v0.16.4-4 and restarted HA and now everything works!!

Thanks so much again!

cheers

Anto79-ops commented 2 years ago

also, I don't know how HACS or HA supports version numbers, but I wonder if it the dot convention would have helped here- for example, 0.16.4.4 vs 0.16.4-4? just a thought

Kakise commented 2 years ago

also, I don't know how HACS or HA supports version numbers, but I wonder if it the dot convention would have helped here- for example, 0.16.4.4 vs 0.16.4-4? just a thought

Honestly I have no idea. But I'll keep that in mind and do more digging for the next release (which will only be in the x.y.z format anyway haha). Glad you found a solution ! :)