grzegorz914 / homebridge-meraki-control

Homebridge plugin for Meraki devices using RESTFull API, publish as independent external platform accessory.
MIT License
0 stars 3 forks source link

TypeError when getting switch port status #19

Closed pl804 closed 1 month ago

pl804 commented 1 month ago

Debug shows port status, but is immediately followed by "requesting port status error: TypeError: Cannot read properties of null (reading 'substr')."

grzegorz914 commented 1 month ago

Can you post genus, go to plugin settings advanced settings>>system>>debug, enable it and get the whole log please

pl804 commented 1 month ago
[7/28/2024, 9:25:20 AM] [homebridge-meraki-control] Launched child bridge with PID [redacted]
[7/28/2024, 9:25:20 AM] Registering platform 'homebridge-meraki-control.Meraki'
[7/28/2024, 9:25:20 AM] [homebridge-meraki-control] Loaded homebridge-meraki-control v1.1.13 child bridge successfully
[7/28/2024, 9:25:20 AM] Loaded 0 cached accessories from cachedAccessories.[redacted].
[7/28/2024, 9:25:20 AM] [homebridge-meraki-control] Network: [redacted], did finish launching.
[7/28/2024, 9:25:20 AM] [homebridge-meraki-control] Network: [redacted], Config: {
  "name": "[redacted]",
  "host": "https://[redacted].meraki.com",
  "apiKey": "removed",
  "organizationId": "removed",
  "networkId": "removed",
  "dashboardClientsControl": false,
  "enablePrefixForClientName": false,
  "enableSonsorClients": false,
  "accessPointsControl": false,
  "hideUnconfiguredSsids": false,
  "enablePrefixForSsidsName": false,
  "switchesControl": true,
  "switches": [
    {
      "name": "[redacted]",
      "serialNumber": "[redacted]",
      "mode": true,
      "hideUplinkPorts": true,
      "enablePrefixForPortName": true,
      "enablePoePortsControl": true,
      "enableSensorPorts": false
    }
  ],
  "enableDebugMode": true,
  "disableLogInfo": false,
  "disableLogDeviceInfo": false,
  "refreshInterval": 5
}
[7/28/2024, 9:25:20 AM] Homebridge v1.8.4 (HAP v0.12.2) (homebridge-meraki-control) is running on port [redacted].
[7/28/2024, 9:25:20 AM] 

NOTICE TO USERS AND PLUGIN DEVELOPERS
> Homebridge 2.0 is on the way and brings some breaking changes to existing plugins.
> Please visit the following link to learn more about the changes and how to prepare:
> https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0

[7/28/2024, 9:25:21 AM] [homebridge-meraki-control] [redacted], [redacted], debug: data: [
  {
    "portId": "1",
    "name": null,
    "tags": [],
    "enabled": true,
    "poeEnabled": true,
    "type": "access",
    "vlan": [redacted],
    "voiceVlan": null,
    "allowedVlans": "all",
    "isolationEnabled": true,
    "rstpEnabled": true,
    "stpGuard": "disabled",
    "linkNegotiation": "Auto negotiate",
    "portScheduleId": null,
    "schedule": null,
    "udld": "Alert only",
    "linkNegotiationCapabilities": [
      "Auto negotiate",
      "1 Gigabit full duplex (forced)",
      "100 Megabit (auto)",
      "100 Megabit half duplex (forced)",
      "100 Megabit full duplex (forced)",
      "10 Megabit (auto)",
      "10 Megabit half duplex (forced)",
      "10 Megabit full duplex (forced)"
    ],
    "accessPolicyType": "MAC allow list",
    "macAllowList": [
      "[redacted]"
    ],
    "daiTrusted": false,
    "profile": {
      "enabled": false,
      "id": "",
      "iname": null
    },
    "module": {
      "model": null
    },
    "mirror": {
      "mode": "Not mirroring traffic"
    }
  },
  {[redacted – same for Ports 2+]
  }
]
[7/28/2024, 9:25:21 AM] [homebridge-meraki-control] [redacted], [redacted], debug: requesting ports status.
[7/28/2024, 9:25:21 AM] [homebridge-meraki-control] [redacted], [redacted], requesting port status error: TypeError: Cannot read properties of null (reading 'substr').
grzegorz914 commented 1 month ago

Your port name is not defined just is ‘null’ I have added workaround for this case in 1.1.14, please update and let me know. For correct working of this plugin please set name for all ports in your switch in Meraki Dashboard. If you not define ports names then ports without names will be skipped and not published to the Home app.

pl804 commented 1 month ago

1.1.14 resolved the TypeError – thanks! Now I get "debug: found: 0 exposed ports." Do I need to manually make ports available to the plug-in? Let me know if I should open a new issue for this.

grzegorz914 commented 1 month ago

You need define names for your ports in Meraki Dashboard IMG_1001

pl804 commented 1 month ago

Thought they'd default to switch id & port #. Defined names and all is working. Thanks!