Skip to content

Commit 9984b91

Browse files
committed
Binary sensor entity uses duplicate din as input
1 parent c5c2eaa commit 9984b91

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

inelsmqtt/protocols/cu3.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,16 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
247247
)
248248
)
249249

250+
din = [state_bin_str[5] == "1", state_bin_str[4] == "1"]
251+
250252
return new_object(
251253
# May not be that interesting for HA
252254
sw=[
253255
state_bin_str[7] == "1", # 0
254256
state_bin_str[6] == "1", # 1
255257
],
256-
din=[state_bin_str[5] == "1", state_bin_str[4] == "1"],
258+
din=din,
259+
input=din,
257260
temp_in=temp,
258261
light_coa_toa=light_coa_toa,
259262
)
@@ -300,12 +303,15 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
300303
humidity = trim_inels_status_values(device_value.inels_status_value, cls.DATA, HUMIDITY, "")
301304
dewpoint = trim_inels_status_values(device_value.inels_status_value, cls.DATA, DEW_POINT, "")
302305

306+
din = [ # 2
307+
digital_inputs_bin_str[7] == "1", # 0 -> 7, reverse endianness
308+
digital_inputs_bin_str[6] == "1",
309+
]
310+
303311
return new_object(
304312
# digital inputs
305-
din=[ # 2
306-
digital_inputs_bin_str[7] == "1", # 0 -> 7, reverse endianness
307-
digital_inputs_bin_str[6] == "1",
308-
],
313+
din=din,
314+
input=din,
309315
interface=[ # 5
310316
digital_inputs_bin_str[5] == "1",
311317
digital_inputs_bin_str[4] == "1",
@@ -354,6 +360,11 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
354360

355361
dewpoint = trim_inels_status_values(device_value.inels_status_value, cls.DATA, DEW_POINT, "")
356362

363+
din = [
364+
digital_inputs[14] == "1", # 9
365+
digital_inputs[13] == "1", # 10
366+
]
367+
357368
return new_object(
358369
interface=[
359370
digital_inputs[7] == "1", # 0
@@ -366,10 +377,8 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
366377
digital_inputs[0] == "1",
367378
digital_inputs[15] == "1", # 8
368379
],
369-
din=[
370-
digital_inputs[14] == "1", # 9
371-
digital_inputs[13] == "1", # 10
372-
],
380+
din=din,
381+
input=din,
373382
prox=digital_inputs[12] == "1", # 11
374383
temp_in=temp,
375384
light_in=light_in,
@@ -711,6 +720,7 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
711720

712721
return new_object(
713722
din=din,
723+
input=din,
714724
sw=sw,
715725
aout=aout,
716726
valves=valves,
@@ -782,6 +792,7 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
782792
# re=re,
783793
temps=temps,
784794
din=din,
795+
input=din,
785796
# relay_overflow=relay_overflow,
786797
)
787798

@@ -883,6 +894,7 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
883894
relay=relay,
884895
temps=temps,
885896
din=din,
897+
input=din,
886898
aout=aout,
887899
dali=dali,
888900
)
@@ -1088,6 +1100,7 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
10881100
return new_object(
10891101
interface=interface,
10901102
din=din,
1103+
input=din,
10911104
temp_in=temp_in,
10921105
ain=ain,
10931106
)
@@ -1140,6 +1153,7 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
11401153
return new_object(
11411154
interface=interface,
11421155
din=din,
1156+
input=din,
11431157
temp_in=temp_in,
11441158
ain=ain,
11451159
humidity=humidity,
@@ -1254,6 +1268,7 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
12541268
return new_object(
12551269
interface=interface,
12561270
din=din,
1271+
input=din,
12571272
temp_in=temp_in,
12581273
light_in=light_in,
12591274
ain=ain,
@@ -1297,6 +1312,7 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
12971312
return new_object(
12981313
interface=interface,
12991314
din=din,
1315+
input=din,
13001316
temp_in=temp_in,
13011317
light_in=light_in,
13021318
ain=ain,
@@ -1343,6 +1359,7 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
13431359
return new_object(
13441360
interface=interface,
13451361
din=din,
1362+
input=din,
13461363
temp_in=temp,
13471364
light_in=light_in,
13481365
ain=ain,
@@ -1426,6 +1443,7 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
14261443
return new_object(
14271444
interface=interface,
14281445
din=din,
1446+
input=din,
14291447
prox=prox,
14301448
temp_in=temp_in,
14311449
light_in=light_in,
@@ -1673,6 +1691,7 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
16731691
return new_object(
16741692
sw=sw,
16751693
din=din,
1694+
input=din,
16761695
light_coa_toa=light_coa_toa,
16771696
)
16781697

@@ -1842,6 +1861,7 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
18421861
return new_object(
18431862
interface=interface,
18441863
din=din,
1864+
input=din,
18451865
temp_in=temp_in,
18461866
temp_out=temp_out,
18471867
)
@@ -2493,6 +2513,7 @@ def create_ha_value_object(cls, device_value: DeviceValue) -> Any:
24932513

24942514
return new_object(
24952515
din=din,
2516+
input=din,
24962517
prox=prox,
24972518
interface=[
24982519
switches_bin_str[7] == "1",

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
setup(
66
name="elkoep-mqtt",
7-
version="0.2.33.beta.29",
7+
version="0.2.33.beta.30",
88
url="https://github.com/epdevlab/elkoep-mqtt",
99
license="MIT",
1010
author="Elko EP s.r.o.",

0 commit comments

Comments
 (0)