Comments (4)
I have made this work with two changes:
-
Add the logging to
index.js:277
lux: accessory.LightLevelService ? accessory.LightLevelService.getCharacteristic(Characteristic.CurrentAmbientLightLevel).value : accessory.CurrentConditionsService.getCharacteristic(Characteristic.CurrentAmbientLightLevel).value
-
Switch from 'weather' to 'custom', in
currentConditions.js:151
but also do this:
this.services = [this.CurrentConditionsService];
this.historyService = new FakeGatoHistoryService("custom", this, this.config.fakegatoParameters);
this.services = this.getServices();
The 2nd part doesn't seem right. When examining the code in FakeGato, it looks at all the Services
that are part of the Accessory
. And then for each Characteristic
of each Services
it checks to see if it can create a history entry for it. If so, it does.
The challenge is the historyService
is part of the Accessory
and if I don't override the value of this.service
it crashes. It crashes because when it walks the list of Services, it reaches the historyService which is undefined
at that moment.
I'm wondering if there is different way Services
should be registered with the Accessory
.
from homebridge-weather-plus.
This is what it currently looks like:
from homebridge-weather-plus.
Worked out an elegant fix. Following the pattern in index.js
that has an array of Accessories:
this.accessoriesList = [];
In currentConditions.js
, create an array of services, aka this.services = [];
Then add each Service as they are created, aka:
this.services.push(this.CurrentConditionsService);
later
this.services.concat(compatibility.getServices(this));
and later:
this.services.push(this.informationService);
and lastly do this:
this.historyService = new FakeGatoHistoryService("custom", this, this.config.fakegatoParameters);
this.services.push(this.historyService);
Change getServices()
function to just return the services object:
getServices: function ()
{
return this.services;
}
This way, only fully defined Service
objects exist in the services array. FakeGatoHistoryService
is now happy.
from homebridge-weather-plus.
Very interesting!
from homebridge-weather-plus.
Related Issues (20)
- UV index is always 0 HOT 7
- Sharing Wind Speed Hack HOT 1
- Remove support for DarkSky HOT 3
- Each sensor is named "Now" HOT 9
- Temperature data is merged when you have multiple weather stations HOT 1
- OpenWeatherMap nor forcast devices, data available in Browser HOT 3
- Cannot read properties of undefined (reading 'list') HOT 6
- Openweather map dew point and UV index HOT 10
- [Tempest Weatherflow] When station offline: 1) history repeats last measurement forever, 2) one warning per minute in log HOT 11
- [Tempest WeatherFlow] v3.3.2 ReferenceError: accumulation is not defined HOT 9
- [Weatherflow Tempest] Report additional failed sensors HOT 2
- Error retrieving weather report: undefined HOT 10
- thresholdCloudCover on openweathermap.org HOT 16
- [Weatherflow Tempest] Bizarrely reporting 0ΒΊC, even though the Tempest app does not HOT 40
- Unable to uninstall or update HOT 1
- Getting error "Could not retreive weather report with API 3.0, trying API 2.5 now" HOT 3
- No wind sensor with 3.3.4 Beta 1 HOT 13
- Exceed quota on OWM and/or Wunderground when used in conjunction with Tempest
- Wondered why my threshold entries were empty in the settings HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebridge-weather-plus.