larsbeck / HomematicIp

This package allows to query the HomematicIp REST and WebSocket endpoint.
MIT License
7 stars 2 forks source link

[Unsopported device] HEATING #1

Closed DevEddy closed 5 years ago

DevEddy commented 5 years ago

Hi there,

thanks for porting to C#, good work! I am not sure how to implement this missing device.

{
    "id": "de9d8666-2950-47be-8748-3e74a732cf43",
    "homeId": "21edcd0f-2b62-4b28-b0fb-e8476834d493",
    "metaGroupId": "072abd4a-aa66-44b9-9743-b2c9bd13ff80",
    "label": "Wohnzimmer",
    "lastStatusUpdate": 1557228133529,
    "unreach": true,
    "lowBat": null,
    "dutyCycle": null,
    "type": "HEATING",
    "channels": [{
            "deviceId": "3014F711A0000A98A98A960B",
            "channelIndex": 1
        },
        {
            "deviceId": "3014F711A0000A1709ACCF4F",
            "channelIndex": 1
        },
        {
            "deviceId": "3014F711A00001D8A98F00F3",
            "channelIndex": 1
        },
        {
            "deviceId": "3014F711A00000D3C98C95EC",
            "channelIndex": 1
        }
    ],
    "windowOpenTemperature": 5.0,
    "setPointTemperature": null,
    "minTemperature": 5.0,
    "maxTemperature": 30.0,
    "windowState": null,
    "cooling": null,
    "partyMode": false,
    "controlMode": "AUTOMATIC",
    "profiles": {
        "PROFILE_6": {
            "profileId": "6c473796-e0f0-4ee8-a3ce-db640f9b82a9",
            "groupId": "de9d8666-2950-47be-8748-3e74a732cf43",
            "index": "PROFILE_6",
            "name": "",
            "visible": false,
            "enabled": true
        },
        "PROFILE_1": {
            "profileId": "a3852d75-c0df-40d1-97f5-28ecece81df4",
            "groupId": "de9d8666-2950-47be-8748-3e74a732cf43",
            "index": "PROFILE_1",
            "name": "",
            "visible": true,
            "enabled": true
        },
        "PROFILE_3": {
            "profileId": "c6a490da-5aec-48e2-b222-39611716b862",
            "groupId": "de9d8666-2950-47be-8748-3e74a732cf43",
            "index": "PROFILE_3",
            "name": "",
            "visible": false,
            "enabled": true
        },
        "PROFILE_2": {
            "profileId": "ab1ff219-3c31-4fc2-b279-233019481d06",
            "groupId": "de9d8666-2950-47be-8748-3e74a732cf43",
            "index": "PROFILE_2",
            "name": "",
            "visible": false,
            "enabled": true
        },
        "PROFILE_4": {
            "profileId": "50f15d8a-297e-4f80-8409-fa445eacdee3",
            "groupId": "de9d8666-2950-47be-8748-3e74a732cf43",
            "index": "PROFILE_4",
            "name": "",
            "visible": true,
            "enabled": true
        },
        "PROFILE_5": {
            "profileId": "e27ed937-8620-40cd-aca6-80828f6b2c8c",
            "groupId": "de9d8666-2950-47be-8748-3e74a732cf43",
            "index": "PROFILE_5",
            "name": "",
            "visible": false,
            "enabled": true
        }
    },
    "activeProfile": "PROFILE_1",
    "boostMode": false,
    "boostDuration": 5,
    "actualTemperature": null,
    "humidity": null,
    "coolingAllowed": false,
    "coolingIgnored": false,
    "ecoAllowed": true,
    "ecoIgnored": false,
    "controllable": true,
    "floorHeatingMode": "FLOOR_HEATING_STANDARD",
    "humidityLimitEnabled": true,
    "humidityLimitValue": 60,
    "externalClockEnabled": false,
    "externalClockHeatingTemperature": 19.0,
    "externalClockCoolingTemperature": 23.0,
    "valvePosition": null,
    "sabotage": null,
    "valveSilentModeSupported": false,
    "valveSilentModeEnabled": false,
    "lastSetPointReachedTimestamp": 1557222906339,
    "lastSetPointUpdatedTimestamp": 1557228133529,
    "heatingFailureSupported": true
}

-- Eddy

larsbeck commented 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

DevEddy commented 5 years ago

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. image

image

-- Eddy

larsbeck commented 5 years ago

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

DevEddy commented 5 years ago

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

larsbeck commented 5 years ago

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

DevEddy commented 5 years ago

Hi Lars,

thanks, HEATING seems to work now. One more device is missing, I'll open separate issue.

-- Eddy