DMBlakeley / homebridge-awair2

Homebridge dynamic platform plugin for Awair air quality sensor.
Other
50 stars 3 forks source link

awair element not appearing in homebridge/homekit #271

Closed daVid0n closed 1 year ago

daVid0n commented 2 years ago

after entering the dev api key into the plugin, nothing happens, the sensor is not added to homebridge at all. Also homebridge log doesn't list anything but that the plugin was started, config is standard. According to Dean Young, this might be related to some issue with the deny list? Maybe there is a worked around or it would be possible to fix somehow? Thx! David

Describe The Bug:

To Reproduce:

Expected behavior:

Logs:

Show the Homebridge logs here, remove any sensitive information.

Plugin Config:

Show your Homebridge config.json here, remove any sensitive information.

Screenshots:

Environment:

DMBlakeley commented 2 years ago

@daVid0n, just to make sure, I assume you registered your device on getawair.com and obtained your Development Token using the same email address. At startup the plugin queries your Awair account for registered devices. It appears in your case that there are no devices on your account from the description that you provided.

What I would suggest is:

If your device is not listed I would email Awair at hello@getawair.com and provide then with the model and serial number of your device so that they can confirm that it is properly recorded in their database.

For me to investigate further I would need to see the logs. Please remove any sensitive information before sending to me.

DMBlakeley commented 2 years ago

One additional question. Does your Awair device show up correctly in the Awair app?

deanlyoung commented 2 years ago

@DMBlakeley after investigating on the Awair side, we need to upload this device's MAC in our database, so it is most likely not populating due to the missing MAC.

daVid0n commented 2 years ago

Hey mates, thank you very much for your replies!! I am sorry I am not the best communicator, as I am not capable of programming at all.. so even I am not capable of running homebridge in verbose mode nor do I find any explanation how to do this on google :/ Some 'homebridge -v' or 'sudo systemctl start homebridge.service -v' just wont do it. But I can try to answer your questions of course:

Loaded plugin: homebridge-awair2@5.9.5 Registered platform 'homebridge-awair2.Awair2' then: [Awair2] homebridge-awair2 platform didFinishLaunching

And that's it. Once I found out, how to run this in verbose mode, I'll share a more detailed log. Could you please give me a hint how to do that? Thank you very much and sorry for being such a noob :)

DMBlakeley commented 2 years ago

If you go to the plug-in page on the web at https://github.com/DMBlakeley/homebridge-awair2 at the top you will find a link to the Wiki which explains how to setup and configure the plugin.

Appears that @deanlyoung has determined that your device is not correctly registered which is why the plug-in is not finding your device.

Thanks for giving us feedback and not giving up when the plug-in didn't seem to work!

daVid0n commented 2 years ago

Thank you once again for your awesome help! I just reinstalled the awair2 plugin and the awair element shows up, when the developer option is turned on (not without). This definitely hasn't worked before, so I guess @deanlyoung solved this for me in the background. If there was something I did do wrong, then plz let me know. Also if you'd like to have more details from me, now or in future, don't hesitate to contact me. But for now, I guess I'll have to close this issue then :) Thank you and best regards, David

DMBlakeley commented 2 years ago

The developer option basically ignores the first 6 digits of the MAC ID. This indicates that your device is not registered correctly on the Awair side. You do not lose any functionality using this option.

If you have any feedback after using please don't hesitate to send an inquiry.

deanlyoung commented 2 years ago

Awesome! That's the workaround we were looking for πŸ™ŒπŸ»

jankais3r commented 1 year ago

Hi,

I am having a similar issue as described. I configured the developer token and from the logs I can see the device being registered correctly. The air quality values being reported by the plugin in log match what I see in the Awair app, but I cannot add the device in the Home app. When I scan the code with camera, nothing happens. The accessory is also not listed on the "manual accessory add screen"…

