linariii / fritz-homeautomation-csharp Goto Github PK
View Code? Open in Web Editor NEWC# implementation of the AVM Home Automation API
License: MIT License
C# implementation of the AVM Home Automation API
License: MIT License
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);
When calling the method "GetDevices" I get empty xml elements for my DECT 200. My guess is that the device is currently unplugged (but still in the list of devices).
The device part of the response looks as follows:
<device identifier="08761 0348868" id="17" functionbitmask="35712" fwversion="04.25" manufacturer="AVM" productname="FRITZ!DECT 200"> <present>0</present> <txbusy>0</txbusy> <name>Lavalampe</name> <switch> <state></state> <mode></mode> <lock></lock> <devicelock></devicelock> </switch> <simpleonoff> <state></state> </simpleonoff> <powermeter> <voltage></voltage> <power></power> <energy></energy> </powermeter> <temperature> <celsius></celsius> <offset></offset> </temperature> </device>
If I manually remove this part from the response before the deserialization, everything works fine. The issue seems to be the that it can't parse the empty value to one of the enum values (like State, Mode...). Possible solution could also be a default value?
Besides that: Thanks for this library, really great work :)
Hello,
you should use data type int instead of uint for "temperature".
If you get temperature data in "°C" it is possible to get data below zero which will end up getting no data but an XML deserialization exception!
Regards.
Hello,
I have a FritzBox Cable and a Fritz Dect 210 registered there. Requesting the session ID is successfull but requesting devices with GetDevices(...) or GetDeviceInfos(...) using this requested session ID gives me an XML serialization error.
private async Task RunFritz()
{
try
{
var homeAutomationClient = new Fritz.HomeAutomation.HomeAutomationClient();
var sessionId = await homeAutomationClient.GetSessionId("myUserName", "myPassword");
var devices = await homeAutomationClient.GetDevices(sessionId);
var info = await homeAutomationClient.GetDeviceInfos(sessionId, "myFritzDectAid");
}
catch(Exception ex)
{
}
}
Error: "Instance validation error: 'manuell' is not a valid value for SwitchMode."
If I run the request urls in the browser I get the right XML response, e.g.:
http://fritz.box/webservices/homeautoswitch.lua?sid=68986fb1a557923b&switchcmd=getdevicelistinfos
<devicelist version="1" fwversion="7.57">
<device identifier="11657 0760001" id="16" functionbitmask="35712" fwversion="04.25" manufacturer="AVM" productname="FRITZ!DECT 210">
<present>1</present>
<txbusy>0</txbusy>
<name>FRITZ!DECT 210 #1</name>
<switch>
<state>1</state>
<mode>manuell</mode>
<lock>0</lock>
<devicelock>0</devicelock>
</switch>
<simpleonoff>
<state>1</state>
</simpleonoff>
<powermeter>
<voltage>232781</voltage>
<power>0</power>
<energy>0</energy>
</powermeter>
<temperature>
<celsius>220</celsius>
<offset>0</offset>
</temperature>
</device>
<group synchronized="0" identifier="grp8FD40C-3F744C05E" id="900" functionbitmask="37504" fwversion="1.0" manufacturer="AVM" productname="">
<present>1</present>
<txbusy>0</txbusy>
<name>Solar</name>
<switch>
<state>0</state>
<mode>manuell</mode>
<lock>0</lock>
<devicelock>0</devicelock>
</switch>
<simpleonoff>
<state>0</state>
</simpleonoff>
<powermeter>
<voltage>232781</voltage>
<power>0</power>
<energy>0</energy>
</powermeter>
<groupinfo>
<masterdeviceid>0</masterdeviceid>
<members>16</members>
</groupinfo>
</group>
</devicelist>
As you can see this mode is not part of your SwitchMode enums and additionally localised as German. Maybe you cannot use mode/SwitchMode as enum?!
I do not really know what to do or what the problem is. Could you give me some advice?
Thanks.
Sebastian.
When listing my devices, I get an XML serialisation errors
I've exchanged the DLL in my copy of com.linariii.fritzsmarthome.streamDeckPlugin and now that too works fine.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.