linariii / fritz-homeautomation-csharp

C# implementation of the AVM Home Automation API
MIT License
3 stars 1 forks source link

Help with reading out DECT 440 (humidity) #1

Closed helptiger closed 2 years ago

helptiger commented 2 years ago

So far I have been using this great library to read the temperature of a DECT 200. Now I have another Fritz DECT 440 and would like to read out the humidity too. Does anyone have an example code or can help me a little? I would be very pleased! Thanks

I'm using this for temperature (same as DECT 200): var myTemp = await FritzClient.GetTemperature(SessionID, AIN).ConfigureAwait(false);

linariii commented 2 years ago

Thanks for using my library.

You can use var devices = await FritzClient.GetDevices(Sid); to get all devices (which already contain information about humidity if supported), afterwards you have to filter the devices. You can find an example (my Streamdeck Plugin for this Library) here

I pushed a new version, since I found two small bugs in the device class which caused issues during de-serialization.

Please let me know if you need further assistance :)

helptiger commented 2 years ago

Thanks for the help. 😀 The solution can be so simple:

var deviceInfos = await FritzClient.GetDeviceInfos(<SessionID>, <AIN>);

if (deviceInfos?.Humidity.RelativeHumidity != null)
    ...