Mi(Xiaomi) Smart home bindings?


(Andreas B ) #570

I had it working with the normal rule with “getEvent” in 2.2 and after a restart it is not working anymore…

The error is:

18:50:28.716 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'Office Andreas Button': 'getEvent' is not a member of 'org.eclipse.smarthome.core.thing.events.ChannelTriggeredEvent'; line 48, column 20, length 24

Is it possible to make “getEvent” a member of these events?..

Edit:
I do not know if this website is up to date, but there is getEvent: https://www.eclipse.org/smarthome/documentation/javadoc/org/eclipse/smarthome/core/thing/events/ChannelTriggeredEvent.html


(rb) #571

I have the same problem. My setup is Raspberry 3, latest Openhabian, 2 gateways with latest firmware, 12 sensors.

I used hostapd to create a hotspot on the raspberry, and told my 2 gateways connect to it. The gateways and some sensors are found, but nothing works. Logfiles gave the same error as you have.
After activating debug logging for the binding it appears that no gateway heartbeats are coming in.

I changed my setup to use an old router instead, with the gateways connected via wifi and the raspberry connected via wired ethernet.

Now it works, somewhat. Hartbeats come in but commands seem not to be fully reliable.
I have code in a background timer thread that makes both gateway lights flash red (500ms on, 500ms off).
The gateways don’t flash in synch. Some on/off commands seem to be lost, so one of the gateways misses an on or off cycle.
Sometimes both are in synch for a few seconds, then one misses an on/off command, then maybe the other gateway. Unpredictable.

The same rules running on my windows PC work flawlessly.

Has anyone exerienced something similar?


(Patrik) #572

603/5000
I do not know how to continue. I deleted the gateway and reconfigured. Now I see no more heartbeats in Wireshark :frowning: There was a heartbeat when setting the new IP in the PaperUI.The token now seems to be set, but I get now another error message.The temperatures of my MiHome sensors are read out correctly.

If I restart the RPI, the Toekn will not be set either. The whole thing is very strange. Before I installed the latest Openhabian image, I could easily use the binding.

Does anyone have an idea or a tip for me?

EDIT: I have just noticed that the temperature values do not change anymore. They seem to be read out at initialization and then stay that way.

