sensoren
This commit is contained in:
@@ -19,9 +19,11 @@ from packages.home_capabilities import (
|
||||
LIGHT_VERSION,
|
||||
THERMOSTAT_VERSION,
|
||||
CONTACT_SENSOR_VERSION,
|
||||
TEMP_HUMIDITY_SENSOR_VERSION,
|
||||
LightState,
|
||||
ThermostatState,
|
||||
ContactState
|
||||
ContactState,
|
||||
TempHumidityState
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -145,7 +147,8 @@ async def spec() -> dict[str, dict[str, str]]:
|
||||
"capabilities": {
|
||||
"light": LIGHT_VERSION,
|
||||
"thermostat": THERMOSTAT_VERSION,
|
||||
"contact": CONTACT_SENSOR_VERSION
|
||||
"contact": CONTACT_SENSOR_VERSION,
|
||||
"temp_humidity": TEMP_HUMIDITY_SENSOR_VERSION
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,6 +380,12 @@ async def set_device(device_id: str, request: SetDeviceRequest) -> dict[str, str
|
||||
status_code=status.HTTP_405_METHOD_NOT_ALLOWED,
|
||||
detail="Contact sensors are read-only devices"
|
||||
)
|
||||
elif request.type in {"temp_humidity", "temp_humidity_sensor"}:
|
||||
# Temperature & humidity sensors are read-only
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_405_METHOD_NOT_ALLOWED,
|
||||
detail="Temperature & humidity sensors are read-only devices"
|
||||
)
|
||||
else:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||
|
||||
Reference in New Issue
Block a user