Support for bluetooth devices with multiple temperature sensors.

This commit is contained in:
Fabio Manganiello 2023-02-23 01:27:31 +01:00
parent 56d693032a
commit 886b930e2f
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -58,6 +58,10 @@ class NullSensor:
# Maps property names to transformer methods (first mapper choice).
_property_to_entity: Dict[str, Callable[[Any, Dict[str, Any]], Entity]] = {
'activity heart rate': lambda value, _: HeartRateSensor(value=value),
'atmospheric pressure': lambda value, conf: PressureSensor(
value=value,
unit=conf.get('unit'),
),
'battery': lambda value, conf: Battery(
value=value,
unit=conf.get('unit', '%'),
@ -108,6 +112,34 @@ _property_to_entity: Dict[str, Callable[[Any, Dict[str, Any]], Entity]] = {
value=value,
unit=conf.get('unit', 'C'),
),
'temperature2': lambda value, conf: TemperatureSensor(
value=value,
unit=conf.get('unit', 'C'),
),
'temperature3': lambda value, conf: TemperatureSensor(
value=value,
unit=conf.get('unit', 'C'),
),
'temperature4': lambda value, conf: TemperatureSensor(
value=value,
unit=conf.get('unit', 'C'),
),
'temperature5': lambda value, conf: TemperatureSensor(
value=value,
unit=conf.get('unit', 'C'),
),
'temperature6': lambda value, conf: TemperatureSensor(
value=value,
unit=conf.get('unit', 'C'),
),
'temperature7': lambda value, conf: TemperatureSensor(
value=value,
unit=conf.get('unit', 'C'),
),
'temperature8': lambda value, conf: TemperatureSensor(
value=value,
unit=conf.get('unit', 'C'),
),
'voltage': lambda value, conf: VoltageSensor(
value=value,
unit=conf.get('unit', 'V'),