Giter Site home page Giter Site logo

homebridge-awair's People

Contributors

deanlyoung avatar dependabot[bot] avatar dmblakeley avatar sj26 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

homebridge-awair's Issues

Awair Glow C

How many devices and what type does this add to home app?

Can you control the outlet?

Can you control the light?

Determine value weight

Being able to determine which values weighs more or less to determine the HomeKit status of air quality like ‘excellent’ and ‘good’. Right now, it says my air quality is ‘good’ because the temperature is not perfect according to the Awair app (between 22 and 26 degrees Celsius).

This is a bit annoying when trying to trigger the mechanical ventilation in my home. When air quality is ‘good’, turn on MV. But in that case, the air quality will only get ‘worse’ since the MV will be sucking up hot air, temp goes down even more (or heating will work harder: more gas costs)

User does not have permission to call RAW endpoint

Great job reworking the plugin.

I have it running but I don't seem to have permission to call the Awair API endpoint?

This is the URL it's trying to request
http://developer-apis.awair.is/v1/users/self/devices/awair/9339/air-data/latest
This is what I see in the log
[2018-9-3 20:28:54] [Awair Bedroom] Error contacting Awair API: StatusCodeError: 401 - {"message":"User 7596 does not have permission to call RAW endpoint"}

I had no issues getting my devID and DevType. I also tried requesting the above url with my Authorization Bearer directly in terminal and got the same 401 error above.

How do I obtain an orgToken?

I tried to get access to the Awair developer dashboard but I didn't get approved. Is there another way to get the orgToken or to get this working with Homebridge?

Issues trying to run homebridge-awair

I installed with sudo npm install -g homebridge-awair
Then got my token and configured the config file. However I have run into a few issues trying to run it.

When I ran homebridge, I got the following error on my local copy on my Raspberry Pi

Issue 1
ERROR LOADING PLUGIN homebridge-awair: [2018-8-13 10:41:43] /usr/lib/node_modules/homebridge-awair/index.js:184 that.log.debug(JSON.stringify(JSON.parse(response),null,2););
So I removed the extra ; also one on line 191.

Issue 2
I then got this error which was strange because I checked the node_modules folder inside homebridge-awair folder and it was there. I also checked npm list and it seemed to be there
ERROR LOADING PLUGIN homebridge-awair: [2018-8-13 11:09:55] Error: Cannot find module 'awairnode' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15) at Function.Module._load (internal/modules/cjs/loader.js:475:25) at Module.require (internal/modules/cjs/loader.js:598:17) at require (internal/modules/cjs/helpers.js:11:18) at Object.<anonymous> (/usr/lib/node_modules/homebridge-awair/index.js:2:13) at Module._compile (internal/modules/cjs/loader.js:654:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10) at Module.load (internal/modules/cjs/loader.js:566:32) at tryModuleLoad (internal/modules/cjs/loader.js:506:12) at Function.Module._load (internal/modules/cjs/loader.js:498:3) [2018-8-13 11:09:55] ====================
Tried uninstalling and reinstalling homebridge-awair no difference.
In the index.js I then changed
var awair = require('awairnode');
to
var awair = require('./node_modules/awairnode/lib/awairnode');
This seemed to work as it didn't error anymore, however I am not sure why it couldn't find the module?

Issue 3
I then got this error
`ERROR LOADING PLUGIN homebridge-awair:
[2018-8-13 17:08:33] /usr/lib/node_modules/homebridge-awair/node_modules/awairnode/lib/awairnode.js:55
url: 'http://developer-apis.awair.is/v1/users/self/devices/' + devType + '/' + devId + '/' + that.chainedRequests.join('');
^

SyntaxError: Unexpected token ;
at new Script (vm.js:51:7)
at createScript (vm.js:136:10)
at Object.runInThisContext (vm.js:197:10)
at Module._compile (internal/modules/cjs/loader.js:618:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Module.require (internal/modules/cjs/loader.js:598:17)
at require (internal/modules/cjs/helpers.js:11:18)`

The options don't seem to be formatted correctly? in awairnode.js I changed this

