diff --git a/apps/api/Dockerfile b/apps/api/Dockerfile index 57addcf..467ba41 100644 --- a/apps/api/Dockerfile +++ b/apps/api/Dockerfile @@ -8,9 +8,9 @@ ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ MQTT_BROKER=172.16.2.16 \ MQTT_PORT=1883 \ - REDIS_HOST=localhost \ + REDIS_HOST=172.23.1.116 \ REDIS_PORT=6379 \ - REDIS_DB=0 \ + REDIS_DB=8 \ REDIS_CHANNEL=ui:updates # Create non-root user diff --git a/apps/api/main.py b/apps/api/main.py index 27028c2..d658004 100644 --- a/apps/api/main.py +++ b/apps/api/main.py @@ -121,7 +121,10 @@ async def get_device_layout(device_id: str): async def startup_event(): """Include routers after app is initialized to avoid circular imports.""" from apps.api.routes.groups_scenes import router as groups_scenes_router + from apps.api.routes.rooms import router as rooms_router + app.include_router(groups_scenes_router, prefix="") + app.include_router(rooms_router, prefix="") @app.get("/health") diff --git a/config/layout.yaml b/config/layout.yaml index 7bb7bb9..6170082 100644 --- a/config/layout.yaml +++ b/config/layout.yaml @@ -1,5 +1,6 @@ rooms: -- name: Schlafzimmer +- id: Schlafzimmer + name: Schlafzimmer devices: - device_id: bettlicht_patty title: Bettlicht Patty @@ -33,7 +34,8 @@ rooms: title: Temperatur & Luftfeuchte icon: 🌡️ rank: 47 -- name: Esszimmer +- id: Esszimmer + name: Esszimmer devices: - device_id: deckenlampe_esszimmer title: Deckenlampe Esszimmer @@ -79,7 +81,8 @@ rooms: title: Kontakt Straße links icon: 🪟 rank: 97 -- name: Wohnzimmer +- id: Wohnzimmer + name: Wohnzimmer devices: - device_id: lampe_naehtischchen_wohnzimmer title: Lampe Naehtischchen Wohnzimmer @@ -121,7 +124,8 @@ rooms: title: Temperatur & Luftfeuchte icon: 🌡️ rank: 138 -- name: Küche +- id: Küche + name: Küche devices: - device_id: kueche_deckenlampe title: Küche Deckenlampe @@ -163,7 +167,8 @@ rooms: title: Temperatur & Luftfeuchte icon: 🌡️ rank: 155 -- name: Arbeitszimmer Patty +- id: Arbeitszimmer Patty + name: Arbeitszimmer Patty devices: - device_id: leselampe_patty title: Leselampe Patty @@ -205,7 +210,8 @@ rooms: title: Temperatur & Luftfeuchte icon: 🌡️ rank: 189 -- name: Arbeitszimmer Wolfgang +- id: Arbeitszimmer Wolfgang + name: Arbeitszimmer Wolfgang devices: - device_id: thermostat_wolfgang title: Wolfgang @@ -223,7 +229,8 @@ rooms: title: Temperatur & Luftfeuchte icon: 🌡️ rank: 202 -- name: Flur +- id: Flur + name: Flur devices: - device_id: deckenlampe_flur_oben title: Deckenlampe Flur oben @@ -249,7 +256,8 @@ rooms: title: Temperatur & Luftfeuchte icon: 🌡️ rank: 235 -- name: Sportzimmer +- id: Sportzimmer + name: Sportzimmer devices: - device_id: sportlicht_regal title: Sportlicht Regal @@ -267,7 +275,8 @@ rooms: title: Temperatur & Luftfeuchte icon: 🌡️ rank: 265 -- name: Bad Oben +- id: Bad Oben + name: Bad Oben devices: - device_id: thermostat_bad_oben title: Thermostat Bad Oben @@ -281,7 +290,8 @@ rooms: title: Temperatur & Luftfeuchte icon: 🌡️ rank: 272 -- name: Bad Unten +- id: Bad Unten + name: Bad Unten devices: - device_id: thermostat_bad_unten title: Thermostat Bad Unten @@ -295,13 +305,15 @@ rooms: title: Temperatur & Luftfeuchte icon: 🌡️ rank: 282 -- name: Waschküche +- id: Waschküche + name: Waschküche devices: - device_id: sensor_waschkueche title: Temperatur & Luftfeuchte icon: 🌡️ rank: 290 -- name: Outdoor +- id: Outdoor + name: Outdoor devices: - device_id: licht_terasse title: Licht Terasse @@ -311,7 +323,8 @@ rooms: title: Gartenlicht vorne icon: 💡 rank: 291 -- name: Garage +- id: Garage + name: Garage devices: - device_id: power_relay_caroutlet title: Ladestrom diff --git a/packages/home_capabilities/layout.py b/packages/home_capabilities/layout.py index 49c49ac..631e67e 100644 --- a/packages/home_capabilities/layout.py +++ b/packages/home_capabilities/layout.py @@ -46,10 +46,16 @@ class Room(BaseModel): """Represents a room containing devices. Attributes: + id: Unique room identifier (used for API endpoints) name: Room name (e.g., "Wohnzimmer", "Küche") devices: List of device tiles in this room """ + id: str = Field( + ..., + description="Unique room identifier" + ) + name: str = Field( ..., description="Room name"