Skip to content

Commit

Permalink
Add support for XENO analog sensors (#49)
Browse files Browse the repository at this point in the history
- Add support for analog X-ENO sensors

---------

Co-authored-by: Matthieu <[email protected]>
  • Loading branch information
ydubreuil and Aohzan authored Feb 12, 2024
1 parent e62b468 commit 0c85ba4
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 3.7.0

- Add support for analog X-ENO sensors

## 3.6.1

- Add an option to invert the value read from a binary sensor
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ You can control by setting the type of the device:
- `analogin` as sensor
- `virtualanalogin` as sensor or number
- `xdimmer` as light
- `xeno` as sensor
- `xpwm` as light
- `xpwm_rgb` as light (use 3 xpwm channels)
- `xpwm_rgbw` as light (use 4 xpwm channels)
Expand Down Expand Up @@ -116,6 +117,18 @@ ipx800v4:
name: Compteur
type: counter
id: 1
- component: sensor
device_class: humidity
name: Humidité Salle de Bains
type: xeno
id: 123
unit_of_measurement: "%"
- component: sensor
device_class: temperature
name: Température Salle de Bains
type: xeno
id: 124
unit_of_measurement: "C"
```
## List of configuration parameters
Expand Down
1 change: 1 addition & 0 deletions custom_components/ipx800v4/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
TYPE_X4VR,
TYPE_X4VR_BSO,
TYPE_XDIMMER,
TYPE_XENO,
TYPE_XPWM,
TYPE_XPWM_RGB,
TYPE_XPWM_RGBW,
Expand Down
2 changes: 2 additions & 0 deletions custom_components/ipx800v4/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
TYPE_DIGITALIN = "digitalin"
TYPE_X4VR = "x4vr"
TYPE_X4VR_BSO = "x4vr_bso"
TYPE_XENO = "xeno"
TYPE_XTHL = "xthl"
TYPE_X4FP = "x4fp"
TYPE_COUNTER = "counter"
Expand Down Expand Up @@ -62,6 +63,7 @@
TYPE_DIGITALIN,
TYPE_X4VR,
TYPE_X4VR_BSO,
TYPE_XENO,
TYPE_XTHL,
TYPE_X4FP,
TYPE_COUNTER,
Expand Down
17 changes: 17 additions & 0 deletions custom_components/ipx800v4/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
TYPE_ANALOGIN,
TYPE_COUNTER,
TYPE_VIRTUALANALOGIN,
TYPE_XENO,
TYPE_XTHL,
)

Expand Down Expand Up @@ -84,6 +85,14 @@ async def async_setup_entry(
suffix_name="Luminance",
)
)
elif device.get(CONF_TYPE) == TYPE_XENO:
entities.append(
XENOSensor(
device,
controller,
coordinator,
)
)

async_add_entities(entities, True)

Expand Down Expand Up @@ -139,3 +148,11 @@ def __init__(
def native_value(self) -> float:
"""Return the current value."""
return round(self.coordinator.data[f"THL{self._id}-{self._req_type}"], 1)

class XENOSensor(IpxEntity, SensorEntity):
"""Representation of an Enocean sensor."""

@property
def native_value(self) -> float:
"""Return the current value."""
return round(self.coordinator.data[f"ENO ANALOG{int(self._id) - 121 + 17}"], 1)

0 comments on commit 0c85ba4

Please sign in to comment.