Skip to content

Commit

Permalink
EEP A5-06-01 and A5-04-03 added
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmpp committed Mar 27, 2024
1 parent edd28c3 commit 07316b3
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 6 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ Elatko devices are exemplarily mentioned. You can find [here](https://www.eltako
* Sensor
* A5-04-01 (Temperature and Humidity Sensor)
* A5-04-02 (Temperature and Humidity Sensor e.g.: FLGTF, FLT58, FFT60)
* A5-04-03 **Coming soon!** (Temperature and Humidity Sensor e.g.: FFT60)
* A5-04-03 (Temperature and Humidity Sensor e.g.: FFT60)
* A5-06-01 (Light - Twilight and Illumination)
* A5-07-01 (Occupancy sensor)
* A5-08-01 (Light-, Temperature-, Occupancy Sensor e.g.: FABH65S, FBH65, FBH65S, FBH65TF)
* A5-09-0C (Air Quality / VOC⁠ (Volatile Organic Compounds) e.g. [FLGTF](https://github.com/grimmpp/home-assistant-eltako/tree/main/docs/flgtf_temp_humidity_air_quality/readme.md))
Expand Down
2 changes: 2 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* 🐞 Fix for TargetTemperatureSensor (EEP: A5-10-06 and A5-10-12)
* 🐞 Fix for unknow cover positions.
* 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 humiditry)
* EEP A5-06-01 added for light sensor (currently twilight and daylight are combinded in one illumination sensor/entity)

## Version 1.4.0 ESP3 Support (USB300)
* Docs about gateway usage added.
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.47","enocean==0.60.1", "StrEnum", "esp2-gateway-adapter==0.1"],
"requirements": ["eltako14bus==0.0.48","enocean==0.60.1", "StrEnum", "esp2-gateway-adapter==0.1"],
"version": "1.3.9"
}
2 changes: 2 additions & 0 deletions custom_components/eltako/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ class SensorSchema(EltakoPlatformSchema):

CONF_EEP_SUPPORTED = [A5_04_01.eep_string,
A5_04_02.eep_string,
A5_04_03.eep_string,
A5_06_01.eep_string,
A5_07_01.eep_string,
A5_08_01.eep_string,
A5_09_0C.eep_string,
Expand Down
7 changes: 6 additions & 1 deletion custom_components/eltako/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ async def async_setup_entry(
entities.append(EltakoMeterSensor(platform, gateway, dev_conf.id, dev_name, dev_conf.eep, SENSOR_DESC_WATER_CUMULATIVE, tariff=(tariff - 1)))
entities.append(EltakoMeterSensor(platform, gateway, dev_conf.id, dev_name, dev_conf.eep, SENSOR_DESC_WATER_CURRENT, tariff=(tariff - 1)))

elif dev_conf.eep in [A5_04_02, A5_10_12, A5_04_01]:
elif dev_conf.eep in [A5_04_01, A5_04_02, A5_04_03, A5_10_12]:

entities.append(EltakoTemperatureSensor(platform, gateway, dev_conf.id, dev_name, dev_conf.eep))
entities.append(EltakoHumiditySensor(platform, gateway, dev_conf.id, dev_name, dev_conf.eep))
Expand All @@ -371,6 +371,11 @@ async def async_setup_entry(
entities.append(EltakoBatteryVoltageSensor(platform, gateway, dev_conf.id, dev_name, dev_conf.eep))
# _pir_status => as binary sensor

elif dev_conf.eep in [A5_06_01]:
entities.append(EltakoIlluminationSensor(platform, gateway, dev_conf.id, dev_name, dev_conf.eep))
#TODO: add twilight
#TODO: add daylight
# both are currently combined in illumination

except Exception as e:
LOGGER.warning("[%s] Could not load configuration", platform)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_sensor_A5_04_02.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'\xaa\x00\x00\x0d', status=0x00)
msg1 = Regular4BSMessage (address=b'\xFF\xFF\x00\x80', data=b'\x00\x7C\x86\x0F', status=0x00)

def create_temperature_sensor(self) -> EltakoTemperatureSensor:
gateway = GatewayMock()
Expand All @@ -37,10 +37,10 @@ def test_temperature_sensor_A5_04_02(self):
s_temp = self.create_temperature_sensor()

s_temp.value_changed(self.msg1)
self.assertEqual(s_temp.native_value, -20.0)
self.assertEqual(s_temp.native_value, 22.880000000000003)

def test_humidity_sensor_A5_04_02(self):
s_hum = self.create_humidity_sensor()

s_hum.value_changed(self.msg1)
self.assertEqual(s_hum.native_value, 0.0)
self.assertEqual(s_hum.native_value, 49.6)
46 changes: 46 additions & 0 deletions tests/test_sensor_A5_04_03.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import unittest
from custom_components.eltako.sensor import *
from mocks import HassMock
from unittest import mock
from mocks import *
from homeassistant.helpers.entity import Entity
from homeassistant.const import Platform
from custom_components.eltako.binary_sensor import EltakoBinarySensor
from eltakobus import *

# 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 TestSensor_A5_04_02(unittest.TestCase):

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

def create_temperature_sensor(self) -> EltakoTemperatureSensor:
gateway = GatewayMock()
dev_id = AddressExpression.parse("FF-FF-00-80")
dev_name = "device name"
dev_eep = EEP.find("A5-04-03")
s = EltakoTemperatureSensor(Platform.SENSOR, gateway, dev_id, dev_name, dev_eep)
return s

def create_humidity_sensor(self) -> EltakoHumiditySensor:
gateway = GatewayMock()
dev_id = AddressExpression.parse("FF-FF-00-80")
dev_name = "device name"
dev_eep = EEP.find("A5-04-03")
s = EltakoHumiditySensor(Platform.SENSOR, gateway, dev_id, dev_name, dev_eep)
return s

def test_temperature_sensor_A5_04_02(self):
s_temp = self.create_temperature_sensor()

s_temp.value_changed(self.msg1)
self.assertEqual(s_temp.native_value, 22.8125)

def test_humidity_sensor_A5_04_02(self):
s_hum = self.create_humidity_sensor()

s_hum.value_changed(self.msg1)
self.assertEqual(s_hum.native_value, 60.0)
42 changes: 42 additions & 0 deletions tests/test_sensor_A5_06_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import unittest
from custom_components.eltako.sensor import *
from mocks import HassMock
from unittest import mock
from mocks import *
from homeassistant.helpers.entity import Entity
from homeassistant.const import Platform
from custom_components.eltako.binary_sensor import EltakoBinarySensor
from eltakobus import *

# 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 TestSensor_A5_06_01(unittest.TestCase):



def create_illumination_sensor(self) -> EltakoIlluminationSensor:
gateway = GatewayMock()
dev_id = AddressExpression.parse("FF-FF-00-80")
dev_name = "device name"
dev_eep = EEP.find("A5-06-01")
s = EltakoIlluminationSensor(Platform.SENSOR, gateway, dev_id, dev_name, dev_eep)
return s

def test_illumincation_sensor(self):
s_ill = self.create_illumination_sensor()

# check daylight
msg = Regular4BSMessage (address=b'\xFF\xFF\x00\x80', data=b'\x60\xAA\x00\x0F', status=0x00)
s_ill.value_changed(msg)
self.assertEqual(s_ill.native_value, 20100.0)

# check twilight
msg = Regular4BSMessage (address=b'\xFF\xFF\x00\x80', data=b'\x60\x00\x00\x0F', status=0x00)
s_ill.value_changed(msg)
self.assertEqual(s_ill.native_value, 96.0)



0 comments on commit 07316b3

Please sign in to comment.