[12/15/2022, 11:11:36 PM] [Awair2] Initializing Awair2 platform...
[12/15/2022, 11:11:36 PM] [Awair2] Developer token is valid, loading Awair devices from account.
[12/15/2022, 11:11:36 PM] Loading 2 accessories...
[12/15/2022, 11:11:36 PM] [Awair2] homebridge-awair2 platform didFinishLaunching
Setup Payload:
X-HM://0024ZBB5YK8HC
Enter this code with your HomeKit app on your iOS device to pair with Homebridge:

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     
    β”‚ 913-40-870 β”‚     
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     

I currently have the 'Development Mode' enabled, but it didn't make a difference. Any idea what could be the issue? I am running Docker on Synology NAS with plenty other plugins and never had this issue with any of them.

DMBlakeley commented 1 year ago

Hi @jankais3r,

Thanks for reaching out. Developer mode was included to allow use of development devices at Awair and not surprised that it did not make a difference.

A couple of questions:

I have tried to get Homebridge running on Docker Desktop for Mac without success as it is running within a a virtual machine and the Homebridge ports are not forwarded to the local network. I do not have experience with Synology NAS but as the accessory is not listed on the "manual accessory add screen" this may well be the same issue. You may well be connected to Awair (axios requests) but due to Homebridge quirks in Docker you may not be able to make a HomeKit (mDNS) connections.

Please let me know.

jankais3r commented 1 year ago

Thank you for getting back to me so quickly.

[12/15/2022, 11:59:51 PM] [Awair2] userInfo: {"id":"redacted","firstName":"","lastName":"","email":"redacted","tier":"Hobbyist","dobYear":0,"dobMonth":0,"dobDay":0,"permissions":[{"scope":"API_USAGE","quota":2147483646},{"scope":"FIFTEEN_MIN","quota":100},{"scope":"FIVE_MIN","quota":300},{"scope":"GET_DISPLAY_MODE","quota":300},{"scope":"GET_KNOCKING_MODE","quota":300},{"scope":"GET_LED_MODE","quota":300},{"scope":"GET_POWER_STATUS","quota":300},{"scope":"GET_TIMEZONE","quota":300},{"scope":"LATEST","quota":300},{"scope":"PUT_DEVICE_NAME","quota":300},{"scope":"PUT_DISPLAY_MODE","quota":300},{"scope":"PUT_KNOCKING_MODE","quota":300},{"scope":"PUT_LED_MODE","quota":300},{"scope":"PUT_LOCATION","quota":300},{"scope":"PUT_PREFERENCE","quota":300},{"scope":"PUT_ROOM_TYPE","quota":300},{"scope":"PUT_SPACE_TYPE","quota":300},{"scope":"PUT_TIMEZONE","quota":300},{"scope":"RAW","quota":500},{"scope":"USER_DEVICE_LIST","quota":2147483646},{"scope":"USER_INFO","quota":2147483646}],"usages":[{"scope":"FIFTEEN_MIN","usage":7},{"scope":"USER_INFO","usage":5},{"scope":"USER_DEVICE_LIST","usage":4}]} [12/15/2022, 11:59:51 PM] [Awair2] getUserInfo: Completed [12/15/2022, 11:59:51 PM] [Awair2] getAwairDevices: 1 devices discovered, will only add Omni, Awair-r2, Element and Mint [12/15/2022, 11:59:51 PM] [Awair2] getAwairDevices: discovered device: [0] {"name":"Awair Element","deviceId":redacted,"deviceType":"awair-element","deviceUUID":"awair-element_redacted","latitude":0,"longitude":0,"preference":"GENERAL","locationName":"","roomType":"OTHERS","spaceType":"HOME","macAddress":"70886Bredacted","timezone":""} [12/15/2022, 11:59:51 PM] [Awair2] [70886Bredacted] Initializing platform accessory Awair Element... [12/15/2022, 11:59:51 PM] [Awair2] [70886Bredacted] awair-element_redacted IAQ accessory exists, using data from cache [12/15/2022, 11:59:51 PM] [Awair2] --- Initializing IAQ data, Display mode and LED mode for Awair devices --- [12/15/2022, 11:59:51 PM] [Awair2] [70886Bredacted] Getting initial IAQ status for awair-element_redacted [12/15/2022, 11:59:51 PM] [Awair2] --- Starting Air and Local data collection --- {"mode":"press","deviceType":"switch","allowPush":true,"maxRetry":3,"connectionType":"OpenAPI","refreshRate":360,"scanDuration":2} [12/15/2022, 11:59:52 PM] [Awair2] [70886Bredacted] updateAirQualityData: [{"timestamp":"2022-12-15T22:45:00.000Z","score":78.15730337078652,"sensors":[{"comp":"co2","value":1377.6629213483145},{"comp":"temp","value":20.664157267366903},{"comp":"pm25","value":6.258426966292135},{"comp":"humid","value":50.77202246162329},{"comp":"voc","value":880.3258426966293}],"indices":[{"comp":"temp","value":0},{"comp":"co2","value":2},{"comp":"humid","value":0.7651685393258427},{"comp":"pm25","value":0},{"comp":"voc","value":1.147191011235955}]}] [12/15/2022, 11:59:52 PM] [Awair2] [70886Bredacted] convertAwairAqi ignoring "co2": 1377.6629213483145 [12/15/2022, 11:59:52 PM] [Awair2] [70886Bredacted] convertAwairAqi ignoring "temp": 20.664157267366903 [12/15/2022, 11:59:52 PM] [Awair2] [70886Bredacted] convertAwairAqi ignoring "humid": 50.77202246162329 [12/15/2022, 11:59:52 PM] [Awair2] [70886Bredacted] aqi array: [0,0,1,0,2] [12/15/2022, 11:59:52 PM] [Awair2] [70886Bredacted] CO2 HIGH: 1377.6629213483145 > 1000 [12/15/2022, 11:59:52 PM] [Awair2] [70886Bredacted] PM2.5: 7.158426966292135 ug/m^3) [12/15/2022, 11:59:52 PM] [Awair2] [70886Bredacted] ppb => ug/m^3 equation: (880.3258426966293 71.6657827301974 1 101.32) / ((272.15 + 20.664157267366903) 8.2144) [12/15/2022, 11:59:52 PM] [Awair2] [70886Bredacted] VOC: (880.3258426966293 ppb) => TVOC: (2646.1734159407138 ug/m^3)



The log shows that the issue is not connection to the API. But for whatever reason the final HomeKit device is not being created…

Not sure if it matters, but during plugin installation it asked me whether I want to run Awair2 as a separate hub, or together with all other accessories. I chose not to create a separate hub.
DMBlakeley commented 1 year ago

Thanks for the additional information on versions as well as the additional logs. I am also running on the same versions so no issue here.

From the logs, it appears that connection has been established with the Awair servers and the Homebridge accessories have been created correctly. I assume that if you go to the accessories tab that you should see 4 tiles for the Awair Element (IAQ, Temp, Humidity, CO2).

To your question about "hubs" I would not have expected this question. In Homebridge there is an option to run a plug-in in a "Child Bridge" which will have a separate Setup Code. I use this feature for a couple of plugins that are not necessarily well behaved in my Homebridge setup. If the plugin runs into a problem, Homebridge will stop and restart this plugin without impacting the other plugins.

Did you per chance install the Awair2 plugin in a new/separate instance of Homebridge with the "samsung tizen tv, nest, adguard home, switchbot" plugins running in the primary instance? This is certainly possible with Docker and may explain why you received the question about the separate hub.

DMBlakeley commented 1 year ago

Reopening so that issues can be tracked to closure.

jankais3r commented 1 year ago

Thanks for the additional information on versions as well as the additional logs. I am also running on the same versions so no issue here.

From the logs, it appears that connection has been established with the Awair servers and the Homebridge accessories have been created correctly. I assume that if you go to the accessories tab that you should see 4 tiles for the Awair Element (IAQ, Temp, Humidity, CO2).

I went through all the rooms in my Home and the Awair accessory isn't there.

To your question about "hubs" I would not have expected this question. In Homebridge there is an option to run a plug-in in a "Child Bridge" which will have a separate Setup Code. I use this feature for a couple of plugins that are not necessarily well behaved in my Homebridge setup. If the plugin runs into a problem, Homebridge will stop and restart this plugin without impacting the other plugins.

