esphome-components icon indicating copy to clipboard operation
esphome-components copied to clipboard

Xiaomi Mijia Night Light 2 (MJYD02YL) - longer detection time?

Open rwjack opened this issue 2 years ago • 9 comments

Hey, could these components help with having the light detect movement for longer?

Even though I configured the light to stay awake for 60 seconds in the Mi app, it keeps randomly turning off, even when there is movement.

rwjack avatar Dec 01 '23 18:12 rwjack

Could you please share logs?

dentra avatar Dec 07 '23 21:12 dentra

Just to clarify, I haven't configured anything yet because I'm still waiting on an esp32 to use as a BT proxy, but I'm just investigating if this is worth implementing for my use case.

rwjack avatar Dec 08 '23 10:12 rwjack

BT-proxy it is a different story.

Anyway the component acts only on BLE advertisements. So if your device will send them right you will get what you want

dentra avatar Dec 08 '23 11:12 dentra

I think this is what would work: https://esphome.io/components/bluetooth_proxy.html

Just to confirm, if the proxy can forward BLE advertisements to HA, that means I can set the light activation time to longer than 60s via this component?

Although I cannot turn the light on and off manually?

rwjack avatar Dec 08 '23 12:12 rwjack

I got the BT proxy up and running, and connected to the lights using: https://github.com/al-one/hass-xiaomi-miot

Although the integration doesn't expose an option to toggle the lights on or off.

Can your component do so?

rwjack avatar Jan 01 '24 18:01 rwjack

I bought this device and will research it.

dentra avatar Jan 12 '24 21:01 dentra

Any updates, @dentra? I also looked into this and I see that there are some values written on the 00000101-0065-6c62-2e74-6f696d2e696d characteristic when turning the light on or off:

OFF: 0d00891914aed72db5b0
ON:  0e006d7f8326c7edae48

and in another session:

OFF: 0d00c0220da32b2e2b8f
ON:  0e004c308167a88e0fba

It seems that the first two bytes are some kind of counter, but the rest differs a lot which makes me think there is some kind of encryption/scrambling.

ov1d1u avatar Jan 29 '24 11:01 ov1d1u

It is not possible to control on/off manually. It is only possibly to change interval of reporting via MiHome.

dentra avatar Feb 03 '24 00:02 dentra

@dentra You can control the night light mode through the MiHome app, when you are directly connected to the light:

Screenshot_20240205_112808_Mi Home

ov1d1u avatar Feb 05 '24 09:02 ov1d1u

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 10 '24 22:04 stale[bot]