Mi(Xiaomi) Smart home bindings?

There is an event for the creation and then it sends the temperature but only once (when created)
After that, there is no mention of the sensor anymore in the logs.

12:07:58.715 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘mihome:sensor_weather_v1:158d0002272e1b’ changed from INITIALIZING to ONLINE
12:08:34.003 [INFO ] [thome.event.ItemChannelLinkAddedEvent] - Link ‘LivingRoom_TemperatureHumiditySensorTemperature_Decimal-mihome:sensor_weather_v1:158d0002272e1b:temperature’ has been added.
12:08:34.023 [INFO ] [smarthome.event.ItemStateChangedEvent] - LivingRoom_TemperatureHumiditySensorTemperature_Decimal changed from 17.559999465942383 to 19.969999313354492

That’s strange. Do you see updates in the miHome app? And what gateway do you use?

I have the Xiaomi Gateway V3 and 2 Aqara Temperature and Humidity sensors.
As for the MiHome App, I can see the temperature and it updates if I pull down to refresh.

I have the same hardware and they send updates regularly (not in distinct intervals but at least every 15mins or so) and they send them also with small increments… you don’t get any other entries in the logs? check openhab.logs also?

Have you checked if the non-GUI updates do work in the background?
Maybe create a rule on a temperature change that logs something.

If this doesn’t show anything, then set loglevel for the Xiaomi to debug and check if heartbeats come in (the binding should receive a datagram from each gateway every ten seconds, and on each update).

Thanks.
I have checked the logs. There is nothing regarding temperature or humidity change in neither openhab.logs nor events.logs.
I am not familiar with rules and config files. I will check how to set loglevel and create a rule to print log when value change and see if I have more infos.

If your link to gateway is correct - this is Xiaomi Gateway V2…

Login to the Karaf console and set the loglevel to DEBUG:

  1. SSH to your Pi
  2. ssh openhab@localhost -p 8101 (pass: habopen)
  3. type in the Karaf console log:set DEBUG org.openhab.binding.mihome

then you should have the “heartbeat” of the Gateway in the logs - perhaps there’s more infos.
after that you can log:set INFO org.openhab.binding.mihome again.

Thanks @binderth

To have a clean installation, I have removed one of my sensor from OH and from the MiHome app and re-added it.
I have also set the loglevel to DEBUG
Here is what I have :

21:31:23.320 [DEBUG] [ng.mihome.handler.XiaomiBridgeHandler] - Device 158d0002272e1b honored read request
21:31:23.325 [DEBUG] [.discovery.XiaomiItemDiscoveryService] - Detected Xiaomi smart device - sid: 158d0002272e1b model: weather.v1
21:31:23.353 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing ‘mihome:sensor_weather_v1:158d0002272e1b’ to inbox.
21:31:23.356 [INFO ] [smarthome.event.InboxAddedEvent ] - Discovery Result with UID ‘mihome:sensor_weather_v1:158d0002272e1b’ has been added.
21:31:46.694 [INFO ] [smarthome.event.InboxRemovedEvent ] - Discovery Result with UID ‘mihome:sensor_weather_v1:158d0002272e1b’ has been removed.
21:31:46.731 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘mihome:sensor_weather_v1:158d0002272e1b’ changed from UNINITIALIZED to INITIALIZING
21:31:46.733 [DEBUG] [ng.mihome.handler.XiaomiBridgeHandler] - Adding item listener for device 158d0002272e1b
21:31:46.733 [DEBUG] [ng.mihome.handler.XiaomiBridgeHandler] - Having 2 Item listeners
21:31:46.746 [INFO ] [ome.event.ThingStatusInfoChangedEvent] - ‘mihome:sensor_weather_v1:158d0002272e1b’ changed from INITIALIZING to ONLINE
21:31:46.750 [DEBUG] [ihome.handler.XiaomiDeviceBaseHandler] - Device 158d0002272e1b on channel mihome:sensor_weather_v1:158d0002272e1b:humidity received command REFRESH
21:31:46.750 [DEBUG] [ihome.handler.XiaomiDeviceBaseHandler] - Device 158d0002272e1b on channel mihome:sensor_weather_v1:158d0002272e1b:temperature received command REFRESH
21:31:46.772 [DEBUG] [ihome.handler.XiaomiDeviceBaseHandler] - Update Item 158d0002272e1b with retented message
21:31:46.774 [DEBUG] [ihome.handler.XiaomiDeviceBaseHandler] - Item got update: {“cmd”:“read_ack”,“model”:“weather.v1”,“sid”:“158d0002272e1b”,“short_id”:6929,“data”:“{"voltage":2905,"temperature":"2180","humidity":"10000","pressure":"101440"}”}
21:32:49.685 [DEBUG] [ihome.handler.XiaomiDeviceBaseHandler] - Device 158d0002272e1b on channel mihome:sensor_weather_v1:158d0002272e1b:temperature received command REFRESH
21:32:49.689 [INFO ] [thome.event.ItemChannelLinkAddedEvent] - Link ‘LivingRoom_Sensor_Temperature-mihome:sensor_weather_v1:158d0002272e1b:temperature’ has been added.
21:33:07.112 [DEBUG] [ihome.handler.XiaomiDeviceBaseHandler] - Device 158d0002272e1b on channel mihome:sensor_weather_v1:158d0002272e1b:humidity received command REFRESH
21:33:07.112 [INFO ] [thome.event.ItemChannelLinkAddedEvent] - Link ‘LivingRoom_Sensor_Humidity-mihome:sensor_weather_v1:158d0002272e1b:humidity’ has been added.

