From a65d3868cb55a59c18e02c1850cdb69cf74208d4 Mon Sep 17 00:00:00 2001 From: Fredrik Tuomas Date: Thu, 20 May 2021 15:39:34 +0200 Subject: [PATCH] Add support for EDS0066 (#50035) * Add support for EDS0066 * Added a test * Corrected entity_ids * Added missing part of sensor entity id * Add type hint * Update tests/components/onewire/const.py Co-authored-by: jan iversen * Update tests/components/onewire/const.py Co-authored-by: jan iversen * Revert "Update tests/components/onewire/const.py" This reverts commit 4a01b89868bb692bb2911ca5b9f9939611a5ff2f. * Revert "Update tests/components/onewire/const.py" This reverts commit 151eb9c0d3303b6bd3b3dc49a1eccd7c1a1b31b8. Co-authored-by: jan iversen --- homeassistant/components/onewire/sensor.py | 12 +++++++++ tests/components/onewire/const.py | 30 ++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/homeassistant/components/onewire/sensor.py b/homeassistant/components/onewire/sensor.py index ba202ff24f2..3b63f551f98 100644 --- a/homeassistant/components/onewire/sensor.py +++ b/homeassistant/components/onewire/sensor.py @@ -196,6 +196,18 @@ HOBBYBOARD_EF: dict[str, list[DeviceComponentDescription]] = { # 7E sensors are special sensors by Embedded Data Systems EDS_SENSORS: dict[str, list[DeviceComponentDescription]] = { + "EDS0066": [ + { + "path": "EDS0066/temperature", + "name": "Temperature", + "type": SENSOR_TYPE_TEMPERATURE, + }, + { + "path": "EDS0066/pressure", + "name": "Pressure", + "type": SENSOR_TYPE_PRESSURE, + }, + ], "EDS0068": [ { "path": "EDS0068/temperature", diff --git a/tests/components/onewire/const.py b/tests/components/onewire/const.py index a58528ab55f..57d54e0dcc3 100644 --- a/tests/components/onewire/const.py +++ b/tests/components/onewire/const.py @@ -775,6 +775,36 @@ MOCK_OWPROXY_DEVICES = { }, ], }, + "7E.222222222222": { + "inject_reads": [ + b"EDS", # read type + b"EDS0066", # read device_type - note EDS specific + ], + "device_info": { + "identifiers": {(DOMAIN, "7E.222222222222")}, + "manufacturer": "Maxim Integrated", + "model": "EDS", + "name": "7E.222222222222", + }, + SENSOR_DOMAIN: [ + { + "entity_id": "sensor.7e_222222222222_temperature", + "unique_id": "/7E.222222222222/EDS0066/temperature", + "injected_value": b" 13.9375", + "result": "13.9", + "unit": TEMP_CELSIUS, + "class": DEVICE_CLASS_TEMPERATURE, + }, + { + "entity_id": "sensor.7e_222222222222_pressure", + "unique_id": "/7E.222222222222/EDS0066/pressure", + "injected_value": b" 1012.21", + "result": "1012.2", + "unit": PRESSURE_MBAR, + "class": DEVICE_CLASS_PRESSURE, + }, + ], + }, } MOCK_SYSBUS_DEVICES = {