OH3: Xiaomi Mi Magnet_Sensor Channel isOpenAlarm not working

Hello

Yesterday I moved all my .rules to OH3 running on RPI4. Some of the rules worked perfectly, some of them don’t - especially rules working with Xiaomi sensor channels and not items. For button rules, I was able to resolve it with the help of this forum, thanks a lot! But I’m struggling with the contact sensor, which was working perfectly under OH2.5.

rule “TFS Reminder Wohnen links”
when
Channel “mihome:sensor_magnet:7811dc6xxxx:158d0001cxxxx:isOpenAlarm” triggered ALARM
then
var naOutdoorTemp6 = (Netatmo_Outdoor_Temperature.state as Number)
if (naOutdoorTemp6 < vTFS_Alarm_Temperature) {
sendBroadcastNotification(“TFS Reminder: Wohnzimmerfenster links schliessen”)
logInfo(“TFS Reminder”, “Wohnzimmerfenster links schliessen”)
}
end

This rule isn’t working anymore… Are there any changes done from OH2.5 to OH3.0 on this topic?

Thanks in advance

Jan

Hello
I was monitoring the traffic and saw that the contact sensor is sending the the message right after 60sec, that window is open.

2021-01-02 13:01:44.538 [TRACE] [internal.handler.XiaomiBridgeHandler] - Received message {“cmd”:“report”,“model”:“magnet”,“sid”:“158d0001xxxx”,“short_id”:9500,“data”:"{“status”:“open”}"}

2021-01-02 13:01:44.541 [TRACE] [internal.handler.XiaomiBridgeHandler] - Updated “last time seen” for device 158d0001xxxx

2021-01-02 13:01:44.550 [DEBUG] [rnal.handler.XiaomiDeviceBaseHandler] - Item got update: {“cmd”:“report”,“model”:“magnet”,“sid”:“158d0001xxxx”,“short_id”:9500,“data”:"{“status”:“open”}"}

2021-01-02 13:02:44.457 [TRACE] [internal.handler.XiaomiBridgeHandler] - Received message {“cmd”:“report”,“model”:“magnet”,“sid”:“158d0001xxxx”,“short_id”:9500,“data”:"{“no_close”:“60”}"}

2021-01-02 13:02:44.459 [TRACE] [internal.handler.XiaomiBridgeHandler] - Updated “last time seen” for device 158d0001xxxx

2021-01-02 13:02:44.476 [DEBUG] [rnal.handler.XiaomiDeviceBaseHandler] - Item got update: {“cmd”:“report”,“model”:“magnet”,“sid”:“158d0001xxxx”,“short_id”:9500,“data”:"{“no_close”:“60”}"}

Unfortunately it is not working in rules, neither in text rules files nor in rule definition in ui… rule seems not to receive the trigger as defined in
Channel “mihome:sensor_magnet:7811dc64f59f:158d0001xxxx:isOpenAlarm” triggered ALARM

Anyone else facing this problem? As mentioned above it was working under OH2.5 perfectly.

What is the proceeding in such cases? Is it the right way to open a thread for addons in GitHub?

Thanks Jan

Hello

Just another try to find out, if someone else is experiencing this problem.

I have Xiaomi Mi Magnet Sensors (the round ones, not Aqara). Under OH2 I had configured the Alarm Channel to fire depending on the outside temperature.

Rule looks as follows:

rule "TFS Reminder Schlafzimmer"
when
    Channel "mihome:sensor_magnet:286c0xxxx:158d00020xxxx:isOpenAlarm" triggered ALARM
then
    logInfo("Fensteralarm", "Rule für Schlafzimmer fired")
    var Number naOutdoorTemp13 = (Netatmo_Outdoor_Temperature.state as QuantityType<Number>).doubleValue
    logInfo("Test für Fensteralarm", "Netatmo ist: " + naOutdoorTemp13.toString + " der Eckwert ist: " + Cv_TFS_Alarm_Temperature.state.toString)
    if (naOutdoorTemp13 < Cv_TFS_Alarm_Temperature.state) {
        sendBroadcastNotification("TFS Reminder: Schlafzimmerfenster schliessen")
        logInfo("TFS Reminder", "Schlafzimmerfenster schliessen")
    }
end

I have verified that the body of the rule behaves correctly (under OH3 rules → Run Now.

2021-01-22 13:15:07.125 [INFO ] [enhab.core.model.script.Fensteralarm] - Rule für Schlafzimmer fired
2021-01-22 13:15:07.134 [INFO ] [e.model.script.Test für Fensteralarm] - Netatmo ist: 10.5 der Eckwert ist: 18.0
2021-01-22 13:15:07.141 [INFO ] [enhab.core.model.script.TFS Reminder] - Schlafzimmerfenster schliessen

With extended logging I verified I whether isOpenAlarm channel fires

2021-01-17 14:46:06.809 [TRACE] [internal.handler.XiaomiBridgeHandler] - Received message {"cmd":"report","model":"magnet","sid":"158d0001xxxx","short_id":9500,"data":"{\"no_close\":\"60\"}"}
2021-01-17 14:46:06.811 [TRACE] [internal.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 158d0001xxxx
2021-01-17 14:46:06.820 [DEBUG] [rnal.handler.XiaomiDeviceBaseHandler] - Item got update: {"cmd":"report","model":"magnet","sid":"158d0001xxxx","short_id":9500,"data":"{\"no_close\":\"60\"}"}

I suppose, that that indicates, that the triggering signal arrives in OH3.

But: It seems, that the triggering signal is not passed through to the rules. logInfo(“Fensteralarm”, “Rule für Schlafzimmer fired”) never fires…

It seems that this works with Aqara Sensors.

Has someone else the same problem, that the isOpenAlarm rules are not working anymore?

Help appreciated

Thanks a lot!

Jan

runtimeInfo:
  version: 3.1.0
  buildString: "Build #2150"
locale: de_CH
systemInfo:
  configFolder: /etc/openhab
  userdataFolder: /var/lib/openhab
  logFolder: /var/log/openhab
  javaVersion: 11.0.9
  javaVendor: Azul Systems, Inc.
  javaVendorVersion: Zulu11.43+88-CA
  osName: Linux
  osVersion: 5.4.83-v7l+
  osArchitecture: arm
  availableProcessors: 4
  freeMemory: 111317232
  totalMemory: 267730944
bindings:
  - deconz
  - lametrictime
  - mihome
  - miio
  - mystrom
  - netatmo
  - sonos

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.