mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Fix some missing ozw sensors (#39686)
This commit is contained in:
parent
8eed7110a1
commit
165dd351b7
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from openzwavemqtt.const import CommandClass
|
from openzwavemqtt.const import CommandClass, ValueType
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
DEVICE_CLASS_BATTERY,
|
DEVICE_CLASS_BATTERY,
|
||||||
@ -30,13 +30,18 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||||||
def async_add_sensor(value):
|
def async_add_sensor(value):
|
||||||
"""Add Z-Wave Sensor."""
|
"""Add Z-Wave Sensor."""
|
||||||
# Basic Sensor types
|
# Basic Sensor types
|
||||||
if isinstance(value.primary.value, (float, int)):
|
if value.primary.type in (
|
||||||
|
ValueType.BYTE,
|
||||||
|
ValueType.INT,
|
||||||
|
ValueType.SHORT,
|
||||||
|
ValueType.DECIMAL,
|
||||||
|
):
|
||||||
sensor = ZWaveNumericSensor(value)
|
sensor = ZWaveNumericSensor(value)
|
||||||
|
|
||||||
elif isinstance(value.primary.value, dict):
|
elif value.primary.type == ValueType.LIST:
|
||||||
sensor = ZWaveListSensor(value)
|
sensor = ZWaveListSensor(value)
|
||||||
|
|
||||||
elif isinstance(value.primary.value, str):
|
elif value.primary.type == ValueType.STRING:
|
||||||
sensor = ZWaveStringSensor(value)
|
sensor = ZWaveStringSensor(value)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user