Yes you are right, it was child bridge, not a hub. I installed the plugin via the web UI, and it asked me right away. I don't like multiple bridges, so I declined the offer, but I might try to remove the plugin and try this route to see if it makes a difference.

Did you per chance install the Awair2 plugin in a new/separate instance of Homebridge with the "samsung tizen tv, nest, adguard home, switchbot" plugins running in the primary instance? This is certainly possible with Docker and may explain why you received the question about the separate hub.

No, it runs on my one and only instance of Homebridge.

DMBlakeley commented 1 year ago

If the accessories are shown in Homebridge they should also be available in HomeKit. With iOS15 and iOS16 the Awair devices are not as obvious on how they are displayed in HomeKit Rooms as they are in the Climate section.

Before starting over, take a look at the WiKi, Section 6, to see how they are displayed.

jankais3r commented 1 year ago

Yeah, I don't have the Awair there...

Temperature

DMBlakeley commented 1 year ago

So, you really have me a bit stumped! The Awair2 plugin adds the Awair to Homebridge and then Homebridge connects to HomeKit. The Awair accessories show up in the Homebridge Accessories tab, correct?

What version of iOS are you on? If on iOS 16.2 did you update to the new HomeKit architecture? Did you also update your Apple TV or HomePod?

Also find it interesting that your Homebridge startup log only shows the Awair2 plugin being initialized and not the other plugins that you also have running on Homebridge.

DMBlakeley commented 1 year ago

Screen grab on my iPhone with iOS 16.2. On screen touch "Temperature" to see second screen. Same is true for Humidity and Air Quality. You will find the Display and LED switches in the Home room that the device is assigned to. image

jankais3r commented 1 year ago

So, you really have me a bit stumped! The Awair2 plugin adds the Awair to Homebridge and then Homebridge connects to HomeKit. The Awair accessories show up in the Homebridge Accessories tab, correct?

I don't have the Accessories tab enabled in the Web UI. If I remember correctly, it required running the whole thing with elevated permissions last time I checked, so I didn't enable it. Can have a second look tonight.

What version of iOS are you on? If on iOS 16.2 did you update to the new HomeKit architecture? Did you also update your Apple TV or HomePod?

All my devices (incl. HomePods) are on 16.2. I tried to upgrade the Home to Matter, but it failed because I have another Home with no Hub in it, which is apparently not supported under the new architecture. I purchased an older Apple TV and will add it as a hub, which should allow me to upgrade to Matter.

Also find it interesting that your Homebridge startup log only shows the Awair2 plugin being initialized and not the other plugins that you also have running on Homebridge.

My Homebridge log actually contains entries from all other plugins, I just removed those rows as they are irrelevant to the issue at hand :)

DMBlakeley commented 1 year ago

Learn something new everyday ...

Yes, there is a Homebridge option Homebridge "Insecure" Mode / Enable Accessory Control which turns off the Accessories tab. Please try turning on (Restart required and web page refresh) and see if the Awair accessories show up in Homebridge.

jankais3r commented 1 year ago
Screenshot 2022-12-17 at 17 22 52

So the Awair sensors are visible in the Web UI...

DMBlakeley commented 1 year ago

If the Awair accessories show up on the Homebridge Web UI, I have never experienced that they do not show up in HomeKit.

Suggestion, download the Eve app (which is free) and see if you don't find the Awair there. Look in the Rooms section. The Awair may be in a Default Room that may not be showing up in Home. If you do find them, you can move them to the right room in the Eve app and Home should display them.

jankais3r commented 1 year ago

Thanks for the tip with downloading the Eve app. I didn't even have to move the accessory anywhere. I just launched the Eve app, granted it access to my Home, and Awair immediately appeared in the Home app. Many thanks!!! IMG_1375

DMBlakeley commented 1 year ago

Great!

The Eve app offers some additional functions over the stock Home app. For example, I have set up an automation in Eve that when the sliding door in the Living Room closes, the HVAC is turned back on but only if the sliding door in the Kitchen is also closed. Eve lets you set up the conditional automation and then it will appear in Home with this condition.

Happy Holidays!