Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional fields for LTE Backup (Pro) #745

Open
khenderick opened this issue Oct 22, 2024 · 0 comments
Open

Additional fields for LTE Backup (Pro) #745

khenderick opened this issue Oct 22, 2024 · 0 comments

Comments

@khenderick
Copy link

khenderick commented Oct 22, 2024

First of all, thanks for your work. It's awesome to be able to have all this information about my Unifi network available in Home Assistant.

Recently I got myself an LTE Backup Pro (EU version), and I'm missing a few data points that would enable me to easily automate things when my network fails over to LTE.

I've watched the events websocket in my browser's development tools on the unifi webinterface for device:sync events regarding the device, and I'd love to have following fields available in this library, and eventually in Home Assistant:

  • lte_ip which is the public LTE ip address
  • lte_failover which indicates (boolean) whether the device is currently being used (in other words whether the failover is active and the LTE data connection is used).

I think it would make sense to eventually add them as extra attributes to the device tracker.

Below an (anonymized) snippet of such a message in case you don't have access to this device and/or you'd want to add other fields as well.

{
  "meta": {
    "rc": "ok",
    "message": "device:sync",
    "mac": "78:___:08"
  },
  "data": [
    {
      "required_version": "6.2.48",
      "port_table": [
        {
          "port_idx": 1,
          "speed_caps": 1048623,
          "op_mode": "switch",
          "forward": "all",
          "attr_no_edit": true,
          "autoneg": true,
          "enable": true,
          "flowctrl_rx": false,
          "flowctrl_tx": false,
          "full_duplex": true,
          "is_uplink": false,
          "jumbo": false,
          "mac_table_count": 2,
          "media": "GE",
          "name": "Main",
          "poe_caps": 0,
          "port_poe": false,
          "rx_broadcast": 457,
          "rx_bytes": 73102743,
          "rx_dropped": 0,
          "rx_errors": 0,
          "rx_multicast": 2611,
          "rx_packets": 54148,
          "speed": 1000,
          "stp_pathcost": 0,
          "stp_state": "forwarding",
          "tx_broadcast": 121,
          "tx_bytes": 1384671,
          "tx_dropped": 0,
          "tx_errors": 0,
          "tx_multicast": 214,
          "tx_packets": 9593,
          "up": true,
          "tx_bytes-r": 287.27339992600815,
          "rx_bytes-r": 124.86126526082131,
          "bytes-r": 412.13466518682947,
          "port_delta": {
            "time_delta": 10.812,
            "time_delta_activity": 10.812,
            "tx_bytes": 3106,
            "rx_bytes": 1350,
            "tx_packets": 7,
            "rx_packets": 15
          },
          "masked": false,
          "aggregated_by": false
        },
        {
          "port_idx": 2,
          "speed_caps": 0,
          "op_mode": "switch",
          "forward": "all",
          "autoneg": false,
          "enable": true,
          "flowctrl_rx": false,
          "flowctrl_tx": false,
          "full_duplex": false,
          "is_uplink": false,
          "jumbo": false,
          "mac_table_count": 0,
          "poe_caps": 0,
          "port_poe": false,
          "rx_broadcast": 0,
          "rx_bytes": 0,
          "rx_dropped": 0,
          "rx_errors": 0,
          "rx_multicast": 0,
          "rx_packets": 0,
          "speed": 0,
          "stp_pathcost": 0,
          "stp_state": "forwarding",
          "tx_broadcast": 0,
          "tx_bytes": 0,
          "tx_dropped": 0,
          "tx_errors": 0,
          "tx_multicast": 0,
          "tx_packets": 0,
          "up": false,
          "tx_bytes-r": 0.0,
          "rx_bytes-r": 0.0,
          "bytes-r": 0.0,
          "port_delta": {
            "time_delta": 10.812,
            "time_delta_activity": 0.0
          },
          "name": "Port 2",
          "masked": false,
          "aggregated_by": false
        }
      ],
      "has_speaker": false,
      "mesh_sta_vap_enabled": true,
      "license_state": "registered",
      "type": "uap",
      "board_rev": 11,
      "setup_id": "7a___bd-___-ab___f7",
      "hw_caps": 2048,
      "reboot_duration": 30,
      "config_network": {
        "netmask": "255.___.0",
        "dns2": "",
        "ip": "10.___.10",
        "dns1": "10.___.1",
        "type": "static",
        "dnssuffix": "",
        "gateway": "10.___.1",
        "bonding_enabled": false
      },
      "lte_hard_limit": 0,
      "syslog_key": "06___24",
      "model": "ULTEPEU",
      "lte_ext_ant": "disabled",
      "manufacturer_id": 4,
      "sysid": 58898,
      "ip": "10.___.10",
      "fw2_caps": 0,
      "support_wifi6e": false,
      "last_connection_network_name": "network",
      "lte_poe": "disabled",
      "shortname": "ULTEPEU",
      "version": "6.6.68.15277",
      "adoption_completed": true,
      "scan_radio_table": [],
      "unsupported_reason": 0,
      "x_vwirekey": "29c___0a",
      "anon_id": "2f___4e-___-11___ff",
      "supports_fingerprint_ml": false,
      "last_connection_network_id": "63___d6",
      "country_code": 0,
      "countrycode_table": [],
      "antenna_table": [
        {
          "default": true,
          "name": "Combined",
          "id": 4,
          "wifi0_gain": 3
        }
      ],
      "wifi_caps": 18429504,
      "site_id": "63___c2",
      "adopted_at": 1729616819,
      "name": "lte",
      "fw_caps": -1484849345,
      "_id": "67___a0",
      "internet": true,
      "mgmt_network_id": "63___d6",
      "gateway_mac": "7a:___:2a",
      "atf_enabled": true,
      "radio_table": [
        {
          "antenna_gain": 0,
          "builtin_antenna": true,
          "channel": "auto",
          "max_txpower": 22,
          "channel_optimization_enabled": true,
          "builtin_ant_gain": 0,
          "ht": "20",
          "radio": "ng",
          "nss": 3,
          "name": "wifi0",
          "min_txpower": 6,
          "radio_caps": 16420,
          "antenna_id": -1,
          "radio_caps2": 0,
          "current_antenna_gain": 0
        }
      ],
      "connected_at": 1729616840,
      "two_phase_adopt": false,
      "lte_roaming_allowed": true,
      "inform_ip": "10.___.1",
      "lte_state": "ready",
      "cfgversion": "80___05",
      "mac": "78:___:08",
      "provisioned_at": 1729617755,
      "lte_soft_limit": 0,
      "inform_url": "http://10.___.1:8080/inform",
      "upgrade_duration": 150,
      "ethernet_table": [
        {
          "num_port": 2,
          "name": "eth0",
          "mac": "78:___:08"
        }
      ],
      "ble_caps": 0,
      "sys_error_caps": 0,
      "lte_sim_pin": "3172",
      "unsupported": false,
      "dot1x_portctrl_enabled": false,
      "last_uplink": {
        "port_idx": 1,
        "uplink_mac": "18:___:80",
        "uplink_device_name": "co___ch",
        "uplink_remote_port": 24,
        "type": "wire"
      },
      "lte_auth_type": "PAP",
      "disconnected_at": 1729618553,
      "lte_failover_mode": "failover",
      "architecture": "mips",
      "wifi_caps2": 0,
      "x_aes_gcm": true,
      "has_fan": false,
      "has_eth1": false,
      "model_incompatible": false,
      "x_authkey": "cd___09",
      "lte_data_warning_enabled": false,
      "x_ssh_hostkey_fingerprint": "bc:___:89",
      "model_in_eol": false,
      "vwire_table": [],
      "has_temperature": false,
      "switch_caps": {
        "max_aggregate_sessions": 0,
        "feature_caps": 32,
        "max_reserved_routes": 0,
        "vlan_caps": 7,
        "max_static_routes": 0,
        "max_mirror_sessions": 0,
        "max_l3_intf": 0
      },
      "adopted_by_client": "web",
      "lte_apn": "te___.com",
      "model_in_lts": false,
      "kernel_version": "4.4.153",
      "serial": "78___08",
      "fixed_ap_available": true,
      "adopted": true,
      "lte_data_limit_enabled": false,
      "hash_id": "dc___ff",
      "device_id": "67___a0",
      "uplink": {
        "uplink_mac": "18:___:80",
        "uplink_device_name": "co___ch",
        "uplink_remote_port": 24,
        "port_idx": 1,
        "type": "wire",
        "tx_bytes": 2773370,
        "rx_bytes": 4418162,
        "tx_packets": 29555,
        "rx_packets": 28920,
        "tx_bytes-r": 4961.474036850921,
        "rx_bytes-r": 11481.574539363484,
        "full_duplex": true,
        "ip": "0.___.0",
        "mac": "78:___:08",
        "max_vlan": 96,
        "name": "eth0",
        "netmask": "0.___.0",
        "num_port": 2,
        "rx_dropped": 0,
        "rx_errors": 0,
        "rx_multicast": 0,
        "speed": 1000,
        "tx_dropped": 0,
        "tx_errors": 0,
        "up": true,
        "max_speed": 1000,
        "uplink_source": "lldp_uplink",
        "uplink_port_poe_caps": 7
      },
      "state": 1,
      "start_disconnected_millis": 1729618553354,
      "start_connected_millis": 1729618572284,
      "last_seen": 1729621499,
      "next_interval": 10,
      "disconnection_reason": "MISSED_INFORM, last_seen '1729618478', considered_lost '1729618488', state: 1",
      "credential_caps": 0,
      "default": false,
      "discovered_via": "l2",
      "adopt_ip": "10.___.10",
      "adopt_url": "http://10.___.1:8080/inform",
      "x_adopt_username": "Mq___lz",
      "x_adopt_password": "kS___yR",
      "adopt_state": 2,
      "adopt_tries": 1,
      "min_inform_interval_seconds": 10,
      "upgradable": false,
      "adoptable_when_upgraded": false,
      "rollupgrade": false,
      "known_cfgversion": "80___05",
      "uptime": 4036,
      "_uptime": 4036,
      "locating": false,
      "connect_request_ip": "10.___.10",
      "connect_request_port": "34___16",
      "sys_stats": {
        "loadavg_1": "0.31",
        "loadavg_15": "0.20",
        "loadavg_5": "0.26",
        "mem_buffer": 0,
        "mem_total": 128851968,
        "mem_used": 73932800
      },
      "system-stats": {
        "cpu": "9.3",
        "mem": "57.4",
        "uptime": "4036"
      },
      "ssh_session_table": [],
      "lldp_table": [
        {
          "chassis_descr": "US-24-250W, 7.1.26.15869, Linux 3.6.5",
          "chassis_id": "18:___:80",
          "is_wired": true,
          "local_port_idx": 1,
          "local_port_name": "eth0",
          "port_descr": "public _lte_",
          "port_id": "Port 24"
        }
      ],
      "displayable_version": "6.6.68",
      "connection_network_id": "63___d6",
      "connection_network_name": "network",
      "startup_timestamp": 1729617463,
      "is_access_point": false,
      "safe_for_autoupgrade": true,
      "scanning": false,
      "spectrum_scanning": false,
      "meshv3_peer_mac": "",
      "element_peer_mac": "",
      "guest_kicks": 0,
      "guest_token": "CB___87",
      "satisfaction": -1,
      "hide_ch_width": "all",
      "lte_connected": "yes",
      "lte_imei": "35___13",
      "lte_iccid": "89___51",
      "lte_radio": "home",
      "lte_ip": "100.___.41",
      "lte_networkoperator": "TLN",
      "lte_pdptype": "IPV4",
      "lte_rat": "LTE",
      "lte_signal": "Weak signal strength (2)",
      "lte_mode": "LTE",
      "lte_band": "eutran-3",
      "lte_rx_chan": "1850",
      "lte_tx_chan": "19850",
      "lte_rssi": "-79",
      "lte_rsrq": "-14",
      "lte_cell_id": "12___24",
      "lte_radio_mode": "LTE",
      "lte_rsrp": "-112",
      "lte_failover": false,
      "total_tx_bytes": 7267,
      "total_rx_bytes": 10393,
      "lte_is_sim_pin_required": true,
      "lte_sim_pin_tries_left": 3,
      "lte_is_sim_pin_verified": true,
      "isolated": false,
      "radio_table_stats": [
        {
          "name": "wifi0",
          "last_channel": 0,
          "radio": "ng",
          "ast_txto": null,
          "ast_cst": null,
          "ast_be_xmit": null,
          "cu_total": 0,
          "cu_self_rx": 0,
          "cu_self_tx": 0,
          "gain": 0,
          "satisfaction": -1,
          "state": "INIT",
          "num_sta": 0,
          "guest-num_sta": 0,
          "user-num_sta": 0
        }
      ],
      "downlink_lldp_macs": [],
      "vap_table": [],
      "downlink_table": [],
      "vwire_vap_table": [],
      "bytes-d": 0,
      "tx_bytes-d": 0,
      "rx_bytes-d": 0,
      "bytes-r": 0,
      "lcm_brightness": 1,
      "detailed_states": {
        "uplink_near_power_limit": false
      },
      "stat": {
        "ap": {
          "site_id": "63___c2",
          "o": "ap",
          "oid": "78:___:08",
          "ap": "78:___:08",
          "time": 1729618500000,
          "datetime": "2024-10-22T17:35:00Z",
          "user-rx_packets": 0.0,
          "guest-rx_packets": 0.0,
          "wifi0-rx_packets": 0.0,
          "rx_packets": 0.0,
          "user-rx_bytes": 0.0,
          "guest-rx_bytes": 0.0,
          "wifi0-rx_bytes": 0.0,
          "rx_bytes": 0.0,
          "user-rx_errors": 0.0,
          "guest-rx_errors": 0.0,
          "wifi0-rx_errors": 0.0,
          "rx_errors": 0.0,
          "user-rx_dropped": 0.0,
          "guest-rx_dropped": 0.0,
          "wifi0-rx_dropped": 0.0,
          "rx_dropped": 0.0,
          "user-rx_crypts": 0.0,
          "guest-rx_crypts": 0.0,
          "wifi0-rx_crypts": 0.0,
          "rx_crypts": 0.0,
          "user-rx_frags": 0.0,
          "guest-rx_frags": 0.0,
          "wifi0-rx_frags": 0.0,
          "rx_frags": 0.0,
          "user-tx_packets": 0.0,
          "guest-tx_packets": 0.0,
          "wifi0-tx_packets": 0.0,
          "tx_packets": 0.0,
          "user-tx_bytes": 0.0,
          "guest-tx_bytes": 0.0,
          "wifi0-tx_bytes": 0.0,
          "tx_bytes": 0.0,
          "user-tx_errors": 0.0,
          "guest-tx_errors": 0.0,
          "wifi0-tx_errors": 0.0,
          "tx_errors": 0.0,
          "user-tx_dropped": 0.0,
          "guest-tx_dropped": 0.0,
          "wifi0-tx_dropped": 0.0,
          "tx_dropped": 0.0,
          "user-tx_retries": 0.0,
          "guest-tx_retries": 0.0,
          "wifi0-tx_retries": 0.0,
          "tx_retries": 0.0,
          "user-mac_filter_rejections": 0.0,
          "guest-mac_filter_rejections": 0.0,
          "wifi0-mac_filter_rejections": 0.0,
          "mac_filter_rejections": 0.0,
          "user-wifi_tx_attempts": 0.0,
          "guest-wifi_tx_attempts": 0.0,
          "wifi0-wifi_tx_attempts": 0.0,
          "wifi_tx_attempts": 0.0,
          "user-wifi_tx_dropped": 0.0,
          "guest-wifi_tx_dropped": 0.0,
          "wifi0-wifi_tx_dropped": 0.0,
          "wifi_tx_dropped": 0.0,
          "user-duration": 0.0,
          "guest-duration": 0.0,
          "wifi0-duration": 0.0,
          "duration": 11000.0,
          "bytes": 0.0,
          "port_1-rx_packets": 4109.0,
          "port_1-rx_bytes": 361881.0,
          "port_1-tx_packets": 1934.0,
          "port_1-tx_bytes": 771847.0,
          "port_1-rx_multicast": 1876.0,
          "port_1-rx_broadcast": 322.0,
          "port_1-tx_multicast": 97.0,
          "lte_rxbytes": 435.0,
          "lte_txbytes": 435.0
        }
      },
      "tx_bytes": 7267,
      "rx_bytes": 10393,
      "bytes": 0,
      "vwireEnabled": false,
      "uplink_table": [],
      "num_sta": 0,
      "user-num_sta": 0,
      "user-wlan-num_sta": 0,
      "guest-num_sta": 0,
      "guest-wlan-num_sta": 0,
      "x_has_ssh_hostkey": true
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant