CGH1 Sensor in Home Assistant. Cannot see them

Hi, i’m Laurent.

i’m using OpenMQTTGateway 0.9.8 with HomeAssistant.
I would like to see with you how to declare a CGH1 sensor in OpenMQTTGateway into my Home Assistant Platform.
i try to remove battery from sensor and starts it again. no change in Home Assistant
i try to open and close my window, no change in Home Assistant
Where can i find some logs files ?

in MQTT Explorer we can see this

{
“id”: “58:2D:34:60:xy:zt”,
“name”: “Qingping Door/Window Sensor”,
“rssi”: -80,
“servicedata”: “3058d603c24a1860342d5808”
}
but cannot understand where open/close information is

Thanks for your support
Laurent

Hi Laurent,

Can you download the QingPing mobile app and add the sensor, disconnect the Bluetooth of your mobile and check if you see different data in MQTT explorer.

Hi Florian,

i added all my sensors through the Xiaomi Home application when i installed them in Home Assistant. All have been recognized thourgh BLE Monitor add on.

i used them into Home Assistant through BLE monitor and i have correct status from them.

When all are closed i have the following :
192.168.20.26
home
OpenMQTTGateway_ESP32_BLE
BTtoMQTT
582D3460184A = {“id”:“58:2D:34:60:18:4A”,“name”:“Qingping Door/Window Sensor”,“rssi”:-83,“servicedata”:“3058d603104a1860342d5808”}
582D34600867 = {“id”:“58:2D:34:60:08:67”,“name”:“Qingping Door/Window Sensor”,“rssi”:-54,“servicedata”:“3058d60352670860342d5808”}
582D34601D58 = {“id”:“58:2D:34:60:1D:58”,“name”:“Qingping Door/Window Sensor”,“rssi”:-70,“servicedata”:“3058d603cc581d60342d5808”}
582D3460087C = {“id”:“58:2D:34:60:08:7C”,“name”:“Qingping Door/Window Sensor”,“rssi”:-70,“servicedata”:“3058d6033c7c0860342d5808”}

When all windows are opened i have the following :
192.168.20.26
home
OpenMQTTGateway_ESP32_BLE
BTtoMQTT
582D34600867 = {“id”:“58:2D:34:60:08:67”,“name”:“Qingping Door/Window Sensor”,“rssi”:-65,“servicedata”:“3058d60309670860342d5808”}
582D3460184A = {“id”:“58:2D:34:60:18:4A”,“name”:“Qingping Door/Window Sensor”,“rssi”:-77,“servicedata”:“3058d6039d4a1860342d5808”}
582D34601D58 = {“id”:“58:2D:34:60:1D:58”,“name”:“Qingping Door/Window Sensor”,“rssi”:-73,“servicedata”:“3058d6037f581d60342d5808”}
582D3460087C = {“id”:“58:2D:34:60:08:7C”,“name”:“Qingping Door/Window Sensor”,“rssi”:-70,“servicedata”:“3058d603f17c0860342d5808”}

i disable bluetooth on my phone.
i disable all sensors in Home Assistant.

After a restart, i got this in MQTT Explorer
192.168.20.26

▼home

▼OpenMQTTGateway_ESP32_BLE

▼BTtoMQTT

582D34601D58 = {“id”:“58:2D:34:60:1D:58”,“name”:“Qingping Door/Window Sensor”,“rssi”:-69,“servicedata”:“3058d6038d581d60342d5808”}

582D3460184A = {“id”:“58:2D:34:60:18:4A”,“name”:“Qingping Door/Window Sensor”,“rssi”:-80,“servicedata”:“3058d603a74a1860342d5808”}

582D34600867 = {“id”:“58:2D:34:60:08:67”,“name”:“Qingping Door/Window Sensor”,“rssi”:-56,“servicedata”:“3058d60315670860342d5808”}

582D3460087C = {“id”:“58:2D:34:60:08:7C”,“name”:“Qingping Door/Window Sensor”,“rssi”:-65,“servicedata”:“3058d603f97c0860342d5808”}

same behavior.

in your ZgatewayBT.ino file, in process_cgh1 function, i don’t undersand “0804”, “8804” etc… values. these values are not present in my Servicedata values

Thanks for you support.
Regards
Laurent.

This may be due to the provisioning of the sensor through the Xiaomi app instead of Qingping app.

Could you try to remove it from Xiaomi app and add it into the Qingping one.
When provisioning the sensor it is configured to a particular format. The Xiaomi one is encrypted but not the Qingping one.

:ok_hand:
Hi Florian,
i used Qingping+ app and proceed as you explained.

works fine. i will prepare later this week or during weekend some text in order to fully described what i’ve done. it may help for someone else.

Thanks a lot for the support
Laurent.

1 Like

Did auto discovery work for you in home assistant? If so we the created entries the right device class? Mine are showing up as generic sensors so they don’t display in a meaningful way out if the box in home assistant.