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

[Bug]: Security system with characteristics, bad behaviour #388

Closed
Supergiovane opened this issue Apr 4, 2021 · 15 comments
Closed

[Bug]: Security system with characteristics, bad behaviour #388

Supergiovane opened this issue Apr 4, 2021 · 15 comments
Labels
bug 🐛 There is at least high chance that it is a bug!

Comments

@Supergiovane
Copy link

Supergiovane commented Apr 4, 2021

First of all, thank you again for this great set of node!!

Describe the bug
The security system node behaves bad if you set the characteristics.
If you set the characteristics (see "to reproduce"), the node gives an error in the node-red log:

[BridgeAccessi F1D3@Antifurto@Antifurto@Security System Current State] characteristic value 0 is not contained in valid values array
[BridgeAccessi F1D3@Antifurto@Antifurto@Security System Target State] characteristic value 0 is not contained in valid values array

The bad thing, is that the node outputs a SecuritySystemTargetState = 1 (ARM AWAY) to the flow, arming the security system,

To Reproduce
Put a security system node ti the flow and set these characteristics in the config window.

{
    "SecuritySystemCurrentState": {
        "validValues": [
            1,
            2,
            3,
            4
        ]
    },
    "SecuritySystemTargetState": {
        "validValues": [
            1,
            2,
            3,
            4
        ]
    }
}

Expected behavior
No error on noce-red log and no output SecuritySystemTargetState = 1

Thank you!!

@Supergiovane Supergiovane added the bug 🐛 There is at least high chance that it is a bug! label Apr 4, 2021
@crxporter
Copy link
Member

Some comments:

Security system TargetState can't be 4. That's "ALARM" - current state can be 4.
State 0 is "armed home" which is annoyingly the initial state of the security system.

What if you use these char props?

{
    "SecuritySystemCurrentState": {
        "minValue": 1,
        "validValues": [
            1,
            2,
            3,
            4
        ]
    },
    "SecuritySystemTargetState": {
        "minValue": 1,
        "validValues": [
            1,
            2,
            3
        ]
    }
}

The goal would be to get the HomeKit (hap-nodejs?) system to stop emitting 0 state when it starts up... I've not tested this, let me know what happens and we'll figure out what should be the next test.

Any reason you don't want the "Home" state on your alarm?

@Supergiovane
Copy link
Author

Hi
Thanks for the quick feedback.
I haven’t the “home” state in my security system, so i don’t want to see it in the options.
Yes you’re right, the 4 is the alarm.
Some versions ago, this has never caused such a problem. Today i’ve updated the hk node and this issue appeared.
;-)

@crxporter
Copy link
Member

Using my JSON - it works properly but I can confirm a similar error in my log:

Apr 04 17:52:42 raspberrypi Node-RED[385]: [Demo 1 6402@Security no Home@Security no Home@Security System Current State] characteristic was supplied illegal value: number 0 exceeded minimum of 1
Apr 04 17:52:42 raspberrypi Node-RED[385]: [Demo 1 6402@Security no Home@Security no Home@Security System Target State] characteristic was supplied illegal value: number 0 exceeded minimum of 1

That being said... the device works as expected, goes to "Away" as default startup value (current state = 1) and there is no "home" option, as expected.

@Shaquu - any idea why this error is now popping up? I don't know if it's an error so much as a warning since everything continues working fine for me.

@Supergiovane - is your security system working properly? I just went through some basic tests and didn't get any logs in nodered after the initial deploy and add to home app... Everything worked as it does with the security system I use in my setup.

@Supergiovane
Copy link
Author

Supergiovane commented Apr 5, 2021

Hi crxporter
Previously, the node has never sent the “away” payload after restart. Now it sends that payload so i need to handle this behavior.
Other than that, it works as usual.
By removing the characteristics json, leaving the textfield blank, the node doesn’t logs any error and it doesn’t emit the “away” payload anymore.

@twocolors
Copy link
Contributor

this error is repeated with TargetTemperature

node-red       | [kubik3 C91D@lessar@lessar@Target Temperature] characteristic was supplied illegal value: number 10 exceeded minimum of 17

on

    "TargetTemperature": {
        "minValue": 17,
        "maxValue": 30,
        "minStep": 1
    }

@Shaquu
Copy link
Member

Shaquu commented Apr 6, 2021

To answer questions from @crxporter
Error is here since HapNodeJS guys are adding more and more validations.

Regarding error. Probably it means HomeKit is trying to set 0 (by default) but it is not set due to ranges so it stays with previous value.

@twocolors Same about you.
10 is not in range 17-30 so the error appears :)
Please check if you are not sending 10 in NodeRED or else.

@crxporter
Copy link
Member

"Error" could be a strong word, perhaps it's just a "warning" or simply "information"?

Has anyone had any broken functionality from this?

@twocolors
Copy link
Contributor

@Shaquu or else , some magic ...

Screenshot 2021-04-07 at 07 44 04

{
    "Name": "Кондиционер",
    "TargetHeatingCoolingState": {
        "validValues": [
            0,
            1,
            2,
            3
        ]
    },
    "CurrentHeatingCoolingState": {
        "validValues": [
            0,
            1,
            2,
            3
        ]
    },
    "TargetTemperature": {
        "minValue": 17,
        "maxValue": 30,
        "minStep": 1
    }
}

log

node-red       | Starting to advertise 'kubik3 C91D' using ciao backend!
node-red       | [kubik3 C91D@lessar11@lessar11@Target Temperature] characteristic was supplied illegal value: number 10 exceeded minimum of 17

@Supergiovane
Copy link
Author

The latest update seems to have solved the issue.

@Shaquu
Copy link
Member

Shaquu commented Aug 11, 2021

Seems it is not resolved yet.
Should be resolved by homebridge/HAP-NodeJS#902

@crxporter
Copy link
Member

I'm gonna be honest - I "fixed" mine by adding 0.0001 to my "zero values"

I have this line:

CurrentAmbientLightLevel: input.object.newValue + 0.0001

@lougreenwood
Copy link

@Shaquu Do you know when the homebridge/HAP-NodeJS#902 PR might be merged, I'm also seeing my logs flooded with these characteristic was supplied an illegal value errors were the min value is above some initialisation value.

Thanks!

@Shaquu
Copy link
Member

Shaquu commented Sep 16, 2022

Possibly once I rewrite the PR :) I will do my best to do so soon

@lougreenwood
Copy link

lougreenwood commented Sep 16, 2022

No worries and no pressure @Shaquu - it's open source ☺️

@Shaquu
Copy link
Member

Shaquu commented Nov 20, 2022

Should be resolved in #481

Shaquu added a commit that referenced this issue Nov 20, 2022
### Added

- Support for new advertiser [AVAHI](homebridge/HAP-NodeJS#918)
- Support for new advertiser [RESOLVED](homebridge/HAP-NodeJS#965)
- Added `msg.hap.reachable` parameter to get device reachable state (related to NO_RESPONSE)

### Fixed

- Accessory could not be recovered from NO_RESPONSE using single Characteristic
- Make unsupported Characteristic error more
  descriptive [#456](#456)
- FFmpeg No such file or directory [#495](#495)
- allChars: properties have spaces in names [#496](#496)
- Wait for host to return from unpublish/destroy before exiting, set published flag on destroy
- Security system with characteristics, bad behaviour [#388](#388)

### Changed

- Updated hap-nodejs to [0.9.7](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.9.7) (bug fixes)
- Updated hap-nodejs to [0.9.8](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.9.8) (bug fixes)
- Updated hap-nodejs to [0.10.0](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.10.0) (features)
- Updated hap-nodejs to [0.10.1](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.10.1) (changes)
- Updated hap-nodejs to [0.10.2](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.10.2) (bug fixes)
- Updated hap-nodejs to [0.10.3](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.10.3) (bug fixes)
- Updated hap-nodejs to [0.10.4](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.10.4) (bug fixes)
- Updated hap-nodejs to [0.11.0](https://github.com/homebridge/HAP-NodeJS/releases/tag/v0.11.0) (features and bug fixes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 There is at least high chance that it is a bug!
Projects
None yet
Development

No branches or pull requests

5 participants