Mi(Xiaomi) Smart home bindings?

If TCPDump gives you the heartbeat data then heartbeats are received. No problem on the network part.
So something must be wrong on the Mac, somewhere between the wifi driver and OH.
Could be a firewall, a routing problem, or maybe the Java runtime of OH requires configuration to receive UPD data. Or a bug in the Mac’s JVM.

Maybe try another JVM (if there is one)?

added the mi binding found things to add but cant retrieve token,tryed with MiToolkit,says error db is too small,i took miio2.db from my rooted phone but seems empty.Any ideas?

look herehttps://community.openhab.org/t/xiaomi-robot-vacuum-binding/31317/442

Have you seen the link in the xiaomi mihome vacuum cleaner (wlan) binding already?

There is a way to send playlist-files to the gateway and play own webradio streams…

Maybe it is possible to include this into this binding?

1 Like

Hi,

Has anyone updated the gateway’s firmware to 1.4.1_153.0143 ?

And if you have, are there any issues with it?

I updated yesterday, I did not find any problems.

I did the update as well. Looks ok. Thanks

I updated, now the Gateway_AmbientLight.state is not working any more, channel="mihome:gateway:illumination. Anyone else with this problem?

update: no error. simply too dark :smiley:

@OlivierFr
regarding your log, I am pretty sure you are NOT seeing heartbeats but mDNS messages. This brings me to the conclusion, that your network setup blocks multicast messages.
It’s unfortunately the most common problem with this gateway/binding.
The explanation, why you see the very first value is, that the binding activaley polls the value from the gateway, in which case the gateway answers “directly” to your machine, not via multicast messaging.
Many routers simply block multicast messages - I’m guessing, that it’s a simple security measure, so that no device can spam the network babbling over multicast.
PS:
I submitted an update for the binding today, you will soon be able to trigger the gateways device inclusion mode from OH. no need to stand up and push the button a couple of times to add a new device :slight_smile:
please see here
Cheers!

Hi!
I do not understand, from where do the units at the outlet come from?
mi.items:

Switch box_power           "On/Off [%s]"       <switch>    { channel="mihome:sensor_plug:id:power" }
Switch box_inuse           "inuse [%s]"        <switch>    { channel="mihome:sensor_plug:id:inUse" }
Number box_provided_power  "Provided Power"    <time>      { channel="mihome:sensor_plug:id:loadPower" }
Number box_power_consumed  "Power consumed"    <time>      { channel="mihome:sensor_plug:id:powerConsumed" }

mi.sitemap:

    Frame {
        Switch  item=box_power
        Switch  item=box_inuse
        Text    item=box_provided_power
        Text    item=box_power_consumed
    }

2

box_provided_power- should not be - current (A)?
Thanks!

You are confusing the concepts of power (W) and current (A). What is shown is power which had the correct unit, likewise for the consumption kWh which is the energy consumed.

Hello!
I have some strange problem. I tryed to connect gateway to the openhab 2 and it’s look like connected. I saw gateway and switches in the inbox - but after that my mi home app lost connection to the gateway. And I still can’t connect it again. I restarted it more that 10 times. It connects to mi home andoird app. I specify wifi, it connect to wifi and nothing more. Just “connection timed out”. Did anybody face this problem?
Thanks.
P.S. Looks like it’s not openhab issue. When I connect gateway to mobile internet it connected without problem, so it’s look like microtik/firewall or other network issue.
P.P.S. Sorry for bad english.

Thank you! I was confused by the fact that there are watts and kilowatts. Now I realized that Watts is the current power. And what do the kilowatts show (power_consumed), more precisely for what period of time?
There is no such value in the android application.

But my main question was different:

I did not specify the units of measure neither in the elements nor in the site map (Are circled on screenshots.), but they are. I’m wondering, from where? How it works?
Thanks!

I would guess that the kilowatt hours consumed energy count from the time the device is paired to the network and counting continuously until the maximum value of the internal number format is reached.
I would guess that you can reset the value by removing and re adding the device to the network.

Where the units come from internally in openhab I don’t know

Hello guys,
I just installed some xiaomi zigbee wall plug (without neutral wire) and it only work sometimes. Rules are triggered, status is changed, but light does not turn. Here is the items file

Group All
Group gLights           <light>         (All)
Group gOutdoorLight     <outdoorlight>  (gLights)

