Closed LSchuetzi84 closed 2 months ago
Thank you for the dump, this will help a lot.
@jheling Are there any plans to support window sensors in the future?
@etiennelenhart . Yes, making a it a binary sensor should be easy. Only the tilt is a bit a challenge. I found some examples where is was implemented with two binary sensors. One for open /closed and one for tilted.
Oh, so there is no direct support for these kinds of sensors in Home Assistant?
FWIW I would be fine with a binary state for now, as I'm currently only using the opened state.
I would also like to receive this functionality in HA -> I would also test it...
The solution turned out to be very simple. I have only implemented the binary part. You can try #198
@jheling: I can confirm, that the actuators now work. But it was there before, wasn't it?! And this Issue is more about the sensors, not the actuators.
@jheling With the newest update I‘m getting a binary sensor for the window sensor‘s state, but not the window_position
attribute. Is this not implemented yet?
@Tho85 Can you help us adding the window position to the current main version? We only have the status "Open" or "Closed", not "Tilted".
@etiennelenhart. The code for the window_position is included but it does not seem to work. Can you change the logging for the integration to info? Maybe the format of the data that is sent by free@home is a bit different than expected. With this extended logging you should see the update messages coming free@home.
logger:
default: warning
logs:
custom_components.freeathome: info
@jheling I think these should be the relevant lines (I included the DEBUG level logs for good measure):
DEBUG (MainThread) [custom_components.freeathome.fah.pfreeathome] received datapoint ABB7FXXXXXXX/ch0001/odp0000 = 1
DEBUG (MainThread) [custom_components.freeathome.fah.pfreeathome] FahBinarySensor Terrassentür Wohnzimmer: received datapoint ABB7FXXXXXXX/ch0001/odp0000 = 1
INFO (MainThread) [custom_components.freeathome.fah.devices.fah_binary_sensor] binary sensor Terrassentür Wohnzimmer (ABB7FXXXXXXX/ch0001) dp odp0000 state 1
INFO (MainThread) [custom_components.freeathome.binary_sensor] update sensor
@etiennelenhart Thank you, can you give me the sensor values for the three states? So open, tilted and closed? The current code is testing on these values:
if self.binary_device.window_position == '0':
attributes["window_position"] = "closed"
elif self.binary_device.window_position == '33':
attributes["window_position"] = "tilted"
elif self.binary_device.window_position == '100':
attributes["window_position"] = "open"
From what I can tell the sensor values seem to match:
# closed -> open
22:02:13.675 DEBUG [fah.pfreeathome] received datapoint ABB7FXXXXXXX/ch0001/odp0000 = 1
22:02:13.675 DEBUG [fah.pfreeathome] FahBinarySensor Terrassentür Wohnzimmer: received datapoint ABB7FXXXXXXX/ch0001/odp0000 = 1
22:02:13.676 INFO [fah.devices.fah_binary_sensor] binary sensor Terrassentür Wohnzimmer (ABB7FXXXXXXX/ch0001) dp odp0000 state 1
22:02:13.676 INFO [binary_sensor] update sensor
22:02:14.724 DEBUG [fah.pfreeathome] received datapoint ABB7FXXXXXXX/ch0001/odp0001 = 100
# open -> tilted
22:02:26.911 DEBUG [fah.pfreeathome] received datapoint ABB7FXXXXXXX/ch0001/odp0001 = 33
# tilted -> closed
22:02:45.370 DEBUG [fah.pfreeathome] received datapoint ABB7FXXXXXXX/ch0001/odp0001 = 100
22:02:46.359 DEBUG [fah.pfreeathome] received datapoint ABB7FXXXXXXX/ch0001/odp0000 = 0
22:02:46.359 DEBUG [fah.pfreeathome] FahBinarySensor Terrassentür Wohnzimmer: received datapoint ABB7FXXXXXXX/ch0001/odp0000 = 0
22:02:46.360 INFO [fah.devices.fah_binary_sensor] binary sensor Terrassentür Wohnzimmer (ABB7FXXXXXXX/ch0001) dp odp0000 state 0
22:02:46.360 DEBUG [fah.pfreeathome] received datapoint ABB7FXXXXXXX/ch0001/odp0001 = 0
22:02:46.360 INFO [binary_sensor] update sensor
What stands out to me is the additional sensor value 1
, the two consecutive datapoints for 0
, and the missing update sensor
calls for values 100
and 33
. I guess free@home sends values for both sensor ranges simultaneously? 0
& 1
for closed
& open
(includes tilted
) as well as 0
, 100
& 33
for closed
, tilted
& open
.
Since it looks like the values match, maybe they are not processed correctly? You can see that the actual logs indicating a received datapoint for FahBinarySensor
only appear for values 1
and 0
.
@etiennelenhart. I think i have found the problem. Can you add 'PID_WINDOW_DOOR_POSITION' to line 56 in the source fah_binary_sensor.py? It should look like this:
PID_FORCE_POSITION_BLIND,
PID_WINDOW_DOOR,
PID_WINDOW_DOOR_POSITION,
PID_SWITCHOVER_HEATING_COOLING,
Yes! It works. 🎉
The entity correctly shows an attribute for window_position
that switches between closed
, open
, and tilted
.
@etiennelenhart Thanks! The debug logging was very usefull.
Confirmed the fix:
I have several window sensors that are mounted directly on the window handle. These indicate whether the window is closed / open / tilted. These are not displayed. Example:
freeathome_dump_192.168.178.25_2024_04_17_20_38_04.xml.zip