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

api.sensors.updateSensorConfig not working due to un-settable params included in request #225

Open
dhleong opened this issue Nov 30, 2022 · 3 comments

Comments

@dhleong
Copy link

dhleong commented Nov 30, 2022

The API complains that we're trying set set eg: battery. I believe this happens for updateSensorState as well. Also, some documentation about which things are "config" and which are "state" might be nice. I assumed sensor.on referred to state, but I guess it's actually config.

@peter-murray
Copy link
Owner

There is some documentation around the CLIP sensors here; https://github.com/peter-murray/node-hue-api/blob/typescript/docs/sensor.md

The actual underlying model is a separate library with all the sensor types defined here; https://github.com/peter-murray/hue-bridge-model/tree/main/src/model/sensors

The config and state are separated in the model object and the updateSensorState() is really only for CLIP sensors in practice (as there is use in tryign to update state for any other type of sensor as the sensor controls that, e.g. battery, temperature, switch that was toggled, etc...).

Can you possibly share some more context as to what you are doing that in manifesting the error (as well as the sensor that you are trying to do this with) so that I can look further into this?

@dhleong
Copy link
Author

dhleong commented Dec 12, 2022

I'm just trying to turn a Hue Motion Sensor on and off. Not at a computer right now but basically something like:

const sensor = //...
sensor.on = false;
await api.sensors.updateSensorConfig(sensor);

I'm working around this right now by monkey-patching the getHuePayload method.

@peter-murray
Copy link
Owner

So this is coming from the documentation on supported devices that Hue provides

Screenshot 2022-12-12 at 16 50 55

They list battery as a configuration parameter hence why it is there...

Can you possibly provide me a dump of the raw JSON data for the sensor you have (you can clear out any sensitive values) I am only looking for the JSON structure and keys before I make a change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants