jheling / freeathome

Free@Home component for Home Assistant
114 stars 41 forks source link

Missing support for window sensors #133

Closed NeoBlack closed 2 months ago

NeoBlack commented 2 years ago

Hello, I am missing the support for my window sensors.

The sensor delivers three values for closed (0), open (100), and titled (33).

In the attached logs, you find the sensor with serialNumber ABB700D46EDC, which is one of my window sensors.

From the dump:

  <pairing visible="true" sensor="ABB700D46EDC/ch0001" actuator="ABB700D3D774/ch0003"/>
  <pairing visible="true" sensor="ABB700D46EDC/ch0001" actuator="ABB700D43443/ch0000"/>
  <pairing visible="false" sensor="ABB700D46EDC/ch0001" actuator="ABB66CFB52A9/ch0021"/>

...

<device softwareId="1105" nameId="012E" softwareVersion="2.261" deviceId="2042" isRf="true" isTp="false" domainAddress="BAE7" isExternal="false" individualAddress="028B" isBatteryPowered="true" profile="1E40" maxAPDULength="59" compilerVersion="007A3CF9" buildNumber="00000105" iconId="0051" protocolVersion="0004" minConfigVersion="0001" deviceFlavor="00" functionId="0051" interface="RF" cyclicSleepSecs="012C" batteryStatus="FF" batteryLow="false" shortSerialNumber="TDC" name="Window/Door" serialNumber="ABB700D46EDC" multicastRoute="0200" unicastRoute="0200" commissioningState="ready" consistencyTag="1dfc" copyId="6" progress="100">
   <attribute name="batteryVoltage">2.98389</attribute>
   <attribute name="connectivity">good</attribute>
   <attribute name="deviceErrorLog">59090cf4</attribute>
   <attribute name="deviceReboots">20</attribute>
   <attribute name="displayName">Fenster Küche</attribute>
   <attribute name="floor">01</attribute>
   <attribute name="offsetX">0.0471723434450857</attribute>
   <attribute name="offsetY">0.763829785881313</attribute>
   <attribute name="operationTime">30024</attribute>
   <attribute name="resetCause">0</attribute>
   <attribute name="room">00</attribute>
   <attribute name="systemState">1ff</attribute>
   <channels>
    <channel channelId="0542" maxScenes="00" mask="00000002" nameId="012E" persistentId="0000" combined="true" i="ch0000" cid="ABB70542">
     <functions>
      <function preconfigured="false" nameId="0161" functionId="000F" accessLevel="Enduser" sensorMatchCode="00000001" actuatorMatchCode="00000000" isDefault="true" fixed="false" bestMatch="false" name="Window&#x20;sensor"/>
     </functions>
     <inputs/>
     <outputs>
      <dataPoint pairingId="0035" dpt="0113" autoConnectRoom="false" nameId="012E" autoConnectFloor="false" autoConnectHouse="false" defaultConnection="true" matchCode="00000001" maxConnections="20" name="Window/Door" full="false" i="odp0000">
       <value>0</value>
      </dataPoint>
     </outputs>
     <parameters/>
     <scenes/>
    </channel>
    <channel channelId="0562" maxScenes="00" mask="00000001" nameId="012E" persistentId="0001" isActive="true" combined="true" i="ch0001" cid="ABB70562">
     <attribute name="functionId">64</attribute>
     <attribute name="selectedIcon">51</attribute>
     <functions>
      <function preconfigured="false" nameId="0425" functionId="0064" accessLevel="Enduser" sensorMatchCode="00000001" actuatorMatchCode="00000000" isDefault="true" fixed="false" bestMatch="false" name="WindowDoor&#x20;Position&#x20;Sensor"/>
     </functions>
     <inputs/>
     <outputs>
      <dataPoint pairingId="0035" dpt="0113" autoConnectRoom="false" nameId="012E" autoConnectFloor="false" autoConnectHouse="false" defaultConnection="true" matchCode="00000001" maxConnections="20" name="Window/Door" full="false" i="odp0000">
       <value>1</value>
       <address timeSlot="0" primary="true" singleSink="false">4c23</address>
      </dataPoint>
      <dataPoint pairingId="0029" dpt="0501" autoConnectRoom="false" nameId="0333" autoConnectFloor="false" autoConnectHouse="false" defaultConnection="true" matchCode="00000001" maxConnections="20" name="Window/Door&#x20;position" full="false" i="odp0001">
       <value>100</value>
       <address timeSlot="0" primary="true" singleSink="false">b0ed</address>
      </dataPoint>
     </outputs>
     <parameters/>
     <scenes/>
    </channel>

From the monitor:

<?xml version="1.0" encoding="UTF-8"?>
<project timeStamp="860434" sessionId="7efebcb9" type="update" mrhaVersion="3.0.1" mrhaBuild="8959">
    <privileges/>
    <devices>
        <device serialNumber="ABB700D3D774" domainAddress="BAE7" state="modified" commissioningState="ready"
                progress="100">
            <channels>
                <channel state="modified" i="ch0003" cid="ABB70247">
                    <inputs>
                        <dataPoint state="modified" i="idp0009" full="false">
                            <value>1</value>
                        </dataPoint>
                    </inputs>
                    <outputs/>
                    <parameters/>
                    <scenes/>
                </channel>
            </channels>
            <parameters/>
        </device>
        <device serialNumber="ABB700D43443" domainAddress="BAE7" state="modified" commissioningState="ready"
                progress="100">
            <channels>
                <channel state="modified" i="ch0000" cid="ABB702EB">
                    <inputs>
                        <dataPoint state="modified" i="idp0015" full="false">
                            <value>1</value>
                        </dataPoint>
                    </inputs>
                    <outputs/>
                    <parameters/>
                    <scenes/>
                </channel>
            </channels>
            <parameters/>
        </device>
        <device serialNumber="ABB66CFB52A9" domainAddress="BAE7" state="modified" commissioningState="ready"
                progress="100">
            <channels>
                <channel hidden="true" state="modified" i="ch0021" cid="ABB60403">
                    <inputs>
                        <dataPoint state="modified" i="idp0000" full="true">
                            <value>1</value>
                        </dataPoint>
                        <dataPoint state="modified" i="idp0001" full="true">
                            <value>100</value>
                        </dataPoint>
                    </inputs>
                    <outputs/>
                    <parameters/>
                    <scenes/>
                </channel>
            </channels>
            <parameters/>
            <dicts/>
        </device>
        <device multicastRoute="0200" unicastRoute="0200" serialNumber="ABB700D46EDC" domainAddress="BAE7"
                state="modified" commissioningState="ready" progress="100">
            <channels>
                <channel state="modified" i="ch0001" cid="ABB70562">
                    <inputs/>
                    <outputs>
                        <dataPoint state="modified" i="odp0000" full="false">
                            <value>1</value>
                        </dataPoint>
                        <dataPoint state="modified" i="odp0001" full="false">
                            <value>100</value>
                        </dataPoint>
                    </outputs>
                    <parameters/>
                    <scenes/>
                </channel>
            </channels>
            <parameters/>
        </device>
    </devices>
</project>

        <?xml version="1.0" encoding="UTF-8"?><project timeStamp="860437" sessionId="7efebcb9" type="update"
                                                       mrhaVersion="3.0.1" mrhaBuild="8959">
<privileges/>
<devices>
    <device serialNumber="ABB66CFB52A9" domainAddress="BAE7" state="modified" commissioningState="ready" progress="100">
        <channels>
            <channel hidden="true" state="modified" i="ch0021" cid="ABB60403">
                <inputs>
                    <dataPoint state="modified" i="idp0001" full="true">
                        <value>33</value>
                    </dataPoint>
                </inputs>
                <outputs/>
                <parameters/>
                <scenes/>
            </channel>
        </channels>
        <parameters/>
        <dicts/>
    </device>
    <device multicastRoute="0200" unicastRoute="0200" serialNumber="ABB700D46EDC" domainAddress="BAE7" state="modified"
            commissioningState="ready" progress="100">
        <channels>
            <channel state="modified" i="ch0001" cid="ABB70562">
                <inputs/>
                <outputs>
                    <dataPoint state="modified" i="odp0001" full="false">
                        <value>33</value>
                    </dataPoint>
                </outputs>
                <parameters/>
                <scenes/>
            </channel>
        </channels>
        <parameters/>
    </device>
</devices>
</project>

        <?xml version="1.0" encoding="UTF-8"?><project timeStamp="860438" sessionId="7efebcb9" type="update"
                                                       mrhaVersion="3.0.1" mrhaBuild="8959">
<privileges/>
<devices>
    <device serialNumber="ABB66CFB52A9" domainAddress="BAE7" state="modified" commissioningState="ready" progress="100">
        <channels>
            <channel hidden="true" state="modified" i="ch0021" cid="ABB60403">
                <inputs>
                    <dataPoint state="modified" i="idp0001" full="true">
                        <value>100</value>
                    </dataPoint>
                </inputs>
                <outputs/>
                <parameters/>
                <scenes/>
            </channel>
        </channels>
        <parameters/>
        <dicts/>
    </device>
    <device multicastRoute="0200" unicastRoute="0200" serialNumber="ABB700D46EDC" domainAddress="BAE7" state="modified"
            commissioningState="ready" progress="100">
        <channels>
            <channel state="modified" i="ch0001" cid="ABB70562">
                <inputs/>
                <outputs>
                    <dataPoint state="modified" i="odp0001" full="false">
                        <value>100</value>
                    </dataPoint>
                </outputs>
                <parameters/>
                <scenes/>
            </channel>
        </channels>
        <parameters/>
    </device>
</devices>
</project>

        <?xml version="1.0" encoding="UTF-8"?><project timeStamp="860439" sessionId="7efebcb9" type="update"
                                                       mrhaVersion="3.0.1" mrhaBuild="8959">
