#!/usr/bin/env python # -*- coding: utf-8 -*- # from devices.base import base import json class brennenstuhl_heatingvalve(base): """ Communication (MQTT) brennenstuhl_heatingvalve { | "away_mode": ["ON", "OFF"] | "battery": [0...100] % | "child_lock": ["LOCK", "UNLOCK"] | "current_heating_setpoint": [5...30] °C | "linkquality": [0...255] lqi | "local_temperature": [numeric] °C | "preset": ["manual", ...] | "system_mode": ["heat", ...] | "valve_detection": ["ON", "OFF"] | "window_detection": ["ON", "OFF"] | } +- set { "away_mode": ["ON", "OFF", "TOGGLE"] "child_lock": ["LOCK", "UNLOCK"] "current_heating_setpoint": [5...30] °C "preset": ["manual", ...] "system_mode": ["heat", ...] "valve_detection": ["ON", "OFF", "TOGGLE"] "window_detection": ["ON", "OFF", "TOGGLE"] } """ KEY_LINKQUALITY = "linkquality" KEY_BATTERY = "battery" KEY_HEATING_SETPOINT = "current_heating_setpoint" KEY_TEMPERATURE = "local_temperature" # KEY_AWAY_MODE = "away_mode" KEY_CHILD_LOCK = "child_lock" KEY_PRESET = "preset" KEY_SYSTEM_MODE = "system_mode" KEY_VALVE_DETECTION = "valve_detection" KEY_WINDOW_DETECTION = "window_detection" # TX_TYPE = base.TX_DICT # RX_KEYS = [KEY_LINKQUALITY, KEY_BATTERY, KEY_HEATING_SETPOINT, KEY_TEMPERATURE] RX_IGNORE_KEYS = [KEY_AWAY_MODE, KEY_CHILD_LOCK, KEY_PRESET, KEY_SYSTEM_MODE, KEY_VALVE_DETECTION, KEY_WINDOW_DETECTION] def __init__(self, mqtt_client, topic): super().__init__(mqtt_client, topic) self.mqtt_client.send(self.topic + '/' + self.TX_TOPIC, json.dumps({self.KEY_WINDOW_DETECTION: "ON", self.KEY_CHILD_LOCK: "UNLOCK", self.KEY_VALVE_DETECTION: "ON", self.KEY_SYSTEM_MODE: "heat", self.KEY_PRESET: "manual"})) def __state_logging__(self, inst, key, data): if key in [self.KEY_HEATING_SETPOINT, self.KEY_CHILD_LOCK, self.KEY_WINDOW_DETECTION, self.KEY_VALVE_DETECTION]: self.logger.info("State change of '%s' to '%s'", key, repr(data)) # # RX # @property def linkqulity(self): return self.get(self.KEY_LINKQUALITY) @property def heating_setpoint(self): return self.get(self.KEY_HEATING_SETPOINT) @property def temperature(self): return self.get(self.KEY_TEMPERATURE) # # TX # def set_heating_setpoint(self, setpoint): self.send_command(self.KEY_HEATING_SETPOINT, setpoint) def set_heating_setpoint_mcb(self, device, key, data): self.set_heating_setpoint(data)