sector icon indicating copy to clipboard operation
sector copied to clipboard

Problems with retrieving temperature readings

Open tkallsen opened this issue 2 years ago • 1 comments

Describe the bug I get a KeyError related to line 262 in coordinator.py, when it tries to read temperatures from the JSON response from /api/Panel/GetTemperatures.

As far as I have been able to figure out this is because it only creates entries in the temp(erature) dictionary from the GetPanel-response and I get more entries from GetTemperatures.

Response from GetPanel (only two temperatures):

"Temperatures": [
        {
            "Id": "8897303",
            "Label": "<redacted>",
            "SerialNo": "8897303",
            "Temprature": "0",
            "Temperature": "0",
            "DeviceId": "8897303"
        },
        {
            "Id": "5858192",
            "Label": "<redacted>",
            "SerialNo": "5858192",
            "Temprature": "0",
            "Temperature": "0",
            "DeviceId": "5858192"
        }
    ],

Response from GetTemperatures (12 entries):

[
    {
        "Id": "0",
        "Label": "entréplan ingång",
        "SerialNo": "5858192",
        "Temprature": "23",
        "Temperature": "23",
        "DeviceId": "5858192"
    },
    {
        "Id": "1",
        "Label": "<redacted>",
        "SerialNo": "6610978",
        "Temprature": "23",
        "Temperature": "23",
        "DeviceId": "6610978"
    },
    {
        "Id": "2",
        "Label": "<redacted>",
        "SerialNo": "6701423",
        "Temprature": "28",
        "Temperature": "28",
        "DeviceId": "6701423"
    },
    {
        "Id": "3",
        "Label": "<redacted>",
        "SerialNo": "6706123",
        "Temprature": "34",
        "Temperature": "34",
        "DeviceId": "6706123"
    },
    {
        "Id": "4",
        "Label": "<redacted>",
        "SerialNo": "6706423",
        "Temprature": "23",
        "Temperature": "23",
        "DeviceId": "6706423"
    },
    {
        "Id": "5",
        "Label": "<redacted>",
        "SerialNo": "6707623",
        "Temprature": "25",
        "Temperature": "25",
        "DeviceId": "6707623"
    },
    {
        "Id": "6",
        "Label": "<redacted>",
        "SerialNo": "6708223",
        "Temprature": "22",
        "Temperature": "22",
        "DeviceId": "6708223"
    },
    {
        "Id": "7",
        "Label": "<redacted>",
        "SerialNo": "8190053",
        "Temprature": "26",
        "Temperature": "26",
        "DeviceId": "8190053"
    },
    {
        "Id": "8",
        "Label": "<redacted>",
        "SerialNo": "8199433",
        "Temprature": "24",
        "Temperature": "24",
        "DeviceId": "8199433"
    },
    {
        "Id": "9",
        "Label": "<redacted>",
        "SerialNo": "8891331",
        "Temprature": "26",
        "Temperature": "26",
        "DeviceId": "8891331"
    },
    {
        "Id": "10",
        "Label": "<redacted>",
        "SerialNo": "8893611",
        "Temprature": "26",
        "Temperature": "26",
        "DeviceId": "8893611"
    },
    {
        "Id": "11",
        "Label": "<redacted>",
        "SerialNo": "8897303",
        "Temprature": "23",
        "Temperature": "23",
        "DeviceId": "8897303"
    }
]

I have no idea why the two API-calls returns different numbers of devices.

Version Latest/HACS

tkallsen avatar May 31 '23 06:05 tkallsen

Hi, I have same problem. After check Sector Alarm app HTTP API calls the API for temperatures reading change to : https://mypagesapi.sectoralarm.net/api/v2/housecheck/temperatures

cerede2000 avatar Nov 01 '23 20:11 cerede2000