// Xiaomi Gateway
Switch XMGateway_LightSwitch "Gateway Light []" <light> { channel="mihome:gateway:7811dcb226c5:brightness" }
Dimmer XMGateway_Brightness "Gateway Brightness [%d %%]" <dimmablelight> [ "Lighting" ] { channel="mihome:gateway:7811dcb226c5:brightness" }
Color XMGateway_Color "Color" <rgb> { channel="mihome:gateway:7811dcb226c5:color" }
Dimmer XMGateway_ColorTemperature <heating> { channel="mihome:gateway:7811dcb226c5:colorTemperature" }
Number XMGateway_AmbientLight <sun> { channel="mihome:gateway:7811dcb226c5:illumination" }
Number XMGateway_Sound "Play Sound" <soundvolume-0> { channel="mihome:gateway:7811dcb226c5:sound" }
Switch XMGateway_SoundSwitch <soundvolume_mute> { channel="mihome:gateway:7811dcb226c5:enableSound" }
Dimmer XMGateway_SoundVolume "Volume [%d %%]" <soundvolume> { channel="mihome:gateway:7811dcb226c5:volume" }

// Xiaomi Aqara Mains Powered Wall Switch 1
Switch Light_outdoor_1 "Lampu Belakang" <light> (gOutdoorLight) [ "Lighting" ] { channel="mihome:ctrl_neutral1:158d0001f503dc:ch1" }

// Xiaomi Aqara Mains Powered Wall Switch 2
Switch Light_outdoor_2 "Lorong garasi" <light> (gOutdoorLight) [ "Lighting" ] { channel="mihome:ctrl_neutral2:158d0001f4fb29:ch1" }
Switch Light_outdoor_3 "Belakang pantry" <light> (gOutdoorLight) [ "Lighting" ] { channel="mihome:ctrl_neutral2:158d0001f4fb29:ch2" }
// Xiaomi Aqara Mains Powered Wall Switch 2
Switch Light_outdoor_4 "Taman depan" <light> (gOutdoorLight) [ "Lighting" ] { channel="mihome:ctrl_neutral2:158d0001f4d6a1:ch1" }
Switch Light_outdoor_5 "Outdoor Light5" <light> (gOutdoorLight) [ "Lighting" ] { channel="mihome:ctrl_neutral2:158d0001f4d6a1:ch2" }
// Xiaomi Aqara Mains Powered Wall Switch 2
Switch Light_outdoor_6 "Depan pagar" <light> (gOutdoorLight) [ "Lighting" ] { channel="mihome:ctrl_neutral2:158d0001f4fb55:ch1" }
Switch Light_outdoor_7 "LED pagar samping" <light> (gOutdoorLight) [ "Lighting" ] { channel="mihome:ctrl_neutral2:158d0001f4fb55:ch2" }
// Xiaomi Aqara Mains Powered Wall Switch 2
Switch Light_outdoor_8 "Teras depan" <light> (gOutdoorLight) [ "Lighting" ] { channel="mihome:ctrl_neutral2:158d0001f4c141:ch1" }
Switch Light_outdoor_9 "Depan garasi" <light> (gOutdoorLight) [ "Lighting" ] { channel="mihome:ctrl_neutral2:158d0001f4c141:ch2" }

and this is the log of working state and not working state. I define working by the existence of line like this that actually change the lamp state.

mihome_ctrl_neutral2_158d0001f4c141_ch1 changed from OFF to ON

2018-03-06 18:19:00.014 [vent.ChannelTriggeredEvent] - astro:sun:plus10:nauticDusk#event triggered START

2018-03-06 18:19:00.030 [vent.ChannelTriggeredEvent] - astro:sun:minus15:astroDusk#event triggered START

2018-03-06 18:19:00.038 [vent.ChannelTriggeredEvent] - astro:sun:minus15:nauticDusk#event triggered END

2018-03-06 18:19:00.046 [vent.ChannelTriggeredEvent] - astro:sun:plus10:civilDusk#event triggered END

2018-03-06 18:24:00.006 [vent.ChannelTriggeredEvent] - astro:sun:minus10:astroDusk#event triggered START

2018-03-06 18:24:00.010 [vent.ChannelTriggeredEvent] - astro:sun:minus10:nauticDusk#event triggered END

2018-03-06 18:24:00.544 [vent.ItemStateChangedEvent] - Light_outdoor_8 changed from ON to OFF

2018-03-06 18:24:00.558 [vent.ItemStateChangedEvent] - mihome_ctrl_neutral2_158d0001f4c141_ch1 changed from ON to OFF

