Compare commits

...

10 Commits

Author SHA1 Message Date
ffb35928b4 more lights 3
All checks were successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
2025-12-07 22:12:23 +01:00
ac84ff7103 more lights 2
All checks were successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
2025-12-07 21:49:34 +01:00
c185494da3 more lights
All checks were successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
2025-12-07 21:44:57 +01:00
ec4a37a268 tasmoto and kommode
All checks were successful
ci/woodpecker/tag/build/5 Pipeline was successful
ci/woodpecker/tag/build/4 Pipeline was successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/build/6 Pipeline was successful
ci/woodpecker/tag/build/1 Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
ci/woodpecker/tag/build/2 Pipeline was successful
ci/woodpecker/tag/build/3 Pipeline was successful
ci/woodpecker/tag/deploy/4 Pipeline was successful
ci/woodpecker/tag/deploy/1 Pipeline was successful
ci/woodpecker/tag/deploy/3 Pipeline was successful
ci/woodpecker/tag/deploy/2 Pipeline was successful
ci/woodpecker/tag/deploy/5 Pipeline was successful
ci/woodpecker/tag/ingress Pipeline was successful
2025-12-07 21:32:36 +01:00
d4b1d27b81 accessory name in logging
All checks were successful
ci/woodpecker/tag/build/5 Pipeline was successful
ci/woodpecker/tag/build/6 Pipeline was successful
ci/woodpecker/tag/build/4 Pipeline was successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/build/1 Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
ci/woodpecker/tag/build/3 Pipeline was successful
ci/woodpecker/tag/build/2 Pipeline was successful
ci/woodpecker/tag/deploy/2 Pipeline was successful
ci/woodpecker/tag/deploy/1 Pipeline was successful
ci/woodpecker/tag/deploy/5 Pipeline was successful
ci/woodpecker/tag/deploy/4 Pipeline was successful
ci/woodpecker/tag/deploy/3 Pipeline was successful
ci/woodpecker/tag/ingress Pipeline was successful
2025-12-07 21:19:41 +01:00
ad07bc79e2 kugellampe patty
All checks were successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
2025-12-07 19:14:32 +01:00
ab41e79cb2 car outlet adjusted 8
All checks were successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
2025-12-05 15:53:06 +01:00
fe92d336b1 car outlet adjusted 7
All checks were successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
2025-12-05 15:47:54 +01:00
0ca59896ad car outlet adjusted 6
All checks were successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
2025-12-05 15:46:25 +01:00
7858996d0f car outlet adjusted 5
All checks were successful
ci/woodpecker/tag/build/5 Pipeline was successful
ci/woodpecker/tag/build/4 Pipeline was successful
ci/woodpecker/tag/build/6 Pipeline was successful
ci/woodpecker/tag/namespace Pipeline was successful
ci/woodpecker/tag/config Pipeline was successful
ci/woodpecker/tag/build/2 Pipeline was successful
ci/woodpecker/tag/build/1 Pipeline was successful
ci/woodpecker/tag/build/3 Pipeline was successful
ci/woodpecker/tag/deploy/5 Pipeline was successful
ci/woodpecker/tag/deploy/3 Pipeline was successful
ci/woodpecker/tag/deploy/4 Pipeline was successful
ci/woodpecker/tag/deploy/2 Pipeline was successful
ci/woodpecker/tag/deploy/1 Pipeline was successful
ci/woodpecker/tag/ingress Pipeline was successful
2025-12-05 15:42:41 +01:00
4 changed files with 157 additions and 47 deletions

View File

