Skip to content

Commit

Permalink
Merge pull request #83 from grimmpp/feature-branch
Browse files Browse the repository at this point in the history
USB300 support
  • Loading branch information
grimmpp authored Mar 20, 2024
2 parents 4590b8c + 664e4eb commit 72b29ac
Show file tree
Hide file tree
Showing 26 changed files with 247 additions and 447 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,32 @@ Elatko devices are exemplarily mentioned. You can find [here](https://www.eltako
* A5-12-03 (Automated meter reading - water, F3Z14D)
* A5-13-01 (Weather station, FWG14)
* F6-10-00 (Window handle, FTS14EM)
* Light
* A5-38-08 (Central command - gateway, FUD14)
* M5-38-08 (Eltako relay, FSR14)
* [Light](https://github.com/grimmpp/home-assistant-eltako/tree/main/docs/lights-tutorial/readme.md)
* A5-38-08 (Dimmable Light: Central command - gateway, FUD14)
* M5-38-08 (Switchable Light: Eltako relay, FSR14)
* Switch
* M5-38-08 (Eltako relay, FSR14)
* F6-02-01 and F6-02-02
* Cover
* G5-3F-7F (Eltako cover, FSB14)

**Supported sender EEPs**
* Light
* [Light](https://github.com/grimmpp/home-assistant-eltako/tree/main/docs/lights-tutorial/readme.md)
* A5-38-08 (Central command - gateway, FUD14) PREFERRED!!!
* F6-02-01 and F6-02-02 (Rocker switch - function 02 'direct pushbutton top on' default left) / (only as switch not for dimmable lights.)
* [Switch](https://github.com/grimmpp/home-assistant-eltako/tree/main/docs/rocker_switch/readme.md)
* Switch
* A5-38-08 (Central command) PREFERRED!!!
* F6-02-01 and F6-02-02 (Rocker switch - function 02 'direct pushbutton top on' default left)
* Cover
* H5-3F-7F (Eltako cover, FSB14)
* [Climate](https://github.com/grimmpp/home-assistant-eltako/tree/main/docs/heating-and-cooling/readme.md) (**Experimental** Feedback is welcome.)
* A5-10-06 (Eltako FAE14, FHK14, F4HK14, F2L14, FHK61, FME14)
* [Teach-In Buttons](https://github.com/grimmpp/home-assistant-eltako/tree/main/docs/docs/teach_in_buttons/readme.md)

[**Gateway**](https://github.com/grimmpp/home-assistant-eltako/tree/main/docs/gateways/readme.md) (See also [how to use gateways](https://github.com/grimmpp/home-assistant-eltako/tree/main/docs/gateway_usage/readme.md) and [multiple gateway support](https://github.com/grimmpp/home-assistant-eltako/tree/main/docs/multiple-gateway-support/readme.md))
* **Eltako FAM14** and Eltako **FGW14-USB** (based on ESP2, rs485 bus and baud rate 57600, uses library [eltako14bus](https://github.com/grimmpp/eltako14bus))
* **Eltako FAM-USB** (based on ESP2, baud rate 9600, uses library [eltako14bus](https://github.com/grimmpp/eltako14bus))
* **EnOcean USB300** (**experimental**) (based on ESP3 and baud rate 57600, uses library [Python EnOcean](https://github.com/kipe/enocean))
* ESP3 is not yet fully supported.
* **EnOcean USB300** (based on ESP3 but only ESP2 feature set supported, baud rate 57600, uses library [Python EnOcean](https://github.com/kipe/enocean) and [esp2_gateway_adapter](https://github.com/grimmpp/esp2_gateway_adapter))


# Installation and Configuration
Expand Down Expand Up @@ -130,6 +131,7 @@ python -m unittest discover tests -v
* [Home Assistant Community Store](https://hacs.xyz/) is needed to be able to install this repository. It allows you to install custom_components.
* [Eltako14Bus Python Library](https://github.com/grimmpp/eltako14bus) is used by Home Assistant Eltako Integration for serial communication for device Eltako FAM14 and FGW14-USB.
* [Python EnOcean](https://github.com/kipe/enocean) is used by Home Assistant Eltako Integration for serial communication for device USB300.
* [esp2_gateway_adapter](https://github.com/grimmpp/esp2_gateway_adapter) is an adapter so that ESP3 can be made compatible to the rest of the integration which works on ESP2.


# Useful Home Assistant Addons
Expand Down
6 changes: 5 additions & 1 deletion changes.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changes and Feature List

## Version 1.3.9
## Version 1.4.0 ESP3 Support (USB300)
* Docs about gateway usage added.
* Added EEPs F6-02-01 and F6-02-02 as sender EEP for lights so that regular switch commands can be sent from Home Assistant.
* ⚠ Change default behavior of switches and lights to 'direct pushbutton top on' and 'left rocker' for sender EEP F6-02-01/-02
* Logging prettified.
* Added library for ESP3 (USB300 Support) => [esp2_gateway_adapter](https://github.com/grimmpp/esp2_gateway_adapter)
* Better support for Teach-In Button

## Version 1.3.8 Fixes and Smaller Imrovements
* Fixed window handle F6-10-00 in binary sensor
Expand Down
16 changes: 8 additions & 8 deletions custom_components/eltako/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ async def async_setup_entry(
dev_conf.get(CONF_DEVICE_CLASS), dev_conf.get(CONF_INVERT_SIGNAL)))

except Exception as e:
LOGGER.warning("[%s] Could not load configuration", platform)
LOGGER.critical(e, exc_info=True)
LOGGER.warning("[%s] Could not load configuration for platform_id %s", platform, platform_id)
LOGGER.critical(e, exc_info=True)

# is connection active sensor for gateway (serial connection)
entities.append(GatewayConnectionState(platform, gateway))
Expand Down Expand Up @@ -74,7 +74,7 @@ def load_value_initially(self, latest_state:State):

self.schedule_update_ha_state()

LOGGER.debug(f"[binary_sensor {self.dev_id}] value initially loaded: [is_on: {self.is_on}, state: {self.state}]")
LOGGER.debug(f"[{Platform.BINARY_SENSOR} {self.dev_id}] value initially loaded: [is_on: {self.is_on}, state: {self.state}]")

class EltakoBinarySensor(AbstractBinarySensor):
"""Representation of Eltako binary sensors such as wall switches.
Expand Down Expand Up @@ -120,8 +120,8 @@ def value_changed(self, msg: ESP2Message):
LOGGER.debug("decoded : %s", json.dumps(decoded.__dict__))
# LOGGER.debug("msg : %s, data: %s", type(msg), msg.data)
except Exception as e:
LOGGER.warning("[Binary Sensor][%s] Could not decode message for eep %s does not fit to message type %s (org %s)",
b2s(self.dev_id[0]), self.dev_eep.eep_string, type(msg).__name__, str(msg.org) )
LOGGER.warning("[%s %s] Could not decode message for eep %s does not fit to message type %s (org %s)",
Platform.BINARY_SENSOR, str(self.dev_id), self.dev_eep.eep_string, type(msg).__name__, str(msg.org) )
return

if self.dev_eep in [F6_02_01, F6_02_02]:
Expand Down Expand Up @@ -171,7 +171,7 @@ def value_changed(self, msg: ESP2Message):
"rocker_second_action": decoded.rocker_second_action,
}

LOGGER.debug("[Binary Sensor] Send event: %s, pressed_buttons: '%s'", event_id, json.dumps(pressed_buttons))
LOGGER.debug("[%s %s] Send event: %s, pressed_buttons: '%s'", Platform.BINARY_SENSOR, str(self.dev_id), event_id, json.dumps(pressed_buttons))
self.hass.bus.fire(event_id, event_data)

# fire second event for a specific buttons pushed on the swtich
Expand All @@ -186,7 +186,7 @@ def value_changed(self, msg: ESP2Message):
"rocker_first_action": decoded.rocker_first_action,
"rocker_second_action": decoded.rocker_second_action,
}
LOGGER.debug("[Binary Sensor] Send event: %s, pressed_buttons: '%s'", event_id, json.dumps(pressed_buttons))
LOGGER.debug("[%s %s] Send event: %s, pressed_buttons: '%s'", Platform.BINARY_SENSOR, str(self.dev_id), event_id, json.dumps(pressed_buttons))
self.hass.bus.fire(event_id, event_data)

# Show status change in HA. It will only for the moment when the button is pushed down.
Expand Down Expand Up @@ -238,7 +238,7 @@ def value_changed(self, msg: ESP2Message):
self._attr_is_on = not self._attr_is_on

else:
LOGGER.warn("[Binary Sensor][] eep %s not found for data processing.", b2s(self.dev_id[0]), self.dev_eep.eep_string)
LOGGER.warn("[%s %s] EEP %s not found for data processing.", Platform.BINARY_SENSOR, str(self.dev_id), self.dev_eep.eep_string)
return

self.schedule_update_ha_state()
Expand Down
2 changes: 1 addition & 1 deletion custom_components/eltako/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(self, platform: str, gateway: EnOceanGateway, dev_id: AddressExpres
_dev_name = "teach-in-button"
self.entity_description = ButtonEntityDescription(
key="teach_in_button",
name="Send teach-in telegram from "+sender_id.plain_address().hex(),
name="Teach-In Button",
icon="mdi:button-pointer",
device_class=ButtonDeviceClass.UPDATE,
)
Expand Down
12 changes: 12 additions & 0 deletions custom_components/eltako/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ def open_cover(self, **kwargs: Any) -> None:
if self._sender_eep == H5_3F_7F:
msg = H5_3F_7F(time, 0x01, 1).encode_message(address)
self.send_message(msg)

else:
LOGGER.warn("[%s %s] Sender EEP %s not supported.", Platform.COVER, str(self.dev_id), self._sender_eep.eep_string)
return

#TODO: ... setting state should be comment out
# Don't set state instead wait for response from actor so that real state of light is displayed.
Expand All @@ -151,6 +155,10 @@ def close_cover(self, **kwargs: Any) -> None:
if self._sender_eep == H5_3F_7F:
msg = H5_3F_7F(time, 0x02, 1).encode_message(address)
self.send_message(msg)

else:
LOGGER.warn("[%s %s] Sender EEP %s not supported.", Platform.COVER, str(self.dev_id), self._sender_eep.eep_string)
return

#TODO: ... setting state should be comment out
# Don't set state instead wait for response from actor so that real state of light is displayed.
Expand Down Expand Up @@ -191,6 +199,10 @@ def set_cover_position(self, **kwargs: Any) -> None:

msg = H5_3F_7F(time, command, 1).encode_message(address)
self.send_message(msg)

else:
LOGGER.warn("[%s %s] Sender EEP %s not supported.", Platform.COVER, str(self.dev_id), self._sender_eep.eep_string)
return

if self.general_settings[CONF_FAST_STATUS_CHANGE]:
if direction == "up":
Expand Down
2 changes: 1 addition & 1 deletion custom_components/eltako/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def log_entities_to_be_added(entities:list[EltakoEntity], platform:Platform) ->
temp_eep = ""
if e.dev_eep:
temp_eep = f"eep: {e.dev_eep.eep_string}),"
LOGGER.debug(f"[{platform}] Add entity {e.dev_name} (id: {e.dev_id},{temp_eep} gw: {e.gateway.dev_name}) to Home Assistant.")
LOGGER.debug(f"[{platform} {e.dev_id}] Add entity {e.dev_name} (id: {e.dev_id},{temp_eep} gw: {e.gateway.dev_name}) to Home Assistant.")

def get_entity_from_hass(hass: HomeAssistant, domain:Platform, dev_id: AddressExpression) -> bool:
entity_platforms = hass.data[DATA_ENTITY_PLATFORM][DOMAIN]
Expand Down
Loading

0 comments on commit 72b29ac

Please sign in to comment.