This was a little bit more than 30 minutes ago. I have hold and released the sensor from my hand to see if temperature change would trigger something but since these logs, there is no mention of the Sensor.

@shabbab I have created 2 rules : 1 for my light and 1 for the sensor. (they are identical, the light one was to see if I wrote the rule correctly). The light one keeps triggering infos but the sensor one does not.
Here is the rule I have created

rule "Temp"
when
    Item LivingRoom_Sensor_Temperature received update
then
    logInfo("temp.rules", "LivingRoom: Temperature: " + LivingRoom_Sensor_Temperature.state)
end

And here is the output

21:40:50.962 [INFO ] [del.core.internal.ModelRepositoryImpl] - Refreshing model ‘temp.rules’
21:40:55.970 [INFO ] [org.quartz.core.QuartzScheduler ] - Scheduler openHAB-job-scheduler_$_NON_CLUSTERED started.

Nothing since then :confused:

I see you have successfully set the Xiaomi loglevel to debug, but there are no heartbeats in the logfile.
You should see one debug log sentence every ten seconds.

If there really is no constant flow of messages every ten seconds (or more often) this means you are not receiving the multicast data.

Look at my post a few days back, depending on your network topology you may have similar issues.
A fix (for my situation) is in the followup post

BTW: The routing table fix is active for a day now, seems to work reliably.

Note 1 : I am currently running OH on a MacBook as I wanted to test it before buying a RPi.
Note 2 : My mac does not have an ethernet plug.

I have also run tcpdump and it seems my mac receives the heartbeats every 10 secondes.

