Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Homekit] Detected value out of range for light sensor #9722

Closed
EjvindHald opened this issue Jan 6, 2021 · 8 comments · Fixed by #11803
Closed

[Homekit] Detected value out of range for light sensor #9722

EjvindHald opened this issue Jan 6, 2021 · 8 comments · Fixed by #11803
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@EjvindHald
Copy link

In the evening it is completely dark outside my house, and my light sensor therefore correctly registers a light level of 0 lux.

Expected behaviour
I would then expect that 0 lux could be sent to Homekit without problems, because this is normal with a good sensor.

Current Behavior
In the case 0 in in light level from the sensor, this appears in the log:

Detected value out of range 0.0. Returning min value instead. Characteristic io.github.hapjava.characteristics.impl.lightsensor.CurrentAmbientLightLevelCharacteristic

and my Homekit app shows 1 lux in light level.

Solution
If possible, one solution could be to add custom min and max values. If that is not possible then simply change it to min value as today but without an entry in the log file. This is because it is correct measurement, when it is completely dark.

@EjvindHald EjvindHald added the bug An unexpected problem or unintended behavior of an add-on label Jan 6, 2021
@yfre
Copy link
Contributor

yfre commented Jan 7, 2021

interesting. for some reason the default min value defined by apple is 0.0001.
the HAP library we use for homekit integration does not allow custom min/max value for this characteristic.
so, i would not to expect a quick fix for this issue. maybe as workaround you could replace 0 with 0.0001 as value using rules or so

@diRk262
Copy link

diRk262 commented Jan 8, 2021

I got the same error with several lightsensors, but for me HomeKit is showing 0 Lux in preview and 0,0001 Lux in detailed view.
So when HomeKit min value is 0,0001 and OH sends 0.0, the error will be shown because 0,0<0,0001 Lux.
At the moment I got no idea how to fix this.

@yfre
Copy link
Contributor

yfre commented Jan 8, 2021

probably the easiest option right now is to disable logging.
e.g.in karaf console

set:log ERROR io.github.hapjava.characteristics.impl.lightsensor.CurrentAmbientLightLevelCharacteristic

this will stop logging for that class and logic will replace 0,0 with 0, 0001

@diRk262
Copy link

diRk262 commented Jan 8, 2021

Ok, I changed my log level to error and now the warning will not be shown anymore. Good idea, thank you. Now my log looks way cleaner :)

By the way, you got a typo. The command is log:set and not set:log.

@diRk262
Copy link

diRk262 commented Jan 8, 2021

@yfre
This is really strange, the warning log entry is back even though my log level is still set to error.

date Jan Fri 8 20:08:58 2021 openhab> log:get io.github.hapjava.characteristics.impl.lightsensor.CurrentAmbientLightLevelCharacteristic ERROR openhab> log:tail ...... 20:02:21.177 [WARN ] [ristics.impl.base.FloatCharacteristic] - Detected value out of range 0.0. Returning min value instead. Characteristic io.github.hapjava.characteristics.impl.lightsensor.CurrentAmbientLightLevelCharacteristic@33d95d ......

Any idea what causes the warning to be shown?

@EjvindHald
Copy link
Author

For me this is also appearing in the log immediately after all restarts of OH3. And the item with the Homekit light sensor is not the same as the item attached to the thing with the physical sensor. There is rule in between which prevents a value of 0 to hit the Homekit item.

@yfre
Copy link
Contributor

yfre commented Jan 10, 2021

@diRk262 @EjvindHald
please set one more logging to error

log:set ERROR io.github.hapjava.characteristics.impl.base.FloatCharacteristic

however, it will also hide all other min/max warrning

@pelerner
Copy link

Same here ... useless messages on startup .... this time for Thermostat ...
Seems to be some kind of timing issue when addons start up.

2021-02-24 23:50:37.174 [WARN ] [al.accessories.HomekitThermostatImpl] - Heating cooling current mode not available. Relaying value of OFF to Homekit
2021-02-24 23:50:37.190 [WARN ] [al.accessories.HomekitThermostatImpl] - Heating cooling target mode not available. Relaying value of OFF to Homekit

2021-02-24 23:50:37.214 [WARN ] [istics.impl.base.FloatCharacteristic] - Detected value out of range 0.0. Returning min value instead. Characteristic io.github.hapjava.characteristics.impl.thermostat.CurrentTemperatureCharacteristic@1ec61cf

After the knx addon finally delivered values - these messages go away.
It takes some time reading all the knx values with 16 thermostats and some other knx kcomponents.

2021-02-22 17:40:06.566 [hingStatusInfoChangedEvent] - 'knx:device:bKNXIP:dRTR' changed from UNINITIALIZED to INITIALIZING
2021-02-22 17:40:06.597 [hingStatusInfoChangedEvent] - 'knx:device:bKNXIP:dRTR' changed from INITIALIZING to OFFLINE (BRIDGE_OFFLINE)
2021-02-22 17:41:06.275 [hingStatusInfoChangedEvent] - 'knx:device:bKNXIP:dRTR' changed from OFFLINE (BRIDGE_OFFLINE) to ONLINE
2021-02-22 17:41:20.276 [vent.ItemStateChangedEvent] - iRTR_TEMP_IST changed from NULL to 23.52
2021-02-22 17:41:22.185 [vent.ItemStateChangedEvent] - iRTR_TEMP_SOLL changed from NULL to 24.0

NULL values apparently are used as "0.0" by the homekit addon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants