michielpost / Q42.HueApi

C# helper library to talk to the Philips Hue bridge
MIT License
411 stars 114 forks source link

Temperature property has wrong JSON property name #312

Closed RicoSuter closed 6 months ago

RicoSuter commented 6 months ago

The serialization for temperature is broken:

https://github.com/michielpost/Q42.HueApi/blob/310a8ba773eaf18c38a69d1fc00332b71b38b776/src/HueApi/Models/Sensors/TemperatureResource.cs#L15

should be "temperature" and not "motion".

Also the temperature value should be a double and not an int:

image

michielpost commented 6 months ago

Thanks for letting me know. It's fixed. The documentation on the Hue site indicates the temperature.temperature property is deprecated. So I removed it completely. The temperature value can be found in Temperature.TemperatureReport.Temperature.

This change is in version 1.5.2 which is being published to NuGet right now.

RicoSuter commented 6 months ago

With the update I'm no longer able to access the temperature at all:

image

How is the report supposed to be used? Is temperature only available via push data now?

michielpost commented 6 months ago

The temperature value can be found in Temperature.TemperatureReport.Temperature.

RicoSuter commented 6 months ago

Yes, but how do I get the TemperatureReport from a TemperatureResource?

RicoSuter commented 6 months ago

So the Temperature class should have a "TemperatureReport" property:

image

public class Temperature 
{
    [JsonPropertyName("temperature_report")]
    public bool TemperatureReport { get; set; }
}

image

michielpost commented 6 months ago

Yes, looks like the TemperatureReport was not added with the last update. I fixed it and it's being pushed to NuGet right now.

RicoSuter commented 6 months ago

Btw, would also be nice if the ButtonResource would have the report property:

image

image

(repeat interval and event values also missing)

michielpost commented 6 months ago

Just did another update with support for the new Button properties, also added support for CameraMotion, TamperSensor and ContactSensor 👍