2018-03-06 18:24:05.301 [vent.ItemStateChangedEvent] - Light_outdoor_8 changed from OFF to ON

2018-03-06 18:24:05.310 [vent.ItemStateChangedEvent] - mihome_ctrl_neutral2_158d0001f4c141_ch1 changed from OFF to ON

2018-03-06 18:27:49.218 [vent.ItemStateChangedEvent] - Light_outdoor_8 changed from ON to OFF

2018-03-06 18:27:49.224 [vent.ItemStateChangedEvent] - mihome_ctrl_neutral2_158d0001f4c141_ch1 changed from ON to OFF

2018-03-06 18:27:51.947 [vent.ItemStateChangedEvent] - mihome_ctrl_neutral2_158d0001f4c141_ch1 changed from OFF to ON

2018-03-06 18:27:51.951 [vent.ItemStateChangedEvent] - Light_outdoor_8 changed from OFF to ON

2018-03-06 18:32:01.483 [vent.ItemStateChangedEvent] - Light_outdoor_3 changed from ON to OFF

2018-03-06 18:32:01.488 [vent.ItemStateChangedEvent] - mihome_ctrl_neutral2_158d0001f4fb29_ch2 changed from ON to OFF

2018-03-06 18:32:12.898 [vent.ItemStateChangedEvent] - Light_outdoor_3 changed from OFF to ON

2018-03-06 18:32:12.917 [vent.ItemStateChangedEvent] - mihome_ctrl_neutral2_158d0001f4fb29_ch2 changed from OFF to ON

2018-03-06 18:32:36.390 [vent.ItemStateChangedEvent] - Light_outdoor_1 changed from ON to OFF

2018-03-06 18:32:36.394 [vent.ItemStateChangedEvent] - mihome_ctrl_neutral1_158d0001f503dc_ch1 changed from ON to OFF

2018-03-06 18:34:00.017 [vent.ChannelTriggeredEvent] - astro:sun:home:astroDusk#event triggered START

2018-03-06 18:34:00.028 [vent.ChannelTriggeredEvent] - astro:sun:home:nauticDusk#event triggered END

2018-03-06 18:34:38.438 [vent.ItemStateChangedEvent] - Light_outdoor_3 changed from ON to OFF

2018-03-06 18:34:38.443 [vent.ItemStateChangedEvent] - mihome_ctrl_neutral2_158d0001f4fb29_ch2 changed from ON to OFF

2018-03-06 18:34:40.595 [vent.ItemStateChangedEvent] - Light_outdoor_3 changed from OFF to ON

2018-03-06 18:34:40.604 [vent.ItemStateChangedEvent] - mihome_ctrl_neutral2_158d0001f4fb29_ch2 changed from OFF to ON

2018-03-06 18:37:42.767 [vent.ItemStateChangedEvent] - Light_outdoor_7 changed from ON to OFF

2018-03-06 18:37:42.772 [vent.ItemStateChangedEvent] - mihome_ctrl_neutral2_158d0001f4fb55_ch2 changed from ON to OFF

2018-03-06 18:37:43.742 [vent.ItemStateChangedEvent] - Light_outdoor_7 changed from OFF to ON

2018-03-06 18:37:43.754 [vent.ItemStateChangedEvent] - mihome_ctrl_neutral2_158d0001f4fb55_ch2 changed from OFF to ON

2018-03-06 18:38:57.399 [vent.ItemStateChangedEvent] - Light_outdoor_1 changed from OFF to ON

2018-03-06 18:38:57.407 [vent.ItemStateChangedEvent] - mihome_ctrl_neutral1_158d0001f503dc_ch1 changed from OFF to ON

2018-03-06 18:43:00.008 [vent.ChannelTriggeredEvent] - astro:sun:minus15:astroDusk#event triggered END

2018-03-06 18:43:00.015 [vent.ChannelTriggeredEvent] - astro:sun:minus15:eveningNight#event triggered START

2018-03-06 18:43:00.020 [vent.ChannelTriggeredEvent] - astro:sun:minus15:night#event triggered START

2018-03-06 18:44:00.007 [vent.ChannelTriggeredEvent] - astro:sun:plus10:nauticDusk#event triggered END

2018-03-06 18:44:00.019 [vent.ChannelTriggeredEvent] - astro:sun:plus10:astroDusk#event triggered START

2018-03-06 18:48:00.016 [vent.ChannelTriggeredEvent] - astro:sun:minus10:eveningNight#event triggered START

2018-03-06 18:48:00.030 [vent.ChannelTriggeredEvent] - astro:sun:minus10:astroDusk#event triggered END

