deanlyoung / homebridge-airvisual-pro Goto Github PK
View Code? Open in Web Editor NEWHomebridge plugin for IQAir AirVisual Pro
License: MIT License
Homebridge plugin for IQAir AirVisual Pro
License: MIT License
Hi,
In Home App, there was showd humidity 0% and temp 0.0 and Air Quality Unknown and Carbon Dioxide Ready but no data. Why?
Thank u.
I've found that my AirVisual (System Version: KBG60F82 / Software Version: 1.1651) writes its measurements into a JSON object within an array rather than just into a straight JSON object, i.e.:
that.airdata.measurements[0].pm25_AQIUS as opposed to just that.airdata.measurements.pm25_AQIUS
In my case then, the plugin was initially not finding any measurements. A quick search-and-replace did the trick. It's possible that others are experiencing the same problem so it may be worth implementing a more generic fix catering to both formats.
Great plugin β thanks!
Seeing the following error on a new install:
Nov 04 13:36:48 homebridge homebridge[11892]: [11/4/2018, 1:36:48 PM] [AirVisual Pro] Refreshing values...
Nov 04 13:36:58 homebridge homebridge[11892]: [11/4/2018, 1:36:58 PM] [AirVisual Pro] Refreshing values...
Nov 04 13:36:58 homebridge homebridge[11892]: [11/4/2018, 1:36:58 PM] [AirVisual Pro] AQI - 0 -> 4
Nov 04 13:36:58 homebridge homebridge[11892]: [11/4/2018, 1:36:58 PM] [AirVisual Pro] PM2.5 (ug/m3) - 0 -> 1.0
Nov 04 13:36:58 homebridge homebridge[11892]: [11/4/2018, 1:36:58 PM] [AirVisual Pro] PM10 (ug/m3) - undefined -> 2
Nov 04 13:36:58 homebridge homebridge[11892]: [11/4/2018, 1:36:58 PM] [AirVisual Pro] Temperature (C) - 0 -> 21.5
Nov 04 13:36:58 homebridge homebridge[11892]: [11/4/2018, 1:36:58 PM] [AirVisual Pro] Humidity (%) - 0 -> 49
Nov 04 13:36:58 homebridge homebridge[11892]: [11/4/2018, 1:36:58 PM] [AirVisual Pro] CO2 (ppm) - 0 -> 720
Nov 04 13:37:08 homebridge homebridge[11892]: [11/4/2018, 1:37:08 PM] [AirVisual Pro] Refreshing values...
Nov 04 13:37:08 homebridge homebridge[11892]: [11/4/2018, 1:37:08 PM] [AirVisual Pro] AQI - 1 -> 4
Nov 04 13:37:18 homebridge homebridge[11892]: [11/4/2018, 1:37:18 PM] [AirVisual Pro] Refreshing values...
Nov 04 13:37:18 homebridge homebridge[11892]: [11/4/2018, 1:37:18 PM] [AirVisual Pro] AQI - 1 -> 4
Nov 04 13:37:28 homebridge homebridge[11892]: [11/4/2018, 1:37:28 PM] [AirVisual Pro] Refreshing values...
Nov 04 13:37:28 homebridge homebridge[11892]: [11/4/2018, 1:37:28 PM] [AirVisual Pro] AQI - 1 -> 4
Nov 04 13:37:38 homebridge homebridge[11892]: [11/4/2018, 1:37:38 PM] [AirVisual Pro] Refreshing values...
Nov 04 13:37:38 homebridge homebridge[11892]: [11/4/2018, 1:37:38 PM] [AirVisual Pro] AQI - 1 -> 4
Nov 04 13:37:48 homebridge homebridge[11892]: [11/4/2018, 1:37:48 PM] [AirVisual Pro] Refreshing values...
Nov 04 13:37:48 homebridge homebridge[11892]: [11/4/2018, 1:37:48 PM] [AirVisual Pro] AQI - 1 -> 4
Nov 04 13:37:58 homebridge homebridge[11892]: [11/4/2018, 1:37:58 PM] [AirVisual Pro] Refreshing values...
Nov 04 13:37:58 homebridge homebridge[11892]: [11/4/2018, 1:37:58 PM] [AirVisual Pro] AQI - 1 -> 8
Nov 04 13:37:58 homebridge homebridge[11892]: [11/4/2018, 1:37:58 PM] [AirVisual Pro] PM2.5 (ug/m3) - 1 -> 2.0
Nov 04 13:38:08 homebridge homebridge[11892]: [11/4/2018, 1:38:08 PM] [AirVisual Pro] Refreshing values...
Nov 04 13:38:08 homebridge homebridge[11892]: [11/4/2018, 1:38:08 PM] [AirVisual Pro] AQI - 1 -> 8
Nov 04 13:38:18 homebridge homebridge[11892]: [11/4/2018, 1:38:18 PM] [AirVisual Pro] Refreshing values...
Nov 04 13:38:18 homebridge homebridge[11892]: [11/4/2018, 1:38:18 PM] [AirVisual Pro] AQI - 1 -> 8
Nov 04 13:38:28 homebridge homebridge[11892]: [11/4/2018, 1:38:28 PM] [AirVisual Pro] Refreshing values...
Nov 04 13:38:29 homebridge homebridge[11892]: [11/4/2018, 1:38:29 PM] [AirVisual Pro] AQI - 1 -> 8
Nov 04 13:38:34 homebridge homebridge[11892]: undefined:1
Nov 04 13:38:34 homebridge homebridge[11892]: SyntaxError: Unexpected end of JSON input
Nov 04 13:38:34 homebridge homebridge[11892]: at JSON.parse (<anonymous>)
Nov 04 13:38:34 homebridge homebridge[11892]: at exec (/usr/local/lib/node_modules/homebridge-airvisual-pro/index.js:63:27)
Nov 04 13:38:34 homebridge homebridge[11892]: at ChildProcess.exithandler (child_process.js:282:5)
Nov 04 13:38:34 homebridge homebridge[11892]: at emitTwo (events.js:126:13)
Nov 04 13:38:34 homebridge homebridge[11892]: at ChildProcess.emit (events.js:214:7)
Nov 04 13:38:34 homebridge homebridge[11892]: at maybeClose (internal/child_process.js:925:16)
Nov 04 13:38:34 homebridge homebridge[11892]: at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
Nov 04 13:38:34 homebridge systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE
Nov 04 13:38:34 homebridge systemd[1]: homebridge.service: Failed with result 'exit-code'.
Nov 04 13:38:44 homebridge systemd[1]: homebridge.service: Service hold-off time over, scheduling restart.
Nov 04 13:38:44 homebridge systemd[1]: homebridge.service: Scheduled restart job, restart counter is at 2.
Nov 04 13:38:44 homebridge systemd[1]: Stopped Node.js HomeKit Server.
Using ubuntu 20.04.6 LTS, this smbget command fails (to see if you have the same problem, try it yourself):
smbget -O -U airvisual%<password> smb://<ipaddress>/airvisual/latest_config_measurements.json
It is because samba requires more up-to-date security by default. A workaround is to edit /vi/samba/smb.conf and add
client min protocol=NT1
inside the [global]
section.
Note that I"m not really a linux expert; there may be a better way to do this. It took a little time for me to figure this out, so hopefully this note will save someone else some time.
A better fix would be to use a utility that allows the protocol to be set explicitly, or perhaps use the AQI apis (not sure the tradeoffs). However, a temporary fix would be to at least add this hint in the setup instructions.
IQAir has official api.
There is no need to do exec smbget or it would be great to do both implementation: if homebridge hardware has internet - do request to api else do exec()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.