Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
a98802437c
|
|||
|
708e287016
|
|||
|
d11eab8474
|
|||
|
eccffbbd55
|
|||
|
2b963a33ef
|
|||
|
1311f7a59b
|
|||
|
a226fa9268
|
|||
|
3bd8d293a2
|
|||
|
be30ad3a3c
|
@@ -11,6 +11,7 @@ matrix:
|
||||
- abstraction
|
||||
- rules
|
||||
- static
|
||||
- homekit
|
||||
|
||||
steps:
|
||||
build-${APP}:
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
when:
|
||||
event: [tag]
|
||||
ref:
|
||||
exclude:
|
||||
- refs/tags/*-configchange
|
||||
|
||||
steps:
|
||||
create_namespace:
|
||||
|
||||
@@ -190,6 +190,7 @@ async def handle_abstract_set(
|
||||
vendor_message = json.dumps(vendor_payload)
|
||||
|
||||
logger.info(f"→ vendor SET {device_id}: {vendor_topic} ← {vendor_message}")
|
||||
logger.debug(f"MQTT message published on {vendor_topic}: {vendor_message}")
|
||||
await mqtt_client.publish(vendor_topic, vendor_message, qos=1)
|
||||
|
||||
|
||||
|
||||
@@ -375,10 +375,10 @@ def _transform_relay_shelly_to_abstract(payload: str) -> dict[str, Any]:
|
||||
return {"power": payload.strip()}
|
||||
|
||||
# ============================================================================
|
||||
# HANDLER FUNCTIONS: relay - hottis_modbus technology
|
||||
# HANDLER FUNCTIONS: relay - hottis_pv_modbus technology
|
||||
# ============================================================================
|
||||
|
||||
def _transform_relay_hottis_modbus_to_vendor(payload: dict[str, Any]) -> str:
|
||||
def _transform_relay_hottis_pv_modbus_to_vendor(payload: dict[str, Any]) -> str:
|
||||
"""Transform abstract relay payload to Hottis Modbus format.
|
||||
|
||||
Hottis Modbus expects plain text 'on' or 'off' (not JSON).
|
||||
@@ -392,26 +392,32 @@ def _transform_relay_hottis_modbus_to_vendor(payload: dict[str, Any]) -> str:
|
||||
return power
|
||||
|
||||
|
||||
def _transform_relay_hottis_modbus_to_abstract(payload: str) -> dict[str, Any]:
|
||||
"""Transform Hottis Modbus relay payload to abstract format.
|
||||
def _transform_relay_hottis_pv_modbus_to_abstract(payload: str) -> dict[str, Any]:
|
||||
def _transform_relay_hottis_pv_modbus_to_abstract(payload: str) -> dict[str, Any]:
|
||||
"""Transform Hottis Modbus relay payload to abstract format.
|
||||
|
||||
Hottis Modbus sends JSON like:
|
||||
{"status": "Ok", "timestamp": "...", "state": false, "cnt": 528}
|
||||
|
||||
We only care about the 'state' field:
|
||||
- state: true -> power: 'on'
|
||||
- state: false -> power: 'off'
|
||||
"""
|
||||
data = json.loads(payload)
|
||||
|
||||
state = data.get("state", False)
|
||||
power = "on" if bool(state) else "off"
|
||||
|
||||
Hottis Modbus sends plain text 'on' or 'off' (not JSON).
|
||||
- 'on'/'off' -> power: 'on'/'off'
|
||||
|
||||
Example:
|
||||
- Hottis Modbus: 'on'
|
||||
- Abstract: {'power': 'on'}
|
||||
"""
|
||||
return {"power": payload.strip()}
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# HANDLER FUNCTIONS: three_phase_powermeter - hottis_modbus technology
|
||||
# HANDLER FUNCTIONS: three_phase_powermeter - hottis_pv_modbus technology
|
||||
# ============================================================================
|
||||
|
||||
def _transform_three_phase_powermeter_hottis_modbus_to_vendor(payload: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Transform abstract three_phase_powermeter payload to hottis_modbus format.
|
||||
|
||||
def _transform_three_phase_powermeter_hottis_pv_modbus_to_vendor(payload: dict[str, Any]) -> dict[str, Any]:
|
||||
"""Transform abstract three_phase_powermeter payload to hottis_pv_modbus format.
|
||||
energy: float = Field(..., description="Total energy in kWh")
|
||||
total_power: float = Field(..., description="Total power in W")
|
||||
phase1_power: float = Field(..., description="Power for phase 1 in W")
|
||||
@@ -444,14 +450,14 @@ def _transform_three_phase_powermeter_hottis_modbus_to_vendor(payload: dict[str,
|
||||
return vendor_payload
|
||||
|
||||
|
||||
def _transform_three_phase_powermeter_hottis_modbus_to_abstract(payload: str) -> dict[str, Any]:
|
||||
"""Transform hottis_modbus three_phase_powermeter payload to abstract format.
|
||||
def _transform_three_phase_powermeter_hottis_pv_modbus_to_abstract(payload: str) -> dict[str, Any]:
|
||||
"""Transform hottis_pv_modbus three_phase_powermeter payload to abstract format.
|
||||
|
||||
Transformations:
|
||||
- Direct mapping of all power meter fields
|
||||
|
||||
Example:
|
||||
- hottis_modbus: {'energy': 123.45, 'total_power': 1500.0, 'phase1_power': 500.0, ...}
|
||||
- hottis_pv_modbus: {'energy': 123.45, 'total_power': 1500.0, 'phase1_power': 500.0, ...}
|
||||
- Abstract: {'energy': 123.45, 'total_power': 1500.0, 'phase1_power': 500.0, ...}
|
||||
"""
|
||||
payload = json.loads(payload)
|
||||
@@ -579,12 +585,12 @@ TRANSFORM_HANDLERS: dict[tuple[str, str, str], TransformHandler] = {
|
||||
("relay", "zigbee2mqtt", "to_abstract"): _transform_relay_zigbee2mqtt_to_abstract,
|
||||
("relay", "shelly", "to_vendor"): _transform_relay_shelly_to_vendor,
|
||||
("relay", "shelly", "to_abstract"): _transform_relay_shelly_to_abstract,
|
||||
("relay", "hottis_modbus", "to_vendor"): _transform_relay_hottis_modbus_to_vendor,
|
||||
("relay", "hottis_modbus", "to_abstract"): _transform_relay_hottis_modbus_to_abstract,
|
||||
("relay", "hottis_pv_modbus", "to_vendor"): _transform_relay_hottis_pv_modbus_to_vendor,
|
||||
("relay", "hottis_pv_modbus", "to_abstract"): _transform_relay_hottis_pv_modbus_to_abstract,
|
||||
|
||||
# Three-Phase Powermeter transformations
|
||||
("three_phase_powermeter", "hottis_modbus", "to_vendor"): _transform_three_phase_powermeter_hottis_modbus_to_vendor,
|
||||
("three_phase_powermeter", "hottis_modbus", "to_abstract"): _transform_three_phase_powermeter_hottis_modbus_to_abstract,
|
||||
("three_phase_powermeter", "hottis_pv_modbus", "to_vendor"): _transform_three_phase_powermeter_hottis_pv_modbus_to_vendor,
|
||||
("three_phase_powermeter", "hottis_pv_modbus", "to_abstract"): _transform_three_phase_powermeter_hottis_pv_modbus_to_abstract,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
services:
|
||||
homekit-bridge:
|
||||
build:
|
||||
context: ../..
|
||||
dockerfile: apps/homekit/Dockerfile
|
||||
image: gitea.hottis.de/wn/home-automation/homekit:0.5.0
|
||||
container_name: homekit-bridge
|
||||
|
||||
# Required for mDNS/Bonjour to work properly
|
||||
|
||||
@@ -730,8 +730,19 @@ devices:
|
||||
features:
|
||||
power: true
|
||||
topics:
|
||||
set: "shellies/LightKitchenSink/relay/0/command"
|
||||
state: "shellies/LightKitchenSink/relay/0"
|
||||
set: "shellies/shellyplug-s-DED4E4/relay/0/command"
|
||||
state: "shellies/shellyplug-s-DED4E4/relay/0"
|
||||
- device_id: putzlicht_kueche
|
||||
name: Putzlicht
|
||||
type: light
|
||||
cap_version: "light@1.2.0"
|
||||
technology: zigbee2mqtt
|
||||
features:
|
||||
power: true
|
||||
brightness: true
|
||||
topics:
|
||||
state: "zigbee2mqtt/0xa4c138563834406c"
|
||||
set: "zigbee2mqtt/0xa4c138563834406c/set"
|
||||
- device_id: licht_schrank_esszimmer
|
||||
name: Schrank
|
||||
type: relay
|
||||
@@ -777,12 +788,12 @@ devices:
|
||||
name: Car Outlet
|
||||
type: relay
|
||||
cap_version: "relay@1.0.0"
|
||||
technology: hottis_modbus
|
||||
technology: hottis_pv_modbus
|
||||
features:
|
||||
power: true
|
||||
topics:
|
||||
set: "caroutlet/cmd"
|
||||
state: "caroutlet/state"
|
||||
set: "IoT/Car/Control"
|
||||
state: "IoT/Car/Control/State"
|
||||
|
||||
- device_id: powermeter_caroutlet
|
||||
name: Car Outlet
|
||||
|
||||
@@ -123,6 +123,10 @@ rooms:
|
||||
title: Küche Spüle
|
||||
icon: 💡
|
||||
rank: 142
|
||||
- device_id: putzlicht_kueche
|
||||
title: Küche Putzlicht
|
||||
icon: 💡
|
||||
rank: 143
|
||||
- device_id: thermostat_kueche
|
||||
title: Kueche
|
||||
icon: 🌡️
|
||||
|
||||
Reference in New Issue
Block a user