|
|
|
|
@@ -351,6 +351,36 @@ def _transform_relay_shelly_to_abstract(payload: str) -> dict[str, Any]:
|
|
|
|
|
"""
|
|
|
|
|
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
|
|
|
|
|
# ============================================================================
|
|
|
|
|
@@ -581,6 +611,8 @@ TRANSFORM_HANDLERS: dict[tuple[str, str, str], TransformHandler] = {
|
|
|
|
|
("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_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", "hottis_pv_modbus", "to_vendor"): _transform_three_phase_powermeter_hottis_pv_modbus_to_vendor,
|
|
|
|
|
|