2018-03-06 18:48:00.038 [vent.ChannelTriggeredEvent] - astro:sun:minus10:night#event triggered START

2018-03-06 18:58:00.009 [vent.ChannelTriggeredEvent] - astro:sun:home:eveningNight#event triggered START

2018-03-06 18:58:00.018 [vent.ChannelTriggeredEvent] - astro:sun:home:astroDusk#event triggered END

2018-03-06 18:58:00.024 [vent.ChannelTriggeredEvent] - astro:sun:home:night#event triggered START

2018-03-06 19:08:00.020 [vent.ChannelTriggeredEvent] - astro:sun:plus10:night#event triggered START

2018-03-06 19:08:00.028 [vent.ChannelTriggeredEvent] - astro:sun:plus10:astroDusk#event triggered END

2018-03-06 19:08:00.032 [vent.ChannelTriggeredEvent] - astro:sun:plus10:eveningNight#event triggered START

2018-03-06 19:21:59.318 [ome.event.ItemCommandEvent] - Item 'Light_outdoor_5' received command OFF

2018-03-06 19:21:59.330 [vent.ItemStateChangedEvent] - Light_outdoor_5 changed from ON to OFF

2018-03-06 19:22:04.914 [ome.event.ItemCommandEvent] - Item 'Light_outdoor_8' received command OFF

2018-03-06 19:22:04.932 [vent.ItemStateChangedEvent] - Light_outdoor_8 changed from ON to OFF

2018-03-06 19:22:08.688 [ome.event.ItemCommandEvent] - Item 'Light_outdoor_7' received command OFF

2018-03-06 19:22:08.698 [vent.ItemStateChangedEvent] - Light_outdoor_7 changed from ON to OFF

2018-03-06 19:22:12.433 [ome.event.ItemCommandEvent] - Item 'Aircon_SF_Masterbed_power' received command ON

2018-03-06 19:22:12.503 [vent.ItemStateChangedEvent] - Aircon_SF_Masterbed_power changed from NULL to ON

2018-03-06 19:22:18.645 [ome.event.ItemCommandEvent] - Item 'BroadlinkRM3_SF_Master' received command Aircon_SF_Masterbed_power_ON

2018-03-06 19:22:23.588 [ome.event.ItemCommandEvent] - Item 'Aircon_SF_Masterbed_power' received command OFF

2018-03-06 19:22:23.600 [vent.ItemStateChangedEvent] - Aircon_SF_Masterbed_power changed from ON to OFF

2018-03-06 19:22:23.614 [ome.event.ItemCommandEvent] - Item 'BroadlinkRM3_SF_Master' received command Aircon_SF_Masterbed_power_OFF

2018-03-06 19:22:32.844 [ome.event.ItemCommandEvent] - Item 'Aircon_SF_Masterbed_fan' received command low

2018-03-06 19:22:32.877 [vent.ItemStateChangedEvent] - Aircon_SF_Masterbed_fan changed from medium to low

2018-03-06 19:22:32.921 [vent.ItemStateChangedEvent] - Aircon_SF_Masterbed_power changed from OFF to ON

2018-03-06 19:22:32.926 [ome.event.ItemCommandEvent] - Item 'BroadlinkRM3_SF_Master' received command 18low1

2018-03-06 19:22:37.035 [ome.event.ItemCommandEvent] - Item 'Aircon_SF_Masterbed_power' received command OFF

2018-03-06 19:22:37.047 [vent.ItemStateChangedEvent] - Aircon_SF_Masterbed_power changed from ON to OFF

2018-03-06 19:22:37.062 [ome.event.ItemCommandEvent] - Item 'BroadlinkRM3_SF_Master' received command Aircon_SF_Masterbed_power_OFF

2018-03-06 19:22:43.918 [ome.event.ItemCommandEvent] - Item 'Aircon_SF_Masterbed_swing' received command 1

2018-03-06 19:22:43.968 [vent.ItemStateChangedEvent] - Aircon_SF_Masterbed_power changed from OFF to ON

2018-03-06 19:22:43.974 [ome.event.ItemCommandEvent] - Item 'BroadlinkRM3_SF_Master' received command 18low1

2018-03-06 19:22:46.117 [ome.event.ItemCommandEvent] - Item 'Aircon_SF_Masterbed_power' received command OFF

2018-03-06 19:22:46.127 [vent.ItemStateChangedEvent] - Aircon_SF_Masterbed_power changed from ON to OFF

