Code Monkey home page Code Monkey logo

homebridge-airvisual-pro's People

Contributors

adintegra avatar deanlyoung avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

homebridge-airvisual-pro's Issues

AirVisual JSON format issue

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!

SyntaxError: Unexpected end of JSON input

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.

smbget fails; workaround available

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.

API

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()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.