Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[miio] Please support Qingping Air Monitor Lite (cgllc.airm.cgdn1) #10152

Closed
joeberlin123 opened this issue Feb 14, 2021 · 12 comments · Fixed by #10182
Closed

[miio] Please support Qingping Air Monitor Lite (cgllc.airm.cgdn1) #10152

joeberlin123 opened this issue Feb 14, 2021 · 12 comments · Fixed by #10182

Comments

@joeberlin123
Copy link

joeberlin123 commented Feb 14, 2021

@marcelrv Please support Qingping Air Monitor Lite (cgllc.airm.cgdn1)

See Miot specs: https://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:air-monitor:0000A008:cgllc-cgdn1:1

And the integration in python-miio for reference
rytilahti/python-miio@78f8bee

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/xiaomi-robot-vacuum-binding/31317/1822

marcelrv added a commit to marcelrv/openhab-addons that referenced this issue Feb 16, 2021
close openhab#10152

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
@marcelrv
Copy link
Contributor

@joeberlin123 Can you download the json file in the linked above repository and save it to your conf/misc/miio folder.
Than restart the binding, the channels should now be visible. See the binding readme for more details on adding local db files if it does not work. Note: this requires a recent OH version (OH3) to see the channels properly.

Can you share a debug log of the refresh and feedback if the channels repond well.

@joeberlin123
Copy link
Author

@marcelrv Thank you very much. It took me a moment to test because I didn't have an OH3 instance yet. In my tests everything worked perfectly. Do you still need debug logfiles then? If so can you please give me a short hint how to create the logfiles with debug level. Thank you very much. Regards Jörg

@marcelrv
Copy link
Contributor

@marcelrv Thank you very much. It took me a moment to test because I didn't have an OH3 instance yet. In my tests everything worked perfectly. Do you still need debug logfiles then? If so can you please give me a short hint how to create the logfiles with debug level. Thank you very much. Regards Jörg

@joeberlin123 Yes please. See the PR

fwolter pushed a commit that referenced this issue Apr 10, 2021
…0182)

* [miio] add support for cgllc.airm.cgdn1 Qingping Air Monitor Lite

close #10152

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove expiremental

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* Improve readme

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] improve qty types

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove unknown element

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
@kovaga
Copy link

kovaga commented Apr 14, 2021

@joeberlin123 Can you download the json file in the linked above repository and save it to your conf/misc/miio folder.
Than restart the binding, the channels should now be visible. See the binding readme for more details on adding local db files if it does not work. Note: this requires a recent OH version (OH3) to see the channels properly.

@marcelrv
Would the binding for the cgdn1 work with OH2?

@marcelrv
Copy link
Contributor

@kovaga this will partially work with OH2.5
You would need to edit it e.g.--> Change the types that have Number:XXX to Number
All the mappings would not work automatically, but if you make them manually (from the examples in the binding readme) than you should have mapped values.
Others... who knows... but I would expect most of it works to some extend. I would say try it, don't worry you won't break anything

@kovaga
Copy link

kovaga commented Apr 14, 2021

@marcelrv I am on 2.5.12-1
So I have downloaded the cgllc.airm.cgdn1-miot.json and placed it in /etc/openhab2/misc/miio, but I dont think its the right place for it, as I am getting the following log entry.
[io.internal.handler.MiIoBasicHandler] - Database entry for model 'cgllc.airm.cgdn1' cannot be found.

Where should I store that json file?

@marcelrv
Copy link
Contributor

Can you restart OH... I expect it display the proper location for your installation in the debug logging

@kovaga
Copy link

kovaga commented Apr 14, 2021

Indeed, it did display the location and in fact picked up the file this time.

