Open Tjossul opened 9 months ago
Hello,
I have a solution for this:
/// <summary>
/// Mode of the
/// </summary>
public enum SwitchMode
{
/// <summary>
/// Device is off
/// </summary>
[XmlEnum(Name = "0")]
Off,
/// <summary>
/// Device is on
/// </summary>
[XmlEnum(Name = "1")]
On,
/// <summary>
/// Device is in auto mode
/// </summary>
[XmlEnum(Name = "auto")]
Auto,
/// <summary>
/// Device is in manual mode
/// </summary>
Manual
}
/// <summary>
/// Switch
/// </summary>
[Serializable]
[XmlRoot(ElementName = "switch")]
public class Switch
{
/// <summary>
/// State
/// </summary>
[XmlElement("state")]
public State State { get; set; }
/// <summary>
/// Mode state
/// </summary>
[XmlIgnore]
public SwitchMode SwitchMode { get; set; }
/// <summary>
/// Mode state
/// </summary>
[XmlElement("mode")]
public string SwitchModeParse
{
get { return SwitchMode.ToString(); }
set { SwitchMode = Enum.TryParse(value, out SwitchMode enumValue) ? enumValue : SwitchMode.Manual; }
}
/// <summary>
/// Lock state
/// </summary>
[XmlElement("lock")]
public Lock Lock { get; set; }
/// <summary>
/// device lock state
/// </summary>
[XmlElement("devicelock")]
public Lock DeviceLock { get; set; }
}
This works for me.
Regards. Sebastian.
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.
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
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.