Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
b471ab5edc
|
|||
|
3e0a1b49ab
|
18
apps/abstraction/vendors/hottis_wifi_relay.py
vendored
18
apps/abstraction/vendors/hottis_wifi_relay.py
vendored
@@ -1,4 +1,4 @@
|
|||||||
"""Shelly vendor transformations."""
|
"""Hottis WiFi Relay vendor transformations."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Any
|
from typing import Any
|
||||||
@@ -7,28 +7,28 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def transform_relay_to_vendor(payload: dict[str, Any]) -> str:
|
def transform_relay_to_vendor(payload: dict[str, Any]) -> str:
|
||||||
"""Transform abstract relay payload to Shelly format.
|
"""Transform abstract relay payload to Hottis WiFi Relay format.
|
||||||
|
|
||||||
Shelly expects plain text 'on' or 'off' (not JSON).
|
Hottis WiFi Relay expects plain text 'on' or 'off' (not JSON).
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
- Abstract: {'power': 'on'}
|
- Abstract: {'power': 'on'}
|
||||||
- Shelly: 'on'
|
- Hottis WiFi Relay: 'ON'
|
||||||
"""
|
"""
|
||||||
power = payload.get("power", "off")
|
power = payload.get("power", "off").upper()
|
||||||
return power
|
return power
|
||||||
|
|
||||||
|
|
||||||
def transform_relay_to_abstract(payload: str) -> dict[str, Any]:
|
def transform_relay_to_abstract(payload: str) -> dict[str, Any]:
|
||||||
"""Transform Shelly relay payload to abstract format.
|
"""Transform Hottis WiFi Relay relay payload to abstract format.
|
||||||
|
|
||||||
Shelly sends plain text 'on' or 'off'.
|
Hottis WiFi Relay sends plain text 'on' or 'off'.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
- Shelly: 'on'
|
- Hottis WiFi Relay: 'ON'
|
||||||
- Abstract: {'power': 'on'}
|
- Abstract: {'power': 'on'}
|
||||||
"""
|
"""
|
||||||
return {"power": payload.strip()}
|
return {"power": payload.strip().lower()}
|
||||||
|
|
||||||
|
|
||||||
# Registry of handlers for this vendor
|
# Registry of handlers for this vendor
|
||||||
|
|||||||
@@ -61,10 +61,10 @@ rooms:
|
|||||||
title: Stehlampe Esszimmer Schrank
|
title: Stehlampe Esszimmer Schrank
|
||||||
icon: 💡
|
icon: 💡
|
||||||
rank: 82
|
rank: 82
|
||||||
# - device_id: kleine_lampe_rechts_esszimmer
|
- device_id: regallampe_esszimmer
|
||||||
# title: kleine Lampe rechts Esszimmer
|
title: Regallampe Esszimmer
|
||||||
# icon: 💡
|
icon: 💡
|
||||||
# rank: 90
|
rank: 90
|
||||||
- device_id: licht_schrank_esszimmer
|
- device_id: licht_schrank_esszimmer
|
||||||
title: Schranklicht Esszimmer
|
title: Schranklicht Esszimmer
|
||||||
icon: 💡
|
icon: 💡
|
||||||
|
|||||||
Reference in New Issue
Block a user