2021-04-14 15:40:56.049 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Periodic update for 'miio:basic:cgdn1' (miio:basic)
2021-04-14 15:40:56.049 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Building Channel Structure for miio:basic:cgdn1 - Model: cgllc.airm.cgdn1
2021-04-14 15:40:56.050 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Using device database: /etc/openhab2/misc/miio/cgllc.airm.cgdn1-miot.json for device cgllc.airm.cgdn1
2021-04-14 15:40:56.053 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Current thing channels miio:basic:cgdn1:network#ssid, type: miio:ssid
2021-04-14 15:40:56.053 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Current thing channels miio:basic:cgdn1:network#bssid, type: miio:bssid
2021-04-14 15:40:56.054 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = actions, friendlyName = Actions, type = String, channelType = , ChannelGroup = , channel = actions, property = , refresh = false]
2021-04-14 15:40:56.054 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = relative_humidity, friendlyName = Environment - Relative Humidity, type = Number:Dimensionless, channelType = , ChannelGroup = , channel = relative_humidity, property = relative-humidity, refresh = true]
2021-04-14 15:40:56.054 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = pm2_5_density, friendlyName = Environment - PM2 5 Density, type = Number, channelType = , ChannelGroup = , channel = pm2_5_density, property = pm2.5-density, refresh = true]
2021-04-14 15:40:56.054 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = pm10_density, friendlyName = Environment - PM10 Density, type = Number, channelType = , ChannelGroup = , channel = pm10_density, property = pm10-density, refresh = true]
2021-04-14 15:40:56.054 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = temperature, friendlyName = Environment - Temperature, type = Number:Temperature, channelType = , ChannelGroup = , channel = temperature, property = temperature, refresh = true]
2021-04-14 15:40:56.055 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = co2_density, friendlyName = Environment - CO2 Density, type = Number:Dimensionless, channelType = , ChannelGroup = , channel = co2_density, property = co2-density, refresh = true]
2021-04-14 15:40:56.055 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = battery_level, friendlyName = Battery - Battery Level, type = Number:Dimensionless, channelType = , ChannelGroup = , channel = battery_level, property = battery-level, refresh = true]
2021-04-14 15:40:56.055 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = charging_state, friendlyName = Battery - Charging State, type = Number, channelType = , ChannelGroup = , channel = charging_state, property = charging-state, refresh = true]
2021-04-14 15:40:56.055 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = voltage, friendlyName = Battery - Voltage, type = Number, channelType = , ChannelGroup = , channel = voltage, property = voltage, refresh = true]
2021-04-14 15:40:56.055 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = mac, friendlyName = Mac - Mac, type = String, channelType = , ChannelGroup = , channel = mac, property = mac, refresh = true]
2021-04-14 15:40:56.055 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = start_time, friendlyName = Settings - Start Time, type = Number, channelType = , ChannelGroup = , channel = start_time, property = start-time, refresh = true]
2021-04-14 15:40:56.055 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = end_time, friendlyName = Settings - End Time, type = Number, channelType = , ChannelGroup = , channel = end_time, property = end-time, refresh = true]
2021-04-14 15:40:56.055 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = monitoring_frequency, friendlyName = Settings - Monitoring Frequency, type = Number:Time, channelType = , ChannelGroup = , channel = monitoring_frequency, property = monitoring-frequency, refresh = true]
2021-04-14 15:40:56.056 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = screen_off, friendlyName = Settings - Screen Off, type = Number:Time, channelType = , ChannelGroup = , channel = screen_off, property = screen-off, refresh = true]
2021-04-14 15:40:56.056 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = device_off, friendlyName = Settings - Device Off, type = Number:Time, channelType = , ChannelGroup = , channel = device_off, property = device-off, refresh = true]
2021-04-14 15:40:56.056 [DEBUG] [io.internal.handler.MiIoBasicHandler] - properties [ Channel = tempature_unit, friendlyName = Settings - Tempature Unit, type = String, channelType = , ChannelGroup = , channel = tempature_unit, property = tempature-unit, refresh = true]
2021-04-14 15:40:56.056 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Current thing channels added: 16

However it is unable to get the values

2021-04-14 15:43:41.183 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Periodic update for 'miio:basic:cgdn1' (miio:basic)
2021-04-14 15:43:41.183 [DEBUG] [internal.handler.MiIoAbstractHandler] - Skipping periodic update for 'miio:basic:cgdn1'. Thing Status CONFIGURATION_ERROR
2021-04-14 15:43:41.183 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":19,"method":"miIO.info","params":[]} -> 192.168.9.148 (Device: 0793XXXX token: 7746785AXXXXXXXXXXXXXXXX4F72XXXX Queue: 8)
2021-04-14 15:43:41.679 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Communication error for Mi device at 192.168.9.148: Receive timed out
2021-04-14 15:43:41.679 [DEBUG] [nal.transport.MiIoAsyncCommunication] - No response from device 0793XXXX at 192.168.9.148 for command {"id":11,"method":"get_properties","params":[{"did":"monitoring-frequency","siid":9,"piid":4}]}.
2021-04-14 15:43:41.679 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Sending Ping 0793D308 (192.168.9.148)
2021-04-14 15:43:41.705 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Ping 0793D308 (192.168.9.148) success
2021-04-14 15:43:41.705 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for cgdn1 type: GET_PROPERTIES, result: {}, fullresponse: {"error":"No Response"}
2021-04-14 15:43:41.706 [DEBUG] [internal.handler.MiIoAbstractHandler] - Error received: "No Response"

Thats how i have it configured in things and items.

Thing miio:basic:cgdn1       "Air Monitor Lite"    [host="192.168.9.148", token="774678XXXXXX25XXXX", deviceId="cgdn1", model="cgllc.airm.cgdn1"]

items
Number                  pm2_5_density           "Environment - PM2 5 Density"                   (G_airm)                {channel="miio:basic:cgdn1:pm2_5_density"}
Number                  pm10_density            "Environment - PM10 Density"                    (G_airm)                {channel="miio:basic:cgdn1:pm10_density"}
Number                  temperature             "Environment - Temperature"                     (G_airm)                {channel="miio:basic:cgdn1:temperature"}
Number                  co2_density             "Environment - CO2 Density"                     (G_airm)                {channel="miio:basic:cgdn1:co2_density"}

I can also see the UDP trafic exchange between OH and CGDN1

16:04:26.247026 IP 192.168.9.12.51064 > 192.168.9.148.54321: UDP, length 32
16:04:26.302120 IP 192.168.9.148.54321 > 192.168.9.12.51064: UDP, length 32