// Construct the url var options = { url: 'https://afb-api.awair.is/v1/orgs/self/devices/' + devType + '/' + devId + '/air-data' + that.chainedRequests.join(''); headers: { 'Authorization': 'Bearer ' + orgToken }
to this
var cR = that.chainedRequests.join(''); // Construct the url var options = { url: 'https://afb-api.awair.is/v1/orgs/self/devices/' + devType + '/' + devId + '/air-data' + cR, headers: { 'Authorization': 'Bearer ' + orgToken }

This made the error go away but again not sure it it's correct?

Issue 4
I then got this error

ERROR LOADING PLUGIN homebridge-awair: [2018-8-13 17:58:49] Error: Cannot find module 'request' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:548:15) at Function.Module._load (internal/modules/cjs/loader.js:475:25) at Module.require (internal/modules/cjs/loader.js:598:17) at require (internal/modules/cjs/helpers.js:11:18) at Object.<anonymous> (/usr/lib/node_modules/homebridge-awair/node_modules/awairnode/lib/awairnode.js:1:77) at Module._compile (internal/modules/cjs/loader.js:654:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10) at Module.load (internal/modules/cjs/loader.js:566:32) at tryModuleLoad (internal/modules/cjs/loader.js:506:12) at Function.Module._load (internal/modules/cjs/loader.js:498:3)
No idea why it couldn't find the request module as it's in npm list -g

I installed the request module locally by doing
sudo npm install request --save
This added request into the homebridge-awair package.json as a dependency and also the homebridge-awair local node_modules folder.

Issue 5
I then got the same error as issue 4 for lower-case and did the same fix.
Error: Cannot find module 'lower-case'

Issue 6
I then got this error
`Loading 1 accessories...
[2018-8-13 18:44:48] [Bedroom] Initializing Awair accessory...
/usr/lib/node_modules/homebridge-awair/index.js:19
this.awair = new Awair(config['token']);
^

ReferenceError: Awair is not defined
at new AwairAccessory (/usr/lib/node_modules/homebridge-awair/index.js:19:19)
at Server._loadAccessories (/usr/lib/node_modules/homebridge/lib/server.js:275:29)
at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:86:38)
at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10)
at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
at Module._compile (internal/modules/cjs/loader.js:654:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
`
And after spending time trying to fix it I got stuck :(

Does this plugin actually run on someone else setup or is this to do with my install?

Co2 trigger detected

I can't seem to get the Co2 detected to trigger.

I have the Co2 threshold set to 500 in the config file just to see if I can get it to trigger for some testing.

I put some extra logging in to see it falls into the if statement to set Co2 detected. Which it is, see below. I am wondering if no value is being passed to Characteristic.CarbonDioxideDetected?

that.carbonDioxideService.setCharacteristic(Characteristic.CarbonDioxideDetected);

[2018-9-4 12:15:08] [Awair Bedroom] http://developer-apis.awair.is/v1/users/self/devices/awair/9339/air-data/15-min-avg?limit=1&desc=true
[2018-9-4 12:15:09] [Awair Bedroom] {"temp":18.31,"humid":64.95,"co2":555,"voc":630,"dust":31.5}
[2018-9-4 12:15:09] [Awair Bedroom] that.carbonDioxideThreshold: 500
[2018-9-4 12:15:09] [Awair Bedroom] co2: 555
[2018-9-4 12:15:09] [Awair Bedroom] co2 Threshhold detected: 500 Actual: 555
[2018-9-4 12:15:09] [Awair Bedroom] equation: (630 * 72.66578273019740 * 1 * 101.32) / ((273.15 + 18.31) * 8.3144)
[2018-9-4 12:15:09] [Awair Bedroom] tvoc: 1914.0611645549182 ug/m^3

Attached screen shot of what it looks like home home app.

fullsizeoutput_16a2

Force C or F temperature?

I have four Awair devices, however one of the four is returning Celsius into Homebridge even though it is configured in the iOS app to return Fahrenheit. Is it possible to explicitly request Fahrenheit via the API to return back into Homebridge? If not, any ideas as to what may be causing this? Thanks in advance.

Add Status Fault

Currently, if there is an error, the user is not alerted to it via the HomeKit Status Fault flag.

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.