Closed DevEddy closed 5 years ago
Hi Eddy,
I have updated the code to support this device. I haven't strongly typed the profiles though. That could be added if needed.
Since I don't have that device myself, I was only able to test with the message above, so I made a few properties nullable whenever I thought that they could be nullable from what I have seen with my devices.
Good luck and feel free to post issues or updates if you need anything.
Lars
Hi Lars,
thank you for this. But it doesn't work. The key cannot be found in the "map".
Here is my debug output of the key which is in the map and the actual object. The types are different. Maybe it helps you.
-- Eddy
Hi Eddy,
ah yes, that makes perfect sense. Heating isn't actually a device, my bad. I have changed that to a "group", which it actually is.
If it still doesn't work, let me know.
Lars
Hi Lars,
thanks, now I get:
Newtonsoft.Json.JsonSerializationException: Error converting value {null} to type 'System.Boolean'. Path 'configPending', line 30, position 23. ---> System.InvalidCastException: Null object cannot be converted to a value type.
at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
--- End of inner exception stack trace ---
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at HomematicIp.Data.JsonConverters.AbstractListConverter`2.ReadJson(JsonReader reader, Type objectType, List`1 existingValue, Boolean hasExistingValue, JsonSerializer serializer) in /Users/eschaefer/Documents/GitHub/HomematicIp/src/HomematicIp/Data/JsonConverters/AbstractListConverter.cs:line 31
at Newtonsoft.Json.JsonConverter`1.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at HomematicIp.Services.HomematicService.GetCurrentState(CancellationToken cancellationToken) in /Users/eschaefer/Documents/GitHub/HomematicIp/src/HomematicIp/Services/HomematicService.cs:line 54
at HomematicIp.Console.Program.Main(String[] args) in /Users/eschaefer/Documents/GitHub/HomematicIp/src/HomematicIp.Console/Program.cs:line 74
-- Eddy
Hi Eddy,
I made "configPending" nullable. There might be more properties that can take null values and aren't nullable yet. Could you check how far you are getting now?
Lars
Hi Lars,
thanks, HEATING seems to work now. One more device is missing, I'll open separate issue.
-- Eddy
Hi there,
thanks for porting to C#, good work! I am not sure how to implement this missing device.
-- Eddy