Open p0macs opened 6 months ago
When I enable debug log, I can see messages like: Got new state: {'motion_sensor.motion_state': True, 'state_updater': 'cloud'}
but the sensor state is not updated in HA
Rolled back to 0.7.13 - and the motion detection works again.
The exact same thing happens to me. In version 0.7.13 working motion sensors. When updating to 0.7.14 they have stopped working.
It must be a generalized failure.
I went back to 0.7.13 and they are working again.
Checked 2 times. Version 0.7.13 works perfectly with my motion sensors, version 0.7.14 does not. My sensors are these lumi.sensor_motion.v2 por lumi see the photo:
Looking at the debug logs, I can see this.
In version 0.7.14 - about every 15 seconds the following command is executed:
2023-12-19 19:05:07.051 DEBUG (SyncWorker_17) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: miotspec/prop/get {'params': [{'did': 'lumi.158d0003e809da', 'siid': 2, 'piid': 1}]} result: bytearray(b'{"code":0,"message":"ok","result":[{"did":"lumi.158d0003e809da","iid":"0.2.1","siid":2,"piid":1,"value":true,"code":0,"updateTime":1703009058,"exe_time":0}]}')
In version 0.7.13, about every 15 second the similar command is executed as above, later on followed by a second command:
2023-12-19 22:05:17.269 DEBUG (SyncWorker_25) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: miotspec/prop/get {'params': [{'did': 'lumi.158d0003e809da', 'siid': 2, 'piid': 1}]} result: bytearray(b'{"code":0,"message":"ok","result":[{"did":"lumi.158d0003e809da","iid":"0.2.1","siid":2,"piid":1,"value":true,"code":0,"updateTime":1703019838,"exe_time":0}]}')
2023-12-19 22:05:17.601 DEBUG (SyncWorker_8) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot api: user/get_user_device_data {'did': 'lumi.158d0003e809da', 'key': 'device_log', 'ty pe': 'prop', 'time_start': 1702760717, 'time_end': 1703019977, 'limit': 1} result: bytearray(b'{"code":0,"message":"ok","result":[{"uid":"1857406299","did":"lumi.158d0003e809da","type":"prop","v alue":"[\\"[1703019718,[\\\\\\"event.motion\\\\\\",[]]]\\"]","time":1703019718,"key":"device_log"}]}')
So, in 0.7.13 - two command are executed:
In 0.7.14 the user/get_user_device_data is never executed for this sensor.
Because of breaking changes in HA 2024.1 - I had to update the integration to 0.7.15 - and my sensors are not detecting motion again. Please, check it. (I cannot use 0.7.13 version anymore, because all the temperature sensors are not working in HA 2024.1)
Indeed, I have upgraded to HA 2024.1 with 0.7.13 and the humidity and temperature sensors have stopped working. I have exactly the same problem as you.
HA 2024.1 + Xiaomi Miot 0.7.13 -> Humidity and temperature sensors not working HA 2024.1 + Xiaomi Miot 0.7.14 -> Motion sensors not working HA 2024.1 + Xiaomi Miot 0.7.15 -> Motion sensors not working
HA 2023.12 + Xiaomi Miot 0.7.13 -> Everything OK
OK, found a workaround. The only change related to the motion sensor in 0.7.14 (and 0.7.15) was that the lumi.sensor_motion.v2 was added to the MIOT_LOCAL_MODELS collection in the miot_local_devices.py file. Looks like the motion sensor cannot detect motion when handled as a local device, only when it is a cloud device. I made following:
After that, the motion sensor is detecting motions again. No restart is required. I did this for my other motion sensors as well.
If you can edit the configuration.yaml file, it is probably easier to customize the model:
# Customize via device model
xiaomi_miot:
# https://github.com/al-one/hass-xiaomi-miot/blob/master/custom_components/xiaomi_miot/core/device_customizes.py
device_customizes:
lumi.sensor_motion.v2:
miot_cloud: true
I don't know what was the intention to move this device to the local devices. Of course, it would be better to detect motion without the cloud, but looks like it is not working on this model.
Reading your post I have seen then there is a simple solution and explanation.
I have updated HA to the latest version 2024.1.1 as well as the Xiaomi Miot Auto to version 0.7.15.
HA 2024.1.1 + Xiaomi Miot 0.7.15 -> Motion sensors not working. Humidity and temperature sensors working OK
The motion sensors are not working, but by performing this configuration they have all started working again:
I think this is the perfect solution, as it allows you to upgrade HA and Xiaomi Miot Auto to new versions and have your motion sensors always working.
It is also a solution that is applied in 10 seconds for all your sensors and you don't need to know programming since it is applied at the click of a mouse.
Once configured, if you click on configure again, you can no longer change the parameters, you can only view them.
If we want to make any changes we must delete and create it from 0.
This same configuration can be used to force a device to always work under the cloud and not to use it on the local network. For example, if you have a sensor hanging from another network that is not the same as the one in which home asisstant is located and you want to integrate it, you can choose that a certain entity is always used with the cloud.
I also experience same issue when no motion detected, once I switch to cloud configuration, then motion sensor is working but other 2 seonsors which worked on local (no duration and illimination) now not working local
cloud
Does anyone else experience same behavior? I don't know what version of miiot I'm using but I installed HA 2024.1.6 last week, so I'd imagine it's latest versions.
have you configured only the motion sensor in cloud leaving the rest in local? or did you switch all of them to cloud?
I just reconfigured this one device to use cloud config, are you saying I need to reconfigure only one motion sensor to be cloud and other two sensors should stay local? sorry I'm new in HA and yes some discussion in this thread with configurations examples wasn't very clear for me.
Exactly, first you configure the normal application in automatic to be able to work in cloud and local. and then look at my post and just add to the motion sensor the feature that only that sensor works in cloud leaving the rest to work automatically.
Thank you @javifly, used customize option and now it's working, but lost no duration sensor for one of my devices, but that's story for another time, thank you for help and quick assistance
I use a customization for a few devices to work from the cloud, but it doesn't affect the rest.
Device model / 设备型号
lumi.sensor_motion.v2
Component version / 插件版本
0.7.14
HA core version / HA版本
2023.12.3
Integrated mode / 集成方式
Automatic (自动模式)
The problem / 问题详情
The motion sensors were detected motion before the 0.7.14 update, but they are not detecting anymore.
Entity attributes / 实体属性
Model lumi.sensor_motion.v2 Lan IP MAC address lumi.158d0003e80af4 Entity class LumiBinarySensorEntity Home room OurHome Nappali Miot type urn:miot-spec-v2:device:motion-sensor:0000A014:lumi-v2:2 Motion sensor.motion state false State updater cloud State property motion_sensor.motion_state
Home Assistant Logs / 系统日志
2023-12-19 19:06:22.011 DEBUG (MainThread) [custom_components.xiaomi_miot.binary_sensor] Bejárat(lumi.sensor_motion.v2): Got new state: {'motion_sensor.motion_state': True, 'state_updater': 'cloud'}