Skip to content

Commit

Permalink
Added EEPs A5-30-01 and A5-30-03
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmpp committed Apr 11, 2024
1 parent 31bb31a commit c97d9d5
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 9 deletions.
8 changes: 4 additions & 4 deletions changes.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Changes and Feature List

## Version 1.4.2 Added EEPs A5-30-01 and A5-30-03
* Added EEPs for digital input with is used in water sensor (FSM60B)
* Added EEPs (A5-30-01 preferred) for digital input which is used in water sensor (FSM60B)

## Version 1.4.1 Support for sending arbitrary messages
* Added Service for sending arbitrary EnOcean (ESP2) messages. Intended to be used in conjunction with [Home Assistant Automations](https://www.home-assistant.io/getting-started/automation/).
* 🐞 Fix for TargetTemperatureSensor (EEP: A5-10-06 and A5-10-12)
* 🐞 Fix for unknow cover positions and intermediate state + unit-tests added.
* 🐞 Fix for unknown cover positions and intermediate state + unit-tests added.
* Unit-Tests added and improved for EEP A5-04-01, A5-04-02, A5-10-06, A5-10-12, A5-13-01, and F6-10-00.
* EEP A5-04-03 added for Eltako FFT60 (temperature and humidity)
* EEP A5-06-01 added for light sensor (currently twilight and daylight are combined in one illumination sensor/entity)
Expand All @@ -20,7 +20,7 @@
* 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
## Version 1.3.8 Fixes and Smaller Improvements
* Fixed window handle F6-10-00 in binary sensor
* Added better tests for binary sensors
* Fixed covers which behaved differently after introducing recovery state feature.
Expand All @@ -36,7 +36,7 @@
* Trial to remove import warnings
Reported Issue: https://github.com/grimmpp/home-assistant-eltako/issues/61
* 🐞 Removed entity_id bug from GatewayConnectionState 🐞 => Requires removing and adding gateway again ❗
* Added state cache of device entities. When restarting HA entities like temperature sensors will show previouse state/value after restart.
* Added state cache of device entities. When restarting HA entities like temperature sensors will show previous state/value after restart.
Reported Feature: https://github.com/grimmpp/home-assistant-eltako/issues/63

## Version 1.3.6 Dependencies fixed for 1.3.5
Expand Down
2 changes: 1 addition & 1 deletion custom_components/eltako/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"iot_class": "local_push",
"issue_tracker": "https://github.com/grimmpp/home-assistant-eltako/issues",
"loggers": ["eltako"],
"requirements": ["eltako14bus==0.0.49","enocean==0.60.1", "StrEnum", "esp2-gateway-adapter==0.1"],
"requirements": ["eltako14bus==0.0.51","enocean==0.60.1", "StrEnum", "esp2-gateway-adapter==0.1"],
"version": "1.4.1"
}
4 changes: 3 additions & 1 deletion docs/service-send-message/eep-params.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Paramters for EEPs in Send Message Events
(This file was auto-generated by using [eltako14bus library](https://github.com/grimmpp/eltako14bus/blob/master/eltakobus/eep.py) in [version 0.0.49](https://pypi.org/project/eltako14bus/) from unit-test `TestSendMessageService` in file `./tests/test_send_message_service.py`).
(This file was auto-generated by using [eltako14bus library](https://github.com/grimmpp/eltako14bus/blob/master/eltakobus/eep.py) in [version 0.0.51](https://pypi.org/project/eltako14bus/) from unit-test `TestSendMessageService` in file `./tests/test_send_message_service.py`).

## Not Supported EEPs
* `A5-09-0C`
Expand All @@ -18,6 +18,8 @@
* `A5-12-02`: data_type, divisor, learn_button, measurement_channel, meter_reading
* `A5-12-03`: data_type, divisor, learn_button, measurement_channel, meter_reading
* `A5-13-01`: dawn_sensor, day_night, hemisphere, identifier, learn_button, rain_indication, sun_east, sun_south, sun_west, temperature, wind_speed
* `A5-30-01`: battery_status, contact_status, learn_button
* `A5-30-03`: digital_input_0, digital_input_1, digital_input_2, digital_input_3, learn_button, status_of_wake, temperature
* `D5-00-01`: contact, learn_button
* `F6-02-01`: energy_bow, rocker_first_action, rocker_second_action, second_action
* `F6-02-02`: energy_bow, rocker_first_action, rocker_second_action, second_action
Expand Down
60 changes: 60 additions & 0 deletions tests/test_binary_sensor_A5_30_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import unittest
from mocks import *
from unittest import mock
from homeassistant.helpers.entity import Entity
from homeassistant.const import Platform
from custom_components.eltako.binary_sensor import EltakoBinarySensor
from custom_components.eltako.config_helpers import *
from eltakobus import *
from eltakobus.eep import *

from tests.test_binary_sensor_generic import TestBinarySensor

# mock update of Home Assistant
Entity.schedule_update_ha_state = mock.Mock(return_value=None)
# EltakoBinarySensor.hass.bus.fire is mocked by class HassMock


class TestBinarySensor_A5_30_01(unittest.TestCase):

def test_digital_input(self):
bs = TestBinarySensor().create_binary_sensor(A5_30_01.eep_string)

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\00\x92\x00\x0E')
bs.value_changed(msg)

self.assertEqual(bs.is_on, True)

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\00\x92\xFF\x0E')
bs.value_changed(msg)

self.assertEqual(bs.is_on, False)


def test_inverted_digital_input(self):
bs = TestBinarySensor().create_binary_sensor(A5_30_01.eep_string)
bs.invert_signal = True

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\00\x92\x00\x0E')
bs.value_changed(msg)

self.assertEqual(bs.is_on, False)

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\00\x92\xFF\x0E')
bs.value_changed(msg)

self.assertEqual(bs.is_on, True)


def test_battery(self):
bs = TestBinarySensor().create_binary_sensor(A5_30_01.eep_string, description_key="low_battery")

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\00\x92\x00\x0E')
bs.value_changed(msg)

self.assertEqual(bs.is_on, False)

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\FF\x92\xFF\x0E')
bs.value_changed(msg)

self.assertEqual(bs.is_on, True)
79 changes: 79 additions & 0 deletions tests/test_binary_sensor_A5_30_03.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import unittest
from mocks import *
from unittest import mock
from homeassistant.helpers.entity import Entity
from homeassistant.const import Platform
from custom_components.eltako.binary_sensor import EltakoBinarySensor
from custom_components.eltako.config_helpers import *
from eltakobus import *
from eltakobus.eep import *

from tests.test_binary_sensor_generic import TestBinarySensor

# mock update of Home Assistant
Entity.schedule_update_ha_state = mock.Mock(return_value=None)
# EltakoBinarySensor.hass.bus.fire is mocked by class HassMock


class TestBinarySensor_A5_30_03(unittest.TestCase):

def test_digital_input(self):

for key in ["0", "1", "2", "3", "wake"]:
bs = TestBinarySensor().create_binary_sensor(A5_30_03.eep_string, description_key=key)

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\00\x00\x1F\x08')
bs.value_changed(msg)

self.assertEqual(bs.is_on, True)

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\00\x00\x00\x08')
bs.value_changed(msg)

self.assertEqual(bs.is_on, False)


def test_inverted_digital_input(self):

for key in ["0", "1", "2", "3", "wake"]:
bs = TestBinarySensor().create_binary_sensor(A5_30_03.eep_string, description_key=key)
bs.invert_signal = True

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\00\x00\x1F\x08')
bs.value_changed(msg)

self.assertEqual(bs.is_on, False)

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\00\x00\x00\x08')
bs.value_changed(msg)

self.assertEqual(bs.is_on, True)


def test_battery(self):
bs = TestBinarySensor().create_binary_sensor(A5_30_01.eep_string, description_key="low_battery")

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\00\x92\x00\x0E')
bs.value_changed(msg)

self.assertEqual(bs.is_on, False)

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\FF\x92\xFF\x0E')
bs.value_changed(msg)

self.assertEqual(bs.is_on, True)


def test_inverted_battery(self):
bs = TestBinarySensor().create_binary_sensor(A5_30_01.eep_string, description_key="low_battery")
bs.invert_signal = True

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\00\x92\x00\x0E')
bs.value_changed(msg)

self.assertEqual(bs.is_on, True)

msg = Regular4BSMessage(b'\00\x00\x00\x01', 0x20, b'\FF\x92\xFF\x0E')
bs.value_changed(msg)

self.assertEqual(bs.is_on, False)
4 changes: 2 additions & 2 deletions tests/test_binary_sensor_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
class TestBinarySensor(unittest.TestCase):


def create_binary_sensor(self, eep_string:str="F6-02-01", device_class = "none", invert_signal:bool=False) -> EltakoBinarySensor:
def create_binary_sensor(self, eep_string:str="F6-02-01", device_class = "none", invert_signal:bool=False, description_key:str=None) -> EltakoBinarySensor:
gateway = GatewayMock(dev_id=123)
dev_id = AddressExpression.parse("00-00-00-01")
dev_name = "device name"

dev_eep = EEP.find(eep_string)

bs = EltakoBinarySensor(Platform.BINARY_SENSOR, gateway, dev_id, dev_name, dev_eep, device_class, invert_signal)
bs = EltakoBinarySensor(Platform.BINARY_SENSOR, gateway, dev_id, dev_name, dev_eep, device_class, invert_signal, description_key)
bs.hass = HassMock()
self.assertEqual(bs._attr_is_on, None)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_sensor_A5_04_03.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

class TestSensor_A5_04_02(unittest.TestCase):

msg1 = Regular4BSMessage (address=b'\xFF\xFF\x00\x80', data=b'\x99\x02\x12\x09', status=0x00)
msg1 = Regular4BSMessage(address=b'\xFF\xFF\x00\x80', data=b'\x99\x02\x12\x09', status=0x00)

def create_temperature_sensor(self) -> EltakoTemperatureSensor:
gateway = GatewayMock()
Expand Down

0 comments on commit c97d9d5

Please sign in to comment.