ha-smartthinq-sensors: Error while setting up smartthinq_washer platform for sensor

Using integrations, I created a new one and entered the default values for country (US) and locale en-US and provided my access token. It created the integration w/o any issues but no devices were added. Here is the error from my logs:

Logger: homeassistant.components.sensor
Source: custom_components/smartthinq_washer/wideq.py:826
Integration: Sensor (documentation, issues)
First occurred: 8:21:38 PM (1 occurrences)
Last logged: 8:21:38 PM

Error while setting up smartthinq_washer platform for sensor

ValueError: 202 is not a valid DeviceType

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 179, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/config/custom_components/smartthinq_washer/sensor.py", line 462, in async_setup_entry
    if device.type == DeviceType.WASHER:
  File "/config/custom_components/smartthinq_washer/wideq.py", line 826, in type
    return DeviceType(self.data['deviceType'])
  File "/usr/local/lib/python3.7/enum.py", line 310, in __call__
    return cls.__new__(cls, value)
  File "/usr/local/lib/python3.7/enum.py", line 564, in __new__
    raise exc
  File "/usr/local/lib/python3.7/enum.py", line 548, in __new__
    result = cls._missing_(value)
  File "/usr/local/lib/python3.7/enum.py", line 577, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 202 is not a valid DeviceType

This was on HA 0.107.6

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 33 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Not real issue. Sometime connection close, also due to internet availability. This error is managed, and connection is automatically re-opened.

Added your states.

That’s what was expected, very well. Collect all possible message of this type and report here, than I will add these states for you with next release.

For sure mapping all possible state for all devices is a huge work. I will review a little bit the code to try to avoid errors and return something like “Unknown” when not managed. May be I can write unknown state on some file so that they can be managed id the future.

Let me think about this a little more, I come back when ready.

I make a fix, can you try now?

Ok,

it’s normal that wideq extract all devices registered, anyway solve this issue seems to be simple, I just update the Class “DeviceType” merging with yours that have complete list. Obviosly (at least for the moment) I only manage washer and other device will not be added.

I alaredy updated the code, let me know.

P.S. To simplify installation if you want you can add this repository to HACS, it should work.