Skip to content

[plugin][freebox] KeyError: missing entries in device_type_map #1084

@mathoudebine

Description

@mathoudebine

Is there an existing issue for this?

The issue occurs in the following browsers. Select at least 2.

  • Firefox
  • Chrome
  • Edge
  • Safari (unsupported) - PRs welcome
  • N/A - This is an issue with the backend

Current Behavior

Freebox plugin fails during scan with the following error:

Traceback (most recent call last):
  File "/app/front/plugins/freebox/freebox.py", line 177, in <module>
    main()
  File "/app/front/plugins/freebox/freebox.py", line 161, in main
    watched3=map_device_type(host.get("host_type", "")),
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/front/plugins/freebox/freebox.py", line 74, in map_device_type
    return device_type_map[type]
           ~~~~~~~~~~~~~~~^^^^^^
KeyError: 'outlet'

The 'outlet' device type is missing in the map:
https://github.com/jokob-sk/NetAlertX/blob/b797713b2d205e9d0d7dd3d3ad791ebad4d494bb/front/plugins/freebox/freebox.py#L47-L70

Several other smart home-related types are also missing (from Freebox Server latest firmware):

  • watch
  • light
  • outlet
  • appliances
  • thermostat
  • shutter

Expected Behavior

Freebox plugin works properly with new device types from Freebox Server

Steps To Reproduce

  1. From your Freebox Server web interface, configure at least one device of the following type:
  • Smartwatch
  • Light
  • Connected outlet
  • House appliance
  • Thermostat
  • Shutter

Image

  1. From NetAlertX interface, enable the freebox plugin in Settings > Core > Loaded Plugins
  2. Follow the freebox plugin documentation https://github.com/jokob-sk/NetAlertX/tree/main/front/plugins/freebox to configure the plugin and pair with the Freebox Router
  3. Wait for plugin first scan

app.conf

docker-compose.yml

What installation are you running?

Production (netalertx)

app.log

17:47:03 [Scheduler] run for FREEBOX: YES
17:47:03 [Plugin utils] ---------------------------------------------
17:47:03 [Plugin utils] display_name: Freebox
17:47:03 [Plugins] Executing: python3 /app/front/plugins/freebox/freebox.py
17:47:04 [plugin_helper] reading config file
17:47:03 [FREEBOX] In script
17:47:03 [FREEBOX] Settings: {'api_address': '192.168.1.1', 'api_version': 6, 'api_port': 80}
17:47:04 {'name_dns': 'freebox-server', 'name': 'Freebox Server', 'name_mdns': 'Freebox-Server', 'mode': 'router', 'name_netbios': 'Freebox_Server', 'ip': '192.168.1.1', 'mac': '[hidden]', 'operator': 'free_fra'}
17:47:04 [{'l2ident': {'id': '[hidden]', 'type': 'mac_address'}, 'active': True, 'persistent': True, 'names': [{'name': 'wlan0', 'source': 'dhcp'}], 'vendor_name': 'Tuya Smart Inc.', 'host_type': 'outlet', 'interface': 'pub', 'id': 'ether-[hidden]', 'last_time_reachable': 1749656785, 'primary_name_manual': True, 'l3connectivities': [{'addr': '192.168.1.103', 'active': True, 'reachable': True, 'last_activity': 1749656785, 'af': 'ipv4', 'last_time_reachable': 1749656785}], 'access_point': {'rx_bytes': 7835709, 'type': 'gateway', 'tx_bytes': 728208, 'tx_rate': 12, 'uid': '2bf633aa0536910c4d8e8cde9a4cbe88', 'connectivity_type': 'wifi', 'wifi_information': {'band': '2d4g', 'sess_duration': 162566, 'phy_rx_rate': 10, 'ssid': '[hidden]', 'standard': 'n', 'bssid': '[hidden]', 'phy_tx_rate': 10, 'signal': -88}, 'rx_rate': 51, 'mac': '[hidden]'}, 'default_name': 'wlan0', 'first_activity': 1749208386, 'reachable': True, 'last_activity': 1749656785, 'primary_name': 'Compteur Tuya Panneau solaire'}]
Traceback (most recent call last):
  File "/app/front/plugins/freebox/freebox.py", line 177, in <module>
    main()
  File "/app/front/plugins/freebox/freebox.py", line 161, in main
    watched3=map_device_type(host.get("host_type", "")),
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/front/plugins/freebox/freebox.py", line 74, in map_device_type
    return device_type_map[type]
           ~~~~~~~~~~~~~~~^^^^^^
KeyError: 'outlet'

17:47:04 [Plugins] ⚠ ERROR - enable LOG_LEVEL=debug and check logs
17:47:04 [Plugins] No output received from the plugin "FREEBOX"

Debug enabled

  • I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Docker 🐋Docker relatedbug 🐛Something isn't workingnext release/in dev image 🚀This is coming in the next release or was already released if the issue is Closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions