kreso975 / homebridge-http-sensors-switches

Homebridge Plugin HTTP & MQTT
Apache License 2.0
1 stars 0 forks source link

Errors when more then one switch ist defined #2

Open audiopro-git opened 1 day ago

audiopro-git commented 1 day ago

Version: 1.1.6

Hi,

With this configuration:

{
    "devices": [
        {
            "deviceType": "Switch",
            "deviceID": "switch3",
            "deviceName": "NetPowerCtrl 3",
            "deviceManufacturer": "Anel Elektronik",
            "deviceModel": "Hut",
            "deviceFirmwareVersion": "Hut 6.1",
            "urlON": "http://192.168.38.9/?Sw_on=3",
            "urlOFF": "http://192.168.38.9/?Sw_off=3",
            "urlStatus": "http://pi41/api/hut/3",
            "stateName": "power",
            "onStatusValue": "1",
            "offStatusValue": "0"
        },
        {
            "deviceType": "Switch",
            "deviceID": "switch4",
            "deviceName": "NetPowerCtrl 4",
            "deviceManufacturer": "Anel Elektronik",
            "deviceModel": "Hut",
            "deviceFirmwareVersion": "Hut 6.1",
            "urlON": "http://192.168.38.9/?Sw_on=4",
            "urlOFF": "http://192.168.38.9/?Sw_off=4",
            "urlStatus": "http://pi41/api/hut/4",
            "stateName": "power",
            "onStatusValue": "1",
            "offStatusValue": "0"
        }
    ],
    "platform": "HttpSensorsAndSwitches"
}

I receive the following errors:

[29/10/2024, 15:05:28] [HttpSensorsAndSwitches] NetPowerCtrl 3 : Error: Cannot find: KEY: power in JSON [29/10/2024, 15:05:33] [HttpSensorsAndSwitches] NetPowerCtrl 3 : Error: Cannot find: KEY: power in JSON [29/10/2024, 15:05:39] [HttpSensorsAndSwitches] NetPowerCtrl 4 : Error: Cannot find: KEY: power in JSON [29/10/2024, 15:05:44] [HttpSensorsAndSwitches] NetPowerCtrl 4 : Error: Cannot find: KEY: power in JSON [29/10/2024, 15:05:49] [HttpSensorsAndSwitches] NetPowerCtrl 4 : Error: Cannot find: KEY: power in JSON [29/10/2024, 15:05:54] [HttpSensorsAndSwitches] NetPowerCtrl 4 : Error: Cannot find: KEY: power in JSON [29/10/2024, 15:05:58] [HttpSensorsAndSwitches] NetPowerCtrl 3 : Error: Cannot find: KEY: power in JSON [29/10/2024, 15:06:04] [HttpSensorsAndSwitches] NetPowerCtrl 4 : Error: Cannot find: KEY: power in JSON [29/10/2024, 15:06:09] [HttpSensorsAndSwitches] NetPowerCtrl 4 : Error: Cannot find: KEY: power in JSON

If only one switch is defined, everything works fine.

a.

kreso975 commented 1 day ago

Hi, I’m currently managing several switches and i think error isn't appearing due to the number of devices. Just to be sure, did you try removing the accessory from the cache? Go to Settings -> Remove Single Accessory -> then delete the ones you modified. Also, the error you’re encountering might indicate that the JSON on your device is missing the KEY 'power'.

audiopro-git commented 6 hours ago

The return of the JSON value is correct. After further investigation, I can say that everything works with two or three switches. But as soon as more than one switch is defined, the error messages appear. Removing the accessory from the cache did not help.