seydx / homebridge-fritz-platform

AiO Homebridge dynamic platform plugin for AVM hardware like Fritz!Box, Fritz!Repeater etc.
MIT License
223 stars 32 forks source link

[FritzPlatform] TypeError: Cannot read property 'type' of undefined #236

Closed potatobrain1337 closed 2 years ago

potatobrain1337 commented 2 years ago
[9/28/2021, 4:55:26 AM] [HB Supervisor] OS: Linux 5.10.60-v7+ arm
[9/28/2021, 4:55:26 AM] [HB Supervisor] Node.js v14.17.6 /usr/local/bin/node
[9/28/2021, 4:55:26 AM] [HB Supervisor] Homebridge Path: /usr/local/lib/node_modules/homebridge/bin/homebridge
[9/28/2021, 4:55:26 AM] [HB Supervisor] UI Path: /usr/local/lib/node_modules/homebridge-config-ui-x/dist/bin/standalone.js
[9/28/2021, 4:55:37 AM] [Homebridge UI] Homebridge Config UI X v4.41.2 is listening on :: port 8581
[9/28/2021, 4:55:38 AM] [HB Supervisor] Starting Homebridge with extra flags: -I -P /homebridge/node_modules
[9/28/2021, 4:55:39 AM] [HB Supervisor] Started Homebridge v1.3.4 with PID: 405
Initializing HAP-NodeJS v0.9.4...
[9/28/2021, 4:55:42 AM] Loaded config.json with 0 accessories and 3 platforms.
[9/28/2021, 4:55:42 AM] Loaded 47 cached accessories from cachedAccessories.
[9/28/2021, 4:55:42 AM] ---
[9/28/2021, 4:55:42 AM] ---
[9/28/2021, 4:55:44 AM] Loaded plugin: homebridge-dummy@0.5.0
[9/28/2021, 4:55:44 AM] Registering accessory 'homebridge-dummy.DummySwitch'
[9/28/2021, 4:55:44 AM] ---
[9/28/2021, 4:55:44 AM] Loaded plugin: homebridge-fritz-platform@6.0.16
[9/28/2021, 4:55:47 AM] Registering platform 'homebridge-fritz-platform.FritzPlatform'
[9/28/2021, 4:55:47 AM] ---
[9/28/2021, 4:55:52 AM] Loaded plugin: homebridge-hue@0.13.23
[9/28/2021, 4:55:52 AM] Registering platform 'homebridge-hue.Hue'
[9/28/2021, 4:55:52 AM] ---
[9/28/2021, 4:55:53 AM] Loaded plugin: homebridge-config-ui-x@4.41.2
[9/28/2021, 4:55:53 AM] Registering platform 'homebridge-config-ui-x.config'
[9/28/2021, 4:55:53 AM] ---
[9/28/2021, 4:55:53 AM] Loading 3 platforms...
[9/28/2021, 4:55:53 AM] [Config] Initializing config platform...
[9/28/2021, 4:55:53 AM] [Config] Running in Service Mode
[9/28/2021, 4:55:53 AM] [FritzPlatform] Initializing FritzPlatform platform...
[9/28/2021, 4:55:59 AM] [Hue] Initializing Hue platform...
[9/28/2021, 4:55:59 AM] [Hue] homebridge-hue v0.13.23, node v14.17.6, homebridge v1.3.4

config

