diff --git a/homeassistant/components/myneomitis/select.py b/homeassistant/components/myneomitis/select.py index c2d70e70346d..6ae7b6a0c79d 100644 --- a/homeassistant/components/myneomitis/select.py +++ b/homeassistant/components/myneomitis/select.py @@ -104,12 +104,8 @@ async def async_setup_entry( def _create_entity(device: dict) -> MyNeoSelect: """Create a select entity for a device.""" if device["model"] == "EWS": - # According to the MyNeomitis API, EWS "relais" devices expose a "relayMode" - # field in their state, while "pilote" devices do not. We therefore use the - # presence of "relayMode" as an explicit heuristic to distinguish relais - # from pilote devices. If the upstream API changes this behavior, this - # detection logic must be revisited. - if "relayMode" in device.get("state", {}): + state = device.get("state") or {} + if state.get("deviceType") == 0: description = SELECT_TYPES["relais"] else: description = SELECT_TYPES["pilote"] diff --git a/tests/components/myneomitis/test_select.py b/tests/components/myneomitis/test_select.py index 8a3a9c7faf54..ce905206c4e0 100644 --- a/tests/components/myneomitis/test_select.py +++ b/tests/components/myneomitis/test_select.py @@ -14,7 +14,7 @@ RELAIS_DEVICE = { "_id": "relais1", "name": "Relais Device", "model": "EWS", - "state": {"relayMode": 1, "targetMode": 2}, + "state": {"deviceType": 0, "targetMode": 2}, "connected": True, "program": {"data": {}}, } @@ -23,7 +23,7 @@ PILOTE_DEVICE = { "_id": "pilote1", "name": "Pilote Device", "model": "EWS", - "state": {"targetMode": 1}, + "state": {"deviceType": 1, "targetMode": 1}, "connected": True, "program": {"data": {}}, }