themillhousegroup pushed a commit to themillhousegroup/openhab2-addons that referenced this issue May 10, 2021
…enhab#10182)

* [miio] add support for cgllc.airm.cgdn1 Qingping Air Monitor Lite

close openhab#10152

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove expiremental

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* Improve readme

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] improve qty types

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove unknown element

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
Signed-off-by: John Marshall <john.marshall.au@gmail.com>
computergeek1507 pushed a commit to computergeek1507/openhab-addons that referenced this issue Jul 13, 2021
…enhab#10182)

* [miio] add support for cgllc.airm.cgdn1 Qingping Air Monitor Lite

close openhab#10152

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove expiremental

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* Improve readme

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] improve qty types

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove unknown element

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
@daemon110282
Copy link

@marcelrv Hello. I am on 2.5.12. Downloaded json and org.openhab.binding.miio-2.5.12-SNAPSHOT.
I see what connection success, data received to openhab, but not updated items. In PaperUI i don't see actual value item.
Can you help me?

2021-10-25 20:41:06.885 [DEBUG] [nal.transport.MiIoAsyncCommunication] - Command added to Queue {"id":85,"method":"get_properties","params":[{"did":"temperature","siid":3,"piid":7}]} -> 192.168.0.158 (Device: XXXXX token: XXXX Queue: 3)
2021-10-25 20:41:06.889 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Skip refresh of channel battery_level for miio:basic:airm as it is not linked
2021-10-25 20:41:06.891 [DEBUG] [io.internal.handler.MiIoBasicHandler] - Skip refresh of channel charging_state for miio:basic:airm as it is not linked
2021-10-25 20:41:07.315 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for airm type: GET_PROPERTIES, result: [{"did":"temperature","siid":3,"piid":7,"code":0,"value":24.6000}], fullresponse: {"id":85,"result":[{"did":"temperature","siid":3,"piid":7,"code":0,"value":24.6000}],"exe_time":40}
2021-10-25 20:41:07.317 [DEBUG] [io.internal.handler.MiIoBasicHandler] - No update logic for channeltype 'Number:Temperature'
2021-10-25 20:41:07.546 [DEBUG] [internal.handler.MiIoAbstractHandler] - Received response for airm type: MIIO_INFO, result: {"life":2813962,"uid":XXXXX,"model":"cgllc.airm.cgdn1","token":"XXXXX","ipflag":1,"fw_ver":"2.1.7_0382","mcu_fw_ver":"0383","miio_ver":"0.0.9","hw_ver":"esp32","mmfree":4184912,"mac":"XXXX","wifi_fw_ver":"v4.0.1-468-gba0b4be54f-dirty","ap":{"ssid":"XXXX","bssid":"XXXXX","rssi":-52,"primary":4},"netif":{"localIp":"XXXX","mask":"255.255.255.0","gw":"192.168.0.1"}}, fullresponse: {"id":87,"result":{"life":2813962,"uid":XXXXX,"model":"cgllc.airm.cgdn1","token":"XXXXX","ipflag":1,"fw_ver":"2.1.7_0382","mcu_fw_ver":"0383","miio_ver":"0.0.9","hw_ver":"esp32","mmfree":4184912,"mac":"XXXX","wifi_fw_ver":"v4.0.1-468-gba0b4be54f-dirty","ap":{"ssid":"XXX","bssid":"XXXX","rssi":-52,"primary":4},"netif":{"localIp":"XXX","mask":"255.255.255.0","gw":"192.168.0.1"}},"exe_time":40}

@marcelrv
Copy link
Contributor

Yes, as indicated before

@kovaga this will partially work with OH2.5
You would need to edit it e.g.--> Change the types that have Number:XXX to Number
All the mappings would not work automatically, but if you make them manually (from the examples in the binding readme) than you should have mapped values.
Others... who knows... but I would expect most of it works to some extend. I would say try it, don't worry you won't break anything

The line 2021-10-25 20:41:07.317 [DEBUG] [io.internal.handler.MiIoBasicHandler] - No update logic for channeltype 'Number:Temperature' indicates indeed that it is not working with the current version. You can try to remove the :Temperature part from the channeltype, (or from any channel that has something number:someType, 2.5 only knows just Number) than it probaly shows the value in 2.5.x... better: update to 3.1

@daemon110282
Copy link

@marcelrv thanks! Change type to Number in json and all works!

thinkingstone pushed a commit to thinkingstone/openhab-addons that referenced this issue Nov 7, 2021
…enhab#10182)

* [miio] add support for cgllc.airm.cgdn1 Qingping Air Monitor Lite

close openhab#10152

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove expiremental

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* Improve readme

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] improve qty types

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove unknown element

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
marcfischerboschio pushed a commit to bosch-io/openhab-addons that referenced this issue May 5, 2022
…enhab#10182)

* [miio] add support for cgllc.airm.cgdn1 Qingping Air Monitor Lite

close openhab#10152

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove expiremental

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* Improve readme

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] improve qty types

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>

* [miio] remove unknown element

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants