sanjoyg / dirigera_platform

HomeAssistant Integration for Dirigera Platform
MIT License
123 stars 16 forks source link

JSON Dump of STARKVIND Table air purifier #22

Closed BeauGiles closed 8 months ago

BeauGiles commented 8 months ago

As mentioned in the other STARKVIND issue (https://github.com/sanjoyg/dirigera_platform/issues/6#issuecomment-2016793784), my STARKVIND table (https://www.ikea.com/au/en/p/starkvind-table-with-air-purifier-stained-oak-veneer-white-smart-40461971/) isn't showing in Home Assistant.

Here's the relevant bit from the JSON dump

    {
        'id': '979e33c7-2d25-458a-9178-1bcac4e06b77_1',
        'type': 'airPurifier',
        'deviceType': 'airPurifier',
        'createdAt': '2023-01-21T16: 44: 36.000Z',
        'isReachable': True,
        'lastSeen': '2024-03-25T07: 45: 49.000Z',
        'attributes': {
            'customName': 'Airpurifier1',
            'model': 'STARKVINDAirpurifiertable',
            'manufacturer': 'IKEAofSweden',
            'firmwareVersion': '1.1.001',
            'hardwareVersion': '1',
            'serialNumber': 'XXXXXXXXXXXXXXXXX',
            'productCode': 'E2006',
            'fanMode': 'off',
            'fanModeSequence': 'lowMediumHighAuto',
            'motorState': 0,
            'motorRuntime': 396238,
            'filterElapsedTime': 116489,
            'filterAlarmStatus': False,
            'filterLifetime': 259200,
            'childLock': False,
            'statusLight': True,
            'currentPM25': 0,
            'identifyStarted': '2000-01-01T00: 00: 00.000Z',
            'identifyPeriod': 0,
            'permittingJoin': False,
            'otaStatus': 'upToDate',
            'otaState': 'readyToCheck',
            'otaProgress': 0,
            'otaPolicy': 'autoUpdate',
            'otaScheduleStart': '00: 00',
            'otaScheduleEnd': '00: 00'
        },
        'capabilities': {
            'canSend': [

            ],
            'canReceive': [
                'customName',
                'fanMode',
                'fanModeSequence',
                'motorState',
                'childLock',
                'statusLight'
            ]
        },
        'room': {
            'id': 'd89b082e-e2c8-4898-81b6-e952b0e5ab7d',
            'name': 'DiningRoom',
            'color': 'ikea_yellow_no_24',
            'icon': 'rooms_arm_chair'
        },
        'deviceSet': [

        ],
        'remoteLinks': [

        ],
        'isHidden': False
    }

The other bits on the Dirigera hub (including a VINDSTYRKA sensor and some light globes) work fine, I just get an error for the air purifier table.

Errors showing in the Home Assistant logs;

Error adding entity None for domain sensor with platform dirigera_platform
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 576, in _async_add_entities
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 725, in _async_add_entity
    device = dev_reg.async_get(self.hass).async_get_or_create(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: homeassistant.helpers.device_registry.DeviceRegistry.async_get_or_create() argument after ** must be a mapping, not SensorDeviceClass

--

Error while setting up dirigera_platform platform for fan
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 350, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/dirigera_platform/fan.py", line 48, in async_setup_entry
    hub_air_purifiers = await hass.async_add_executor_job(hub.get_air_purifiers)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dirigera/hub/hub.py", line 129, in get_air_purifiers
    return [dict_to_air_purifier(air_p, self) for air_p in airpurifiers]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dirigera/devices/air_purifier.py", line 77, in dict_to_air_purifier
    return AirPurifier(
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 341, in __init__
    raise validation_error
pydantic.error_wrappers.ValidationError: 1 validation error for AirPurifier
attributes -> fanMode
  value is not a valid enumeration member; permitted: 'low', 'medium', 'high', 'auto' (type=type_error.enum; enum_values=[<FanModeEnum.LOW: 'low'>, <FanModeEnum.MEDIUM: 'medium'>, <FanModeEnum.HIGH: 'high'>, <FanModeEnum.AUTO: 'auto'>])
sanjoyg commented 8 months ago

The issue is with the downstream library, I am going to paste the JSON to the author requesting a fix

sanjoyg commented 8 months ago

Is the JSON correct, some of the timestamps seem incorrect such as
otaScheduleStart': '00: 00',

there seems to be a space between ":" and "0"

sanjoyg commented 8 months ago

Try the new release, it should support. if it works please do close the issue

BeauGiles commented 8 months ago

Confirming STARKVIND now shows in Home Assistant with the latest update.

image