{
    "bridge": {
        "name": "Homebridge",
        "username": "00:00:00:00:00:00",
        "port": 51970,
        "pin": "000-00-00"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        },
        {
            "name": "FritzPlatform",
            "warn": true,
            "error": true,
            "extendedError": true,
            "devices": [
                {
                    "active": true,
                    "name": "FRITZ!Box 7590",
                    "host": "192.168.178.1",
                    "port": 49000,
                    "username": "XXX",
                    "password": "XXX",
                    "manufacturer": "Fritz Box",
                    "model": "7590",
                    "serialNumber": "12345",
                    "master": true,
                    "ssl": true,
                    "tr064": true,
                    "igd": false,
                    "readOnly": false,
                    "hide": true,
                    "connection": "dsl",
                    "wifiUnits": 2,
                    "options": {
                        "wifi_2ghz": "switch",
                        "wifi_5ghz": "switch",
                        "wifi_guest": "switch",
                        "wps": "characteristic",
                        "aw": "characteristic",
                        "deflection": "switch",
                        "led": "switch",
                        "lock": "switch",
                        "dect": "switch",
                        "reconnect": "switch",
                        "broadband": "characteristic"
                    }
                }
            ],
            "smarthome": [
                {
                    "active": true,
                    "name": "Schlafzimmer - TV / Audio",
                    "ain": "11630 0000001",
                    "energy": true,
                    "startValue": 1,
                    "temperature": true,
                    "accType": "switch"
                },
                {
                    "active": false,
                    "name": "FRITZ!DECT 200 #2 - Wohnzimmer (TV)",
                    "ain": "11630 0000002",
                    "energy": true,
                    "startValue": 1,
                    "temperature": true,
                    "accType": "switch"
                },
                {
                    "active": false,
                    "name": "FRITZ!DECT 200 #3 - Wohnzimmer (MAC)",
                    "ain": "11630 0000003",
                    "energy": true,
                    "startValue": 1,
                    "temperature": true,
                    "accType": "switch"
                },
                {
                    "active": false,
                    "name": "FRITZ!DECT 200 #7 - Wohnzimmer (PC)",
                    "ain": "11630 0000004",
                    "energy": true,
                    "startValue": 1,
                    "temperature": true,
                    "accType": "switch"
                },
                {
                    "active": false,
                    "name": "FRITZ!DECT 200 #8 - Wohnzimmer (Audio)",
                    "ain": "11630 0000005",
                    "energy": true,
                    "startValue": 1,
                    "temperature": true,
                    "accType": "switch"
                },
                {
                    "active": false,
                    "name": "FRITZ!DECT 301 #4 - Badezimmer",
                    "ain": "09995 0000001",
                    "temperature": true,
                    "window": true,
                    "openWindow": true,
                    "battery": true,
                    "accType": "thermostat"
                },
                {
                    "active": false,
                    "name": "FRITZ!DECT 301 #5 - Schlafzimmer",
                    "ain": "09995 0000003",
                    "temperature": true,
                    "window": true,
                    "openWindow": true,
                    "battery": true,
                    "accType": "thermostat"
                },
                {
                    "active": false,
                    "name": "FRITZ!DECT 301 #6 - Wohnzimmer",
                    "ain": "09995 0000003",
                    "temperature": true,
                    "window": true,
                    "openWindow": true,
                    "battery": true,
                    "accType": "thermostat"
                }
            ],
            "options": {
                "polling": {
                    "timer": 15,
                    "timerSmarthomeButtons": 5,
                    "exclude": []
                }
            },
            "platform": "FritzPlatform"
        },
        {
            "name": "Hue",
            "anyOn": true,
            "effects": true,
            "hosts": [
                "192.168.178.28"
            ],
            "lights": true,
            "nativeHomeKitLights": false,
            "nativeHomeKitSensors": false,
            "resource": true,
            "users": {
                "XXX": "XXX"
            },
            "platform": "Hue"
        }
    ]
}

screenshot with errors

seydx commented 2 years ago

Fixed in v6.0.17

potatobrain1337 commented 2 years ago

Fixed in v6.0.17

thank you @SeydX - i updated to the latest version and still get this error

[10/6/2021, 1:56:06 AM] [FritzPlatform] An error occurred during polling smarthome devices!
[10/6/2021, 1:56:06 AM] [FritzPlatform] TypeError: Cannot read property 'type' of undefined
    at /homebridge/node_modules/homebridge-fritz-platform/src/accessories/smarthome/smarthome.handler.js:1754:38
    at Array.filter (<anonymous>)
    at Handler.poll (/homebridge/node_modules/homebridge-fritz-platform/src/accessories/smarthome/smarthome.handler.js:1750:46)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
seydx commented 2 years ago

can u try v6.0.19-beta.0 pls

sudo npm i -g homebridge-fritz-platform@beta

potatobrain1337 commented 2 years ago

can u try v6.0.19-beta.0 pls

sudo npm i -g homebridge-fritz-platform@beta

works like a charm - thank you so much @SeydX - exception is gone and i look at this now 🥇

image

seydx commented 2 years ago

Nice, will push it to 6.0.19

seydx commented 2 years ago

v6.0.19 online

Seeeebi-sudo commented 1 year ago

Hi,

im getting the same error with FB 6591 over internet and 3 FDect 301 devices... They are showing up, but the sensors are greyed out. The log shows

[16/12/2022, 20:12:34] [FritzPlatform] TypeError: Cannot read properties of undefined (reading '$') at /var/lib/homebridge/node_modules/homebridge-fritz-platform/node_modules/@seydx/fritzbox/lib/fritzbox.js:235:83 at Array.filter (<anonymous>) at Fritzbox.getSmarthomeDevices (/var/lib/homebridge/node_modules/homebridge-fritz-platform/node_modules/@seydx/fritzbox/lib/fritzbox.js:235:58) at processTicksAndRejections (node:internal/process/task_queues:95:5) at Handler.poll (/var/lib/homebridge/node_modules/homebridge-fritz-platform/src/accessories/smarthome/smarthome.handler.js:1755:28)

I am on V 6.0.19 on a homebridge server on Raspberry Pi...

DO you need any other information?

Thanks! @seydx