Skip to content

pymystrom 2.4.0 is breaking for mystrom v1 switch #59

@gmarti

Description

@gmarti

this commit
0d62b65

introduce a regression that prevent mystrom v1 switch to work in home assistant
home-assistant/core#150264

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 749, in __async_setup_with_context
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/mystrom/init.py", line 57, in async_setup_entry
await _async_get_device_state(device, info["ip"])
File "/usr/src/homeassistant/homeassistant/components/mystrom/init.py", line 28, in _async_get_device_state
await device.get_state()
File "/usr/local/lib/python3.13/site-packages/pymystrom/switch.py", line 92, in get_state
self._device_type = response["type"]
~~~~~~~~^^^^^^^^
KeyError: 'type'

I think its because of the /info endpoint of the API that doesn't return the same values
Old:

{
"version": "2.68.10",
"mac": "-----",
"ssid": "-----",
"ip": "",
"mask": "",
"gateway": "",
"dns": "",
"static": false,
"connected": true,
"connectionStatus": {
"ntp": true,
"dns": true,
"connection": true,
"handshake": true,
"login": true
}
}

New:

{
"version": "3.82.60",
"mac": "----",
"ssid": "----",
"ip": "----",
"mask": "----",
"gw": "----",
"dns": "-----",
"static": false,
"connected": true,
"type": "WS2",
"name": "WiFi Switch v2 CH",
"connectionStatus": {
"ntp": true,
"dns": true,
"connection": true,
"handshake": true,
"login": true
}
}

There is no type in the old one !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions