feat: add the watch as the device tracker entity (#1189)
Some checks failed
Tests / check-rule-format (push) Failing after 6s
Validate / validate-hassfest (push) Failing after 6s
Validate / validate-hacs (push) Failing after 14s
Validate / validate-lint (push) Failing after 6s
Validate / validate-setup (push) Failing after 8s

This commit is contained in:
Li Shuzhen
2025-07-09 14:14:27 +08:00
committed by GitHub
parent aebeaf0245
commit e09676661c
3 changed files with 176 additions and 39 deletions

View File

@ -50,18 +50,11 @@ from homeassistant.components.sensor import SensorStateClass
from homeassistant.components.event import EventDeviceClass
from homeassistant.components.binary_sensor import BinarySensorDeviceClass
from homeassistant.const import (
CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
EntityCategory,
LIGHT_LUX,
UnitOfEnergy,
UnitOfPower,
UnitOfElectricCurrent,
UnitOfElectricPotential,
UnitOfTemperature,
UnitOfPressure,
PERCENTAGE
)
from homeassistant.const import (CONCENTRATION_MICROGRAMS_PER_CUBIC_METER,
EntityCategory, LIGHT_LUX, UnitOfEnergy,
UnitOfPower, UnitOfElectricCurrent,
UnitOfElectricPotential, UnitOfTemperature,
UnitOfPressure, PERCENTAGE)
# pylint: disable=pointless-string-statement
"""SPEC_DEVICE_TRANS_MAP
@ -107,7 +100,7 @@ SPEC_DEVICE_TRANS_MAP: dict = {
'humidifier': {
'required': {
'humidifier': {
'required': {
'required': {
'properties': {
'on': {'read', 'write'}
}
@ -119,7 +112,7 @@ SPEC_DEVICE_TRANS_MAP: dict = {
},
'optional': {
'environment': {
'required': {
'required': {
'properties': {
'relative-humidity': {'read'}
}
@ -131,7 +124,7 @@ SPEC_DEVICE_TRANS_MAP: dict = {
'dehumidifier': {
'required': {
'dehumidifier': {
'required': {
'required': {
'properties': {
'on': {'read', 'write'}
}
@ -143,7 +136,7 @@ SPEC_DEVICE_TRANS_MAP: dict = {
},
'optional': {
'environment': {
'required': {
'required': {
'properties': {
'relative-humidity': {'read'}
}
@ -155,15 +148,13 @@ SPEC_DEVICE_TRANS_MAP: dict = {
'vacuum': {
'required': {
'vacuum': {
'required': {
'required': {
'actions': {'start-sweep', 'stop-sweeping'},
},
'optional': {
'properties': {'status', 'fan-level'},
'actions': {
'pause-sweeping',
'continue-sweep',
'stop-and-gocharge'
'pause-sweeping', 'continue-sweep', 'stop-and-gocharge'
}
}
}
@ -171,7 +162,7 @@ SPEC_DEVICE_TRANS_MAP: dict = {
'optional': {
'identify': {
'required': {
'actions': {'identify'}
'actions': {'identify'}
}
},
'battery': {
@ -204,10 +195,9 @@ SPEC_DEVICE_TRANS_MAP: dict = {
'required': {},
'optional': {
'properties': {
'on',
'fan-level',
'horizontal-swing',
'vertical-swing'}}
'on', 'fan-level', 'horizontal-swing', 'vertical-swing'
}
}
},
'environment': {
'required': {},
@ -235,8 +225,8 @@ SPEC_DEVICE_TRANS_MAP: dict = {
},
'optional': {
'properties': {
'target-temperature', 'mode', 'fan-level',
'temperature'}
'target-temperature', 'mode', 'fan-level', 'temperature'
}
}
}
},
@ -278,7 +268,7 @@ SPEC_DEVICE_TRANS_MAP: dict = {
'ptc-bath-heater': {
'required': {
'properties': {
'mode':{'read', 'write'}
'mode': {'read', 'write'}
}
},
'optional': {
@ -378,6 +368,31 @@ SPEC_DEVICE_TRANS_MAP: dict = {
}
},
'entity': 'television'
},
'watch': {
'required': {
'watch': {
'required': {
'properties': {
'longitude': {'read'},
'latitude': {'read'}
}
},
'optional': {
'properties': {'area-id'}
}
}
},
'optional': {
'battery': {
'required': {
'properties': {
'battery-level': {'read'}
}
}
}
},
'entity': 'device_tracker'
}
}
@ -409,9 +424,7 @@ SPEC_SERVICE_TRANS_MAP: dict = {
}
},
'optional': {
'properties': {
'mode', 'brightness', 'color', 'color-temperature'
}
'properties': {'mode', 'brightness', 'color', 'color-temperature'}
},
'entity': 'light'
},
@ -426,7 +439,8 @@ SPEC_SERVICE_TRANS_MAP: dict = {
},
'optional': {
'properties': {
'mode', 'brightness',
'mode',
'brightness',
}
},
'entity': 'light',
@ -459,16 +473,14 @@ SPEC_SERVICE_TRANS_MAP: dict = {
},
'entity': 'water_heater'
},
'curtain': {
'curtain': {
'required': {
'properties': {
'motor-control': {'write'}
}
},
'optional': {
'properties': {
'status', 'current-position', 'target-position'
}
'properties': {'status', 'current-position', 'target-position'}
},
'entity': 'cover'
},
@ -658,6 +670,4 @@ SPEC_EVENT_TRANS_MAP: dict[str, str] = {
'doorbell-ring': EventDeviceClass.DOORBELL
}
SPEC_ACTION_TRANS_MAP = {
}
SPEC_ACTION_TRANS_MAP = {}