Comments (8)
Hello there! The daylight sensor is integrated into Hue motion sensors. Their official description says:
The Hue Motion sensor's integrated daylight sensor detects when there is still enough daylight so that lights do not turn on until you need them. If it's still too dark, adjust the light sensitivity of the sensor in the Philips Hue app to personalize when you'd like the motion sensor to activate.
I wonder if you'd be able to show me the raw JSON output of your bridge, when you fetch the sensors? In my case, for example, a daylight sensor looks like this:
"1": {
"state": {
"daylight": false,
"lastupdated": "2021-02-08T14:22:00"
},
"config": {
"on": true,
"configured": true,
"sunriseoffset": 30,
"sunsetoffset": -30
},
"name": "Daylight",
"type": "Daylight",
"modelid": "PHDL00",
"manufacturername": "Signify Netherlands B.V.",
"swversion": "1.0"
}
from yetanotherhueapi.
{
"name":"Daylight",
"type":"Daylight",
"state":{
"daylight":null,
"lastupdated":"none"
},
"swupdate":null,
"config":{
"on":true,"
configured":false,
"sunriseoffset":30,
"sunsetoffset":-30
}
,
"modelid":"PHDL00",
"manufacturername":"Signify Netherlands B.V.",
"swversion":"1.0",
"uniqueid":null,
"recycle":null,
"productname":null,
"capabilities":null
}
from yetanotherhueapi.
This could be the reason, why there occurs a NPE, because "daylight" is null.
I don't have configured my sensors with the Philipps hue app, because I use Apple HomeKit.
It sounds like those daylight sensors are kind of "virtuell" sensors, which are configured by the Phillips hue app.
The ambient sensors in the hue motion sensors are working fine.
I was surprised, that so much config overload exists in my hue raw output. There are so much scenes from 3rd party apps and so much rules I never configured.
from yetanotherhueapi.
I woke up this morning and did some research in the hue app. Under Settings > Advanced > Home Location, you can set your location, since I did this, the Daylight sensor works. By the way, the -30 and 30 come from the setting under Home Location "sunrise and sunset". So the sensor is virtual and is calculated from the geo data. If someone doesn't enter a home location because they may not use the app 100% like I do, then your api will always run into the NPE. Thanks for your advice.
from yetanotherhueapi.
Great, thanks for your research! In the JSON data you posted there's the part "configured": false
which is kind of revealing: the sensor just wasn't configured. There's not much one can do with such a sensor, is there? I'm inclined to think that it probably shouldn't throw an NPE but some more sensible exception instead, explaining what went wrong.
from yetanotherhueapi.
...or then again I might just return false
and log an error. 🤔 I checked the official docs, and they do not mention the configured
property at all, so I'm hesitant to use it. Maybe it's nicer to not crash and to just document this behavior.
from yetanotherhueapi.
Also, the piece I copied from their documentation seems to be wrong in this context: clearly the daylight sensor we are talking about here is built into the Bridge, it's not a part of any motion sensor. The motion sensors have what are called ambient light sensors, but their marketing material refers to them as daylight sensors, which is very confusing. 🤦♂️
from yetanotherhueapi.
This fix has now been released in version 2.1.0. An uninitialized daylight sensor will not throw an NPE anymore but will instead just return false
.
from yetanotherhueapi.
Related Issues (20)
- Cant Find Any Devices Without Error Codes HOT 9
- Add link to Javadocs
- Add colorloop effect
- Add group 0, i.e. the "all lights" group
- NPE when bridge doesn't return sensors HOT 5
- could you make a java 11 version which includes a module-info file. THX HOT 2
- Get color of light HOT 1
- Turn on / off room without setState (color, alert, etc...) HOT 2
- Why so restrictive? HOT 7
- Add mDNS support for discovering bridges HOT 1
- Add new light HOT 6
- Server-Sent Events HOT 7
- Implement a findByUiniqueId for lights and sensors HOT 11
- No logging by default HOT 3
- TemperatureSensor#getDegreesCelsius NPE HOT 10
- Get state ... question ? HOT 3
- Why such a restrictive State.Builder? HOT 2
- EffectType from String "prism": not one of the values accepted for Enum HOT 2
- Error when using v2 HOT 2
- JKS not found and java.io.FileNotFoundException: https://discovery.meethue.com/ HOT 28
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 yetanotherhueapi.