java.lang.NullPointerException: null
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.toJsonValue(XiaomiBridgeHandler.java:320) [207:org.openhab.binding.mihome:2.2.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.sendCommandToBridge(XiaomiBridgeHandler.java:258) [207:org.openhab.binding.mihome:2.2.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.sendCommandToBridge(XiaomiBridgeHandler.java:240) [207:org.openhab.binding.mihome:2.2.0]
at org.openhab.binding.mihome.handler.XiaomiBridgeHandler.writeToBridge(XiaomiBridgeHandler.java:272) [207:org.openhab.binding.mihome:2.2.0]
at org.openhab.binding.mihome.handler.XiaomiActorGatewayHandler.writeBridgeRingtone(XiaomiActorGatewayHandler.java:199) [207:org.openhab.binding.mihome:2.2.0]
at org.openhab.binding.mihome.handler.XiaomiActorGatewayHandler.execute(XiaomiActorGatewayHandler.java:98) [207:org.openhab.binding.mihome:2.2.0]
at org.openhab.binding.mihome.handler.XiaomiDeviceBaseHandler.handleCommand(XiaomiDeviceBaseHandler.java:104) [207:org.openhab.binding.mihome:2.2.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
at org.eclipse.smarthome.core.internal.common.InvocationHandlerSync.invoke(InvocationHandlerSync.java:59) [109:org.eclipse.smarthome.core:0.10.0.b1]
at com.sun.proxy.$Proxy146.handleCommand(Unknown Source) [207:org.openhab.binding.mihome:2.2.0]
at org.eclipse.smarthome.core.thing.internal.profiles.ProfileCallbackImpl.handleCommand(ProfileCallbackImpl.java:72) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
at org.eclipse.smarthome.core.thing.internal.profiles.SystemDefaultProfile.onCommandFromItem(SystemDefaultProfile.java:49) [116:org.eclipse.smarthome.core.thing:0.10.0.b1]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]

(Sergey M) #573

Has anyone updated the gateway to the latest version 1.4.1_151.0143?


(Igor) #574

I did few weeks ago - all is working fine


(rb) #575

Patrik,
Are you using the raspberry as the wifi hotspot for the gateway?
That’s where my problems came from. In my setup with raspberry hotspot one gateway would initialize ok, all sensor values refreshed once, then no more heartbeats and no refresh, also updates don’t work. My second gateway would not initialize at all.

Now with a separate router it works ok but not perfectly, rapid updates sometimes get lost.
.


(Patrik) #576

Hi,

I have connected the Gateway with my fritzBox 7490. i dont use the wlan from the pi. The pi is connected per lan with the fritzBox too.


(Andrew Shumik) #577

Hi. I am update Xiaomi gateway to lastest version.


(Thomas Binder) #578

I had some problems getting the binding to auto-discover the gateway (1.4.1_151.0143, btw) - turned out, the Wifi was in powersaving mode! after changing that to off, it works now. Perhaps, that was one part in your setup?

So, running the mihome binding on a wifi connected OH2, be sure, powersaving is off.
I’m still getting some delays between updates (temperature/pressure/humidity sensor), but I’m fine with it.


(Andrew Shumik) #579

I have OpenHAB2 Snapshot release. Connect Mi Smoke Sensor (Xiaomi Mijia Honeywell Fire Alarm Detector) over Mi Home Gateway v3. Smoke Sensor have some properties - status and % of charge. Current status is unknow and % of charge is NaN. It’s normally?


(Thomas Binder) #580

i discovered, that the Smoke Detector is one of the trickier ones. Perhaps to save battery, its only sending updates to the Gateway in hour long intervals. You have to be lucky to get an answer just after reloading the items file. Just let OH2 run for a couple hours and then sometime there should be some info from the smoke sensor.
I don’t think, the Gateway persists Information, but only transports live data from the sensors. In the App you get persisted data from the cloud.


(Andrew Shumik) #581

Thank you, Thomas. I’ll wait a while.


(Thomas Binder) #582

—or just blow some smoke to it and see what happens! :rofl:


(Andrew Shumik) #583

Ок, I’ll make a little fire. :wink:


(Gary Lau) #584

i got a problem, the binding suddenly not work these days.

i checked the trace log, every time i restart the openhab, after several minutes,
the binding will no more sync with token

[home.handler.XiaomiDeviceBaseHandler] - Item got update: {“cmd”:“heartbeat”,“model”:“gateway”,“sid”:“f0b429cc6c98”,“short_id”:“0”,“token”:“h3jWcYRmS76T70Z7”,“data”:"{“ip”:“192.168.1.3”}"}

No more the above message

then the binding will not work any more

and i found out it’s my .items or .things file problem.

guess it may be the curtain thing & item throw exception and stopped the thread socket.

I will check and report later


(Sven Mey) #585

Hi,

to be honest I have no idea what is supposed to work or not. I had the issue that my button stopped working after an update of OH and I found the new rules on the net and they worked for me. I am sorry I can’t help you out on this.

Sven


(Thomas Binder) #586

is your openHAB connected via Wifi or LAN? if it’s Wifi-connected, you must turn off power_save mode. otherwise, the OH2-socket won’t stay connected with the gateway.


(Javi) #587

HI,

Anyone with xiaomi plug zigbee device problem?

I’ve installes OH1 with xiaomigateway-1.11.0-SNAPSHOT.jar release all works fine but i cant read the load_power consumption.

The log file continuoly show:

2017-12-27 23:09:15.757 [ERROR] [o.o.b.x.i.XiaomiGatewayBinding] - java.lang.NumberFormatException: For input string: "14.09"
2017-12-27 23:10:15.762 [ERROR] [o.o.b.x.i.XiaomiGatewayBinding] - java.lang.NumberFormatException: For input string: "13.67"
2017-12-27 23:11:15.765 [ERROR] [o.o.b.x.i.XiaomiGatewayBinding] - java.lang.NumberFormatException: For input string: "12.56"
2017-12-27 23:12:15.920 [ERROR] [o.o.b.x.i.XiaomiGatewayBinding] - java.lang.NumberFormatException: For input string: "16.03"
2017-12-27 23:13:15.761 [ERROR] [o.o.b.x.i.XiaomiGatewayBinding] - java.lang.NumberFormatException: For input string: "13.28"
2017-12-27 23:14:15.770 [ERROR] [o.o.b.x.i.XiaomiGatewayBinding] - java.lang.NumberFormatException: For input string: "16.60"
2017-12-27 23:14:30.760 [ERROR] [o.o.b.x.i.XiaomiGatewayBinding] - java.lang.NumberFormatException: For input string: "14.09"
2017-12-27 23:15:15.758 [ERROR] [o.o.b.x.i.XiaomiGatewayBinding] - java.lang.NumberFormatException: For input string: "14.53"

This values are the current power.

The gateway current version is the 1.4.1_151.0143.

Item file:

/* XIAOMI PLUG*/
Switch  XiaomiPlugInUse                  "Xiaomi Enchufe"                                                                     { xiaomigateway="158d000xxxxxxx.inuse" }
Switch  XiaomiPlug                       "Xiaomi Lavadora"                                                                    { xiaomigateway="158d000xxxxxxx.plug" }
Number  XiaomiPlugConsumed               "Xiaomi zigbee plug consumed [%.0f kWh]"                                              { xiaomigateway="158d000xxxxxx.power_consumed" }
Number  XiaomiPlugLoad                   "Xiaomi zigbee plug load [%.0f W]"                                                   { xiaomigateway="158d0000xxxxxx.load_power" }

And the sitemap file:

Frame label="Lavadora" {
    Text item=XiaomiPlugInUse {
      Frame {
        Switch item=XiaomiPlugInUse
        Switch item=XiaomiPlug
        Text item=XiaomiPlugConsumed
        Text item=XiaomiPlugLoad
      }
    }
  }

Any ideas?

Thx


(Gary Lau) #588

I found out the Curtain item has a event , which will cause the whole binding stop working.

Sometimes the curtain motor will report the value “-1”, i have to reset the curtain myself,

Item got update: {“cmd”:“read_ack”,“model”:“curtain”,“sid”:“158d00012d69e7”,“short_id”:56211,“data”:"{“voltage”:3600,“curtain_level”:"-1"}"}

Though the value range is 0-100, but sometimes when the curtain motor stuck, it will send -1

the -1 will crash the whole binding.

Please check.

Thanks.


(Murpher) #589

Hi @binderth,

How do you check if openHAB power_save mode is On or Off. Cheers