@@ -351,6 +351,36 @@ def _transform_relay_shelly_to_abstract(payload: str) -> dict[str, Any]:
""" """
return {"power": payload.strip()} return {"power": payload.strip()}
# ============================================================================
# HANDLER FUNCTIONS: relay - tasmota technology
# ============================================================================
def _transform_relay_tasmota_to_vendor(payload: dict[str, Any]) -> str:
"""Transform abstract relay payload to Tasmota format.
Tasmota expects plain text 'on' or 'off' (not JSON).
- power: 'on'/'off' -> 'on'/'off' (plain string)
Example:
- Abstract: {'power': 'on'}
- Tasmota: 'on'
"""
power = payload.get("power", "off")
return power
def _transform_relay_tasmota_to_abstract(payload: str) -> dict[str, Any]:
"""Transform Tasmota relay payload to abstract format.
Tasmota sends plain text 'on' or 'off' (not JSON).
- 'on'/'off' -> power: 'on'/'off'
Example:
- Tasmota: 'ON'
- Abstract: {'power': 'on'}
"""
return {"power": payload.strip().lower()}
# ============================================================================ # ============================================================================
# HANDLER FUNCTIONS: relay - hottis_pv_modbus technology # HANDLER FUNCTIONS: relay - hottis_pv_modbus technology
# ============================================================================ # ============================================================================
@@ -431,27 +461,48 @@ def _transform_three_phase_powermeter_hottis_pv_modbus_to_abstract(payload: str)
"""Transform hottis_pv_modbus three_phase_powermeter payload to abstract format. """Transform hottis_pv_modbus three_phase_powermeter payload to abstract format.
Transformations: Transformations:
- Direct mapping of all power meter fields - Map vendor field names to abstract field names
- totalImportEnergy -> energy
Example: - powerL1/powerL2/powerL3 -> phase1_power/phase2_power/phase3_power
- hottis_pv_modbus: {'energy': 123.45, 'total_power': 1500.0, 'phase1_power': 500.0, ...} - voltageL1/voltageL2/voltageL3 -> phase1_voltage/phase2_voltage/phase3_voltage
- Abstract: {'energy': 123.45, 'total_power': 1500.0, 'phase1_power': 500.0, ...} - currentL1/currentL2/currentL3 -> phase1_current/phase2_current/phase3_current
- Sum of powerL1..3 -> total_power
""" """
payload = json.loads(payload) data = json.loads(payload)
# Helper to read numeric values uniformly as float
def _get_float(key: str, default: float = 0.0) -> float:
return float(data.get(key, default))
# Read all numeric values via helper for consistent error handling
phase1_power = _get_float("powerL1")
phase2_power = _get_float("powerL2")
phase3_power = _get_float("powerL3")
phase1_voltage = _get_float("voltageL1")
phase2_voltage = _get_float("voltageL2")
phase3_voltage = _get_float("voltageL3")
phase1_current = _get_float("currentL1")
phase2_current = _get_float("currentL2")
phase3_current = _get_float("currentL3")
energy = _get_float("totalImportEnergy")
abstract_payload = { abstract_payload = {
"energy": payload.get("energy", 0.0), "energy": energy,
"total_power": payload.get("total_power", 0.0), "total_power": phase1_power + phase2_power + phase3_power,
"phase1_power": payload.get("phase1_power", 0.0), "phase1_power": phase1_power,
"phase2_power": payload.get("phase2_power", 0.0), "phase2_power": phase2_power,
"phase3_power": payload.get("phase3_power", 0.0), "phase3_power": phase3_power,
"phase1_voltage": payload.get("phase1_voltage", 0.0), "phase1_voltage": phase1_voltage,
"phase2_voltage": payload.get("phase2_voltage", 0.0), "phase2_voltage": phase2_voltage,
"phase3_voltage": payload.get("phase3_voltage", 0.0), "phase3_voltage": phase3_voltage,
"phase1_current": payload.get("phase1_current", 0.0), "phase1_current": phase1_current,
"phase2_current": payload.get("phase2_current", 0.0), "phase2_current": phase2_current,
"phase3_current": payload.get("phase3_current", 0.0), "phase3_current": phase3_current,
} }
return abstract_payload return abstract_payload
@@ -560,6 +611,8 @@ TRANSFORM_HANDLERS: dict[tuple[str, str, str], TransformHandler] = {
("relay", "shelly", "to_abstract"): _transform_relay_shelly_to_abstract, ("relay", "shelly", "to_abstract"): _transform_relay_shelly_to_abstract,
("relay", "hottis_pv_modbus", "to_vendor"): _transform_relay_hottis_pv_modbus_to_vendor, ("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, ("relay", "hottis_pv_modbus", "to_abstract"): _transform_relay_hottis_pv_modbus_to_abstract,
("relay", "tasmota", "to_vendor"): _transform_relay_tasmota_to_vendor,
("relay", "tasmota", "to_abstract"): _transform_relay_tasmota_to_abstract,
# Three-Phase Powermeter transformations # Three-Phase Powermeter transformations
("three_phase_powermeter", "hottis_pv_modbus", "to_vendor"): _transform_three_phase_powermeter_hottis_pv_modbus_to_vendor, ("three_phase_powermeter", "hottis_pv_modbus", "to_vendor"): _transform_three_phase_powermeter_hottis_pv_modbus_to_vendor,

View File

@@ -78,7 +78,7 @@ def build_bridge(driver: AccessoryDriver, api_client: ApiClient) -> Bridge:
bridge.add_accessory(accessory) bridge.add_accessory(accessory)
accessory_map[device.device_id] = accessory accessory_map[device.device_id] = accessory
logger.info(f"Added accessory: {device.friendly_name} ({device.type}) in room: {device.room or 'Unknown'}") logger.info(f"Added accessory: {device.friendly_name} ({device.type}, {accessory.__class__.__name__}) in room: {device.room or 'Unknown'}")
else: else:
logger.warning(f"No accessory mapping for device: {device.name} ({device.type})") logger.warning(f"No accessory mapping for device: {device.name} ({device.type})")
except Exception as e: except Exception as e:

View File

@@ -241,22 +241,6 @@ devices:
ieee_address: "0x0017880108a03e45" ieee_address: "0x0017880108a03e45"
model: "929002241201" model: "929002241201"
vendor: "Philips" vendor: "Philips"
- device_id: haustuer
name: Haustür-Lampe
type: light
cap_version: "light@1.2.0"
technology: zigbee2mqtt
features:
power: true
brightness: true
topics:
state: "zigbee2mqtt/0xec1bbdfffea6a3da"
set: "zigbee2mqtt/0xec1bbdfffea6a3da/set"
metadata:
friendly_name: "Haustür"
ieee_address: "0xec1bbdfffea6a3da"
model: "LED1842G3"
vendor: "IKEA"
- device_id: deckenlampe_flur_oben - device_id: deckenlampe_flur_oben
name: Deckenlampe oben name: Deckenlampe oben
type: light type: light
@@ -783,6 +767,67 @@ devices:
topics: topics:
set: "shellies/lichtterasse/relay/0/command" set: "shellies/lichtterasse/relay/0/command"
state: "shellies/lichtterasse/relay/0" state: "shellies/lichtterasse/relay/0"
- device_id: kugellampe_patty
name: Kugellampe Patty
type: light
cap_version: "light@1.2.0"
technology: zigbee2mqtt
features:
power: true
brightness: true
topics:
state: "zigbee2mqtt/0xbc33acfffe21f547"
set: "zigbee2mqtt/0xbc33acfffe21f547/set"
- device_id: licht_kommode_schlafzimmer
name: Kommode Schlafzimmer
type: relay
cap_version: "relay@1.0.0"
technology: tasmota
features:
power: true
topics:
set: "cmnd/tasmota/04/POWER"
state: "stat/tasmota/04/POWER"
- device_id: licht_fensterbank_esszimmer
name: Fensterbank Esszimmer
type: relay
cap_version: "relay@1.0.0"
technology: tasmota
features:
power: true
topics:
set: "cmnd/tasmota/02/POWER"
state: "stat/tasmota/02/POWER"
- device_id: licht_schreibtisch_patty
name: Schreibtisch Patty
type: relay
cap_version: "relay@1.0.0"
technology: tasmota
features:
power: true
topics:
set: "cmnd/tasmota/03/POWER"
state: "stat/tasmota/03/POWER"
- device_id: kugeln_regal_flur
name: Kugeln Regal Flur
type: relay
cap_version: "relay@1.0.0"
technology: tasmota
features:
power: true
topics:
set: "cmnd/tasmota/01/POWER"
state: "stat/tasmota/01/POWER"
- device_id: schrank_flur_haustür
name: Schrank Flur Haustür
type: relay
cap_version: "relay@1.0.0"
technology: tasmota
features:
power: true
topics:
set: "cmnd/tasmota/05/POWER"
state: "stat/tasmota/05/POWER"
- device_id: power_relay_caroutlet - device_id: power_relay_caroutlet
name: Car Outlet name: Car Outlet
@@ -799,8 +844,8 @@ devices:
name: Car Outlet name: Car Outlet
type: three_phase_powermeter type: three_phase_powermeter
cap_version: "three_phase_powermeter@1.0.0" cap_version: "three_phase_powermeter@1.0.0"
technology: hottis_modbus technology: hottis_pv_modbus
topics: topics:
state: "caroutlet/powermeter" state: "IoT/Car/Values"

View File

@@ -17,6 +17,10 @@ rooms:
title: Medusa-Lampe Schlafzimmer title: Medusa-Lampe Schlafzimmer
icon: 💡 icon: 💡
rank: 40 rank: 40
- device_id: licht_kommode_schlafzimmer
title: Kommode Schlafzimmer
icon: 💡
rank: 42
- device_id: thermostat_schlafzimmer - device_id: thermostat_schlafzimmer
title: Thermostat Schlafzimmer title: Thermostat Schlafzimmer
icon: 🌡️ icon: 🌡️
@@ -39,10 +43,10 @@ rooms:
title: Leselampe Esszimmer title: Leselampe Esszimmer
icon: 💡 icon: 💡
rank: 60 rank: 60
# - device_id: standlampe_esszimmer - device_id: licht_fensterbank_esszimmer
# title: Standlampe Esszimmer title: Fensterbank Esszimmer
# icon: 💡 icon: 💡
# rank: 70 rank: 70
- device_id: kleine_lampe_links_esszimmer - device_id: kleine_lampe_links_esszimmer
title: kleine Lampe links Esszimmer title: kleine Lampe links Esszimmer
icon: 💡 icon: 💡
@@ -165,6 +169,14 @@ rooms:
title: Schranklicht vorne Patty title: Schranklicht vorne Patty
icon: 💡 icon: 💡
rank: 180 rank: 180
- device_id: kugellampe_patty
title: Kugellampe Patty
icon: 💡
rank: 181
- device_id: licht_schreibtisch_patty
title: Licht Schreibtisch Patty
icon: 💡
rank: 182
- device_id: thermostat_patty - device_id: thermostat_patty
title: Thermostat Patty title: Thermostat Patty
icon: 🌡️ icon: 🌡️
@@ -209,18 +221,18 @@ rooms:
title: Deckenlampe Flur oben title: Deckenlampe Flur oben
icon: 💡 icon: 💡
rank: 210 rank: 210
- device_id: haustuer - device_id: kugeln_regal_flur
title: Haustür title: Kugeln Regal Flur
icon: 💡
rank: 220
- device_id: licht_flur_schrank
title: Schranklicht Flur
icon: 💡 icon: 💡
rank: 222 rank: 222
- device_id: licht_flur_oben_am_spiegel - device_id: licht_flur_oben_am_spiegel
title: Licht Flur oben am Spiegel title: Licht Flur oben am Spiegel
icon: 💡 icon: 💡
rank: 230 rank: 230
- device_id: schrank_flur_haustür
title: Schrank Flur Haustür
icon: 💡
rank: 231
- device_id: sensor_flur - device_id: sensor_flur
title: Temperatur & Luftfeuchte title: Temperatur & Luftfeuchte
icon: 🌡️ icon: 🌡️