2018-03-06 19:22:46.136 [ome.event.ItemCommandEvent] - Item 'BroadlinkRM3_SF_Master' received command Aircon_SF_Masterbed_power_OFF

2018-03-06 19:38:31.368 [hingStatusInfoChangedEvent] - 'broadlink:rm3:34-ea-34-40-a4-18' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Could not control device at IP address 192.168.123.57

2018-03-06 19:39:01.375 [hingStatusInfoChangedEvent] - 'broadlink:rm3:34-ea-34-40-a4-18' changed from OFFLINE (COMMUNICATION_ERROR): Could not control device at IP address 192.168.123.57 to ONLINE

2018-03-06 21:19:00.029 [vent.ChannelTriggeredEvent] - astro:moon:home:rise#event triggered START

==> /var/log/openhab2/openhab.log <==

2018-03-07 10:36:59.206 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'xm.things' is either empty or cannot be parsed correctly!

==> /var/log/openhab2/events.log <==

2018-03-08 13:06:57.805 [ome.event.ItemCommandEvent] - Item 'Light_outdoor_7' received command ON

2018-03-08 13:06:57.828 [vent.ItemStateChangedEvent] - Light_outdoor_7 changed from OFF to ON

2018-03-08 13:07:05.802 [ome.event.ItemCommandEvent] - Item 'Light_outdoor_7' received command OFF

2018-03-08 13:07:05.833 [vent.ItemStateChangedEvent] - Light_outdoor_7 changed from ON to OFF

Nothing is changed between working and not working state. What is the possible cause of this? Thanks in advance

Hi, I am new here in the community. I got a Xiaomi gateway, have multiple door contacts, multiple motion sensors and smart switches. all the round Versions (non aqara). I also have a few humidity/temperature sensors working.

My issue is, I get everything working in Openhab but with some limitations.
First of all I am on gateway firmware 1.3.1_140.0143, the next offered firmware in the app is 1.3.1_141.0143. I am not able to upgrade it. I tried different wifi channels, different phones (iOS/Android), reset the gateway more than once, tried different wifis… nothing. It always start the download/update process and then fails in the end while the gateway turns off. Very frustrating. i dont know if I really need that update for the full functionality on openhab.

In the Xiaomi app I can control still everything but the point is to get it completly running in openhab. The Gateway cannot be controlled by openhab, no colors, sounds, nothing. But it shows online and all sub devices are connected and online. The problem is, my door switches and motion sensors are working fine, besides that the door contacts go in undef after like two minutes in status open (I fixed that quick and dirty with a rule), but dont show me the battery level values. That would be an important feature for me in my alarm system. Has that to do with the failing gateway updates? Or do I need to get any of the manual files set up (sitemaps, rules, items…) I wrote my own rules for interacting with my Osram switches etc. Sitemaps or Items i didn’t manually set up. I use the PaperUi Binding.

Has anybody any suggestions for me? I am not a developer though, just getting started with openhab. Thanks in advance!

I don’t know if it is related directly, but I also had a case at the start of my project where openHab could see my smart plug, and see its status, but couldn’t control it.
If I remember correctly, it was a bug, that I fixed by manually adding an updated version of the Xiaomi binding. Can’t remember where I got it, I’m sure someone else here can assist. In the meantime I’ll see if I can find it.

I noticed my Gateways are on version 1.4.1_153.

I will ask a stupid question, just to make sure. You did remember to activate the developer mode on your Xiaomi app for the Gateways? Then copied the code to the bridge-gateway on PaperUI?
If I remember correctly, you can’t control the gateways if you don’t activate developer mode (among other things).

The developer mode is activated. I also copied the code to the corresponding field im paperui. I tried to change that code multiple times. No success in controlling the gateway features.

Hey @WeirdlyChosen!
Did you notice, that you have two items for the same channel?
mihome_ctrl_neutral2_158d0001f4c141_ch1 is one item, Light_outdoor_8 is another.
They are both connected to the channel mihome:ctrl_neutral2:158d0001f4c141:ch1

Please enable the debug log and check if you are able to write commands to the switches and that your developer key works.
If the key is not correct, then in the debug log you get the answer from the gateway, telling you the key is wrong :slight_smile:

It seems like the devices are reporting correctly but OH is not able to write the command to them.
You are right, if you send the command to Light_outdoor_8, mihome_ctrl_neutral2_158d0001f4c141_ch1 should be changed too - Light_outdoor_8 changes just because of the command itself.