<privileges/>
<devices>
    <device serialNumber="ABB700D3D774" domainAddress="BAE7" state="modified" commissioningState="ready" progress="100">
        <channels>
            <channel state="modified" i="ch0000" cid="ABB7008F">
                <inputs>
                    <dataPoint state="modified" i="idp0002" full="false">
                        <value>0</value>
                    </dataPoint>
                </inputs>
                <outputs/>
                <parameters/>
                <scenes/>
            </channel>
            <channel state="modified" i="ch0003" cid="ABB70247">
                <inputs>
                    <dataPoint state="modified" i="idp0009" full="false">
                        <value>0</value>
                    </dataPoint>
                </inputs>
                <outputs>
                    <dataPoint state="modified" i="odp0003" full="false">
                        <value>0</value>
                    </dataPoint>
                    <dataPoint state="modified" i="odp0004" full="false">
                        <value>0</value>
                    </dataPoint>
                </outputs>
                <parameters/>
                <scenes/>
            </channel>
        </channels>
        <parameters/>
    </device>
    <device serialNumber="ABB700D43443" domainAddress="BAE7" state="modified" commissioningState="ready" progress="100">
        <channels>
            <channel state="modified" i="ch0000" cid="ABB702EB">
                <inputs>
                    <dataPoint state="modified" i="idp0015" full="false">
                        <value>0</value>
                    </dataPoint>
                </inputs>
                <outputs>
                    <dataPoint state="modified" i="odp0009" full="false">
                        <value>65</value>
                    </dataPoint>
                </outputs>
                <parameters/>
                <scenes/>
            </channel>
        </channels>
        <parameters/>
    </device>
    <device serialNumber="ABB66CFB52A9" domainAddress="BAE7" state="modified" commissioningState="ready" progress="100">
        <channels>
            <channel state="modified" i="ch000E" cid="ABB6047E">
                <inputs>
                    <dataPoint state="modified" i="idp000B" full="false">
                        <value>0</value>
                    </dataPoint>
                    <dataPoint state="modified" i="idp000C" full="false">
                        <value>0</value>
                    </dataPoint>
                </inputs>
                <outputs/>
                <parameters/>
                <scenes/>
            </channel>
            <channel hidden="true" state="modified" i="ch0021" cid="ABB60403">
                <inputs>
                    <dataPoint state="modified" i="idp0000" full="true">
                        <value>0</value>
                    </dataPoint>
                    <dataPoint state="modified" i="idp0001" full="true">
                        <value>0</value>
                    </dataPoint>
                </inputs>
                <outputs/>
                <parameters/>
                <scenes/>
            </channel>
        </channels>
        <parameters/>
        <dicts/>
    </device>
    <device multicastRoute="0200" unicastRoute="0200" serialNumber="ABB700D46EDC" domainAddress="BAE7" state="modified"
            commissioningState="ready" progress="100">
        <channels>
            <channel state="modified" i="ch0001" cid="ABB70562">
                <inputs/>
                <outputs>
                    <dataPoint state="modified" i="odp0000" full="false">
                        <value>0</value>
                    </dataPoint>
                    <dataPoint state="modified" i="odp0001" full="false">
                        <value>0</value>
                    </dataPoint>
                </outputs>
                <parameters/>
                <scenes/>
            </channel>
        </channels>
        <parameters/>
    </device>
    <device serialNumber="FFFF40010001" domainAddress="BAE7" state="modified" commissioningState="ready">
        <channels>
            <channel state="modified" i="ch0000" cid="FFFF0202">
                <inputs>
                    <dataPoint state="modified" i="idp0003" full="false">
                        <value>0</value>
                    </dataPoint>
                </inputs>
                <outputs>
                    <dataPoint state="modified" i="odp0007" full="false">
                        <value>0</value>
                    </dataPoint>
                </outputs>
                <parameters/>
                <scenes/>
            </channel>
        </channels>
    </device>
</devices>
</project>
Tho85 commented 2 years ago

Thanks for your detailed report. Could you try my code from PR #136? The sensor should be exposed as a binary sensor, with an extra attribute window_position that should read closed, tilted or open.

s-b-n commented 2 years ago

I'm just starting with Home Assistant and this repository but I'm really glad it's available and actively maintained!

I tested the PR #136 and the correct device (ABBxxx) was added with one binary sensor. But in HA under "Developer Tools > States" I only see one attribute: friendly_name. I would have expected to see window_position to be there?

Also all freeathome_events stopped working. Neither do I see an event when the window sensor is activated nor do I see any other events (which are working fine on the master branch).

I'm not quite sure what further information you need for debugging, but please tell me, if I somehow can provide some support!

EDIT: Question: Maybe the info is better placed in the PR itself?

NeoBlack commented 2 years ago

Thanks for your detailed report. Could you try my code from PR https://github.com/jheling/freeathome/pull/136? The sensor should be exposed as a binary sensor, with an extra attribute window_position that should read closed, tilted or open.

I am so sorry, I did not see your comment. I have no idea how to test your patch. This is not my programming language nor my "world", if you give me a hint on how I can test it, I will try it.

NeoBlack commented 2 years ago

ping :) Any news? If someone guides me on how to test the patch, I will give it a try. I would like to have the mentioned information for window_position: close, open, tilted. The second information about the battery level would be fantastic because the free@home app does not inform us about low battery levels.

NeoBlack commented 2 months ago

Many thanks! I saw the feature was merged some weeks ago!