diff --git a/changes.md b/changes.md index 9ac3b386..99d13b97 100644 --- a/changes.md +++ b/changes.md @@ -7,6 +7,10 @@ * Added additional values (battery voltage, illumination, temperature) for A5-08-01 as sensor * Occupancy Sensor of A5-08-01 added as binary sensor * Improved ESP3 adapter for USB300 support. Sending telegrams works now but actuators are not accepting commands for e.g. lights - EEP: A5-38-08 +* Teach-In buttons for lights, covers, and climate are available. +* Static 'Event Id' of switches (EEP: F6-02-01 and F6-02-02) added. +* Docs about how to use logging added. +* Updated docs about how to trigger automations with wall-mounted switches. ## Version 1.3.7 Restore Device States after HA Restart * Trial to remove import warnings diff --git a/custom_components/eltako/button.py b/custom_components/eltako/button.py index e9f4e250..51b29f3e 100644 --- a/custom_components/eltako/button.py +++ b/custom_components/eltako/button.py @@ -25,7 +25,11 @@ from . import get_gateway_from_hass, get_device_config_for_gateway EEP_WITH_TEACH_IN_BUTTONS = { - A5_10_06: b'\x40\x30\x0D\x85' + A5_10_06: b'\x40\x30\x0D\x85', # climate + A5_38_08: b'\xE0\x40\x0D\x80', # light + H5_3F_7F: b'\xFF\xF8\x0D\x80', # cover + # F6_02_01 # What button to take? + # F6_02_02 } async def async_setup_entry( @@ -55,8 +59,8 @@ async def async_setup_entry( dev_config = config_helpers.DeviceConf(entity_config) sender_config = config_helpers.get_device_conf(entity_config, CONF_SENDER) - if dev_config.eep in EEP_WITH_TEACH_IN_BUTTONS.keys(): - entities.append(TemperatureControllerTeachInButton(platform, gateway, dev_config.id, dev_config.name, dev_config.eep, sender_config.id)) + if sender_config.eep in EEP_WITH_TEACH_IN_BUTTONS.keys(): + entities.append(TeachInButton(platform, gateway, dev_config.id, dev_config.name, dev_config.eep, sender_config.id, sender_config.eep)) except Exception as e: LOGGER.warning("[%s] Could not load configuration", platform) LOGGER.critical(e, exc_info=True) @@ -69,35 +73,41 @@ async def async_setup_entry( async_add_entities(entities) +class AbstractButton(EltakoEntity, ButtonEntity): -class TemperatureControllerTeachInButton(EltakoEntity, ButtonEntity): - """Button which sends teach-in telegram for temperature controller.""" + def load_value_initially(self, latest_state:State): + pass - def __init__(self, platform: str, gateway: EnOceanGateway, dev_id: AddressExpression, dev_name: str, dev_eep: EEP, sender_id: AddressExpression): + +class TeachInButton(AbstractButton): + """Button which sends teach-in telegram.""" + + def __init__(self, platform: str, gateway: EnOceanGateway, dev_id: AddressExpression, dev_name: str, dev_eep: EEP, sender_id: AddressExpression, sender_eep: EEP): _dev_name = dev_name if _dev_name == "": - _dev_name = "temperature-controller-teach-in-button" + _dev_name = "teach-in-button" self.entity_description = ButtonEntityDescription( key="teach_in_button", name="Send teach-in telegram from "+sender_id.plain_address().hex(), - icon="mdi:button-cursor", + icon="mdi:button-pointer", device_class=ButtonDeviceClass.UPDATE, ) self.sender_id = sender_id + self.sender_eep = sender_eep super().__init__(platform, gateway, dev_id, _dev_name, dev_eep) async def async_press(self) -> None: """ Handle the button press. - Send teach-in command for A5-10-06 e.g. FUTH + Send teach-in command """ + controller_address, _ = self.sender_id - # msg = Regular4BSMessage(address=controller_address, data=b'\x40\x30\x0D\x85', outgoing=True, status=0x80) - msg = Regular4BSMessage(address=controller_address, data=EEP_WITH_TEACH_IN_BUTTONS[self.dev_eep], outgoing=True, status=0x80) + msg = Regular4BSMessage(address=controller_address, data=EEP_WITH_TEACH_IN_BUTTONS[self.sender_eep], outgoing=True, status=0x80) self.send_message(msg) -class GatewayReconnectButton(EltakoEntity, ButtonEntity): +class GatewayReconnectButton(AbstractButton): """Button for reconnecting serial bus""" def __init__(self, platform: str, gateway: EnOceanGateway): diff --git a/custom_components/eltako/eltako_integration_init.py b/custom_components/eltako/eltako_integration_init.py index ca4325fd..01fe35e5 100644 --- a/custom_components/eltako/eltako_integration_init.py +++ b/custom_components/eltako/eltako_integration_init.py @@ -119,7 +119,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b if gateway_device_type is None: LOGGER.error(f"[{LOG_PREFIX}] USB device {gateway_config[CONF_DEVICE_TYPE]} is not supported!!!") return False - general_settings[CONF_ENABLE_TEACH_IN_BUTTONS] = GatewayDeviceType.is_transceiver(gateway_device_type) + general_settings[CONF_ENABLE_TEACH_IN_BUTTONS] = True # GatewayDeviceType.is_transceiver(gateway_device_type) # should only be disabled for decentral gateways LOGGER.info(f"[{LOG_PREFIX}] Initializes Gateway Device '{gateway_description}'") gateway_name = gateway_config.get(CONF_NAME, None) # from configuration diff --git a/custom_components/eltako/sensor.py b/custom_components/eltako/sensor.py index c63119d1..8382a883 100644 --- a/custom_components/eltako/sensor.py +++ b/custom_components/eltako/sensor.py @@ -388,6 +388,8 @@ def convert_event(event): event_id = config_helpers.get_bus_event_type(gateway.dev_id, EVENT_BUTTON_PRESSED, dev_conf.id) entities.append(EventListenerInfoField(platform, gateway, dev_conf.id, dev_conf.name, dev_conf.eep, event_id, "Pushed Buttons", convert_event, "mdi:gesture-tap-button")) + + entities.append(StaticInfoField(platform, gateway, dev_conf.id, dev_conf.name, dev_conf.eep, "Event Id", event_id, "mdi:form-textbox")) except Exception as e: LOGGER.warning("[%s] Could not load configuration", Platform.BINARY_SENSOR) diff --git a/docs/logging/readme.md b/docs/logging/readme.md new file mode 100644 index 00000000..2c006e36 --- /dev/null +++ b/docs/logging/readme.md @@ -0,0 +1,32 @@ +# Logging + +This part is about how to get access to the logs of Home Assistant Eltako Integration to e.g. check +* what telegrams have been received +* what events have been sent +* if there have been any problems occurred +* to under how the automation behaves and see what have been done. + + + +## Log level +By default log level `INFO` is activated which means only important information like be displayed in the logs. This comprises e.g. error and superficial information. +If you want to get more detailed information you need to change the log level which can be done inside the Home assistant Configuration file `/config/configuration.yaml`. + + +## Change log level to get detailed information +To chang the configuration I can recommend to install and use the addon [File Editor](https://github.com/home-assistant/addons/tree/master/configurator). With File Editor you can read and edit any file in Home Assistant via your browser. + +Extend or change the following part of the confguration file: +``` +logger: + default: info # default log level of all components of Home Assistant + logs: + eltako: debug # enables detailed information for Home Assistant Eltako Integration + eltakobus.serial: info # enables detailed information of the communication library for enocean devices based on ESP2 protocol + enocean.communicators.SerialCommunicator: info # enables detailed information of the communication library for enocean devices based on ESP2 protocol +``` + +## Read logs +To get the logs nicely displayed I can recommend to install and use the addon [log-viewer](https://github.com/hassio-addons/addon-log-viewer). + +Logs can also be found in `/config/home-assistant.log` and displayed by using [File Editor](https://github.com/home-assistant/addons/tree/master/configurator). \ No newline at end of file diff --git a/docs/logging/screenshot_logging.png b/docs/logging/screenshot_logging.png new file mode 100644 index 00000000..82c93876 Binary files /dev/null and b/docs/logging/screenshot_logging.png differ diff --git a/docs/rocker_switch/image.png b/docs/rocker_switch/image.png new file mode 100644 index 00000000..e9d156e8 Binary files /dev/null and b/docs/rocker_switch/image.png differ diff --git a/docs/rocker_switch/readme.md b/docs/rocker_switch/readme.md index cce4c07d..c9392a36 100644 --- a/docs/rocker_switch/readme.md +++ b/docs/rocker_switch/readme.md @@ -5,20 +5,10 @@ This example is about how to trigger complex automations in home assistant by wa -First of all you need to register your switch in the Home assistant Configuration ``/config/configuration.yaml``. Those switches are declared as binary sensors and their eep is "F6-02-01". You can find the identifiers of your switches on a sticker at the back. +## Register switch and check incomging telegrams and events in logs -
-logger:
- default: info
- logs:
- eltako: debug
-
-To modify the Home Assistant configuration I use File Editor. After doing changes don't forget to restart Home Assistant what you can easily do in the menu of File Editor.
-
-