$sudo tcpdump host 192.168.1.24
tcpdump: data link type PKTAP
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on pktap, link-type PKTAP (Apple DLT_PKTAP), capture size 262144 bytes
23:27:05.938400 IP 192.168.1.24.rwhois > 224.0.0.50.monkeycom: UDP, length 135
23:27:14.983930 IP 192.168.1.24.mdns > 224.0.0.251.mdns: 0*- [0q] 4/0/0 (Cache flush) A 192.168.1.24, (Cache flush) SRV lumi-gateway-v3_miio78809413.local.:54321 0 0, PTR lumi-gateway-v3_miio78809413._miio._udp.local., (Cache flush) TXT “epoch=1” “mac=7811dcb7b4eb” (318)
23:27:15.180464 IP 192.168.1.24.mdns > 224.0.0.251.mdns: 0*- [0q] 4/0/0 (Cache flush) A 192.168.1.24, (Cache flush) SRV lumi-gateway-v3_miio78809413.local.:54321 0 0, PTR lumi-gateway-v3_miio78809413._miio._udp.local., (Cache flush) TXT “epoch=1” “mac=7811dcb7b4eb” (318)
23:27:15.377105 IP 192.168.1.24.mdns > 224.0.0.251.mdns: 0*- [0q] 4/0/0 (Cache flush) A 192.168.1.24, (Cache flush) SRV lumi-gateway-v3_miio78809413.local.:54321 0 0, PTR lumi-gateway-v3_miio78809413._miio._udp.local., (Cache flush) TXT “epoch=1” “mac=7811dcb7b4eb” (318)
23:27:15.965500 IP 192.168.1.24.rwhois > 224.0.0.50.monkeycom: UDP, length 135
23:27:25.992611 IP 192.168.1.24.rwhois > 224.0.0.50.monkeycom: UDP, length 135
23:27:36.019514 IP 192.168.1.24.rwhois > 224.0.0.50.monkeycom: UDP, length 135
23:27:45.849963 IP 192.168.1.24.rwhois > 224.0.0.50.monkeycom: UDP, length 135
23:27:55.877169 IP 192.168.1.24.rwhois > 224.0.0.50.monkeycom: UDP, length 135
23:28:05.904152 IP 192.168.1.24.rwhois > 224.0.0.50.monkeycom: UDP, length 135
23:28:15.931112 IP 192.168.1.24.rwhois > 224.0.0.50.monkeycom: UDP, length 135
23:28:25.958160 IP 192.168.1.24.rwhois > 224.0.0.50.monkeycom: UDP, length 135
23:28:35.788674 IP 192.168.1.24.rwhois > 224.0.0.50.monkeycom: UDP, length 135

However, I have tried to run the command you put in your post :

sudo route add 224.0.0.0 192.168.1.27 -netmask 224.0.0.0

Which is a mac/bsd version of the command you used (192.168.1.27 being my mac ip)

However, I don’t see any change in the logs, even after restarting OH :frowning:

testing is best done in a RPi! :wink: especially, if you like to run oh2 on that platform
I suggest, you start with openHABian - you can always paste your existing files to the new installation.

What startles me, that there are no more heartbeats reaching OH2 - but my guess is, your MAC firewall filters those.

I have disabled the Mac firewall but that di not solve the problem.

However, I just bought a RPi 3B. I will install openHABian when I receive it (in about 3 weeks).
I will let you know if it solves the issue :slight_smile:

Perhaps your router blocks them? I know nothing on Macs, but I assume, they should be able to receive UDP packets… :grin:

Edit: I forgot your tcdump… Then perhaps the problem lies in oh2 runtime on MacOS… I have no clue on that.

Hi to all

i am trying to showing up my xiaomi windows sensor in my apple homekit but i am unable to find tags for this
xiaomi string:
Contact WindowSwitch_Status { channel=“mihome:sensor_magnet::isOpen” }
but i do no know or [“door”] or what ever is working
also i am unable to get working xiaomi gateway lamp
i have it in my homekit app but i am unable to turn it in or off
but when i turn it on from xiaomi app they show up like turned on in homekit app

it seems that xiaomi lamp is unable to manage from homekit

do you have any experiences with xiaomi integration ?

thanks

If I understand you correctly (do not know English):

That’s no specialty of a specific binding. The tags you can use are listed in the docs - along with the supported item types:
https://docs.openhab.org/addons/ios/homekit/readme.html

@binderth
thanks i saw this document and that’s mean i am not able to add contact sensor via openhab to homekit ?

@Olymp
i had this string and xiaomi ID
but i am unable to integrated it via homekit bindings
do you have your xiaomi devices working with homekit ?
my xiaomi temerature is fine with this
Number HT_Temperature_studio “Studio temperature” [ “CurrentTemperature” ] { channel=“mihome:sensor_ht:158d0001f4ec83:temperature” }

i never tried Contact, but my guess is, it won’t work: ['Switchable'] will return ON/OFF and not OPEN/CLOSED… you could still try. but there’s definitely no ['Door'] in homekit.

you could either change your item to Switch instead of Contact or you could expose a proxy item as Switch to the homekit and have a rule Change your Contact item accordingly.

I’m sorry, I did not exactly translate your question, I unfortunately do not have a homecit.