Zyxel Wifi AP - How to read and change radio settings in HA

Got a new Wifi AP, Zyxel NWA50AX PRO, and now I am looking for a way to integrate it into my HA instance.

I am particularly interested in toggling the Wifi antenna on and off. But I would also like to display other states and values (e.g. Output Power)

HA has no native integration for Zyxel devices, so I was thinking of using the SNMP protocol. Unfortunately, this model does not seem to offer SNMP support. The alternative would be to install OpenWRT, but I’m still a bit wary of that, and I’m not sure whether OpenWRT supports SNMP on this device.

Has anybody successfully integrated a Zyxel AP in HA (either way) and is willing to share their knowledge?

1 Like

I am sure OpenWRT supports SNMP everywhere, just a case of installing the SNMP package.

1 Like

Any luck finding a solution for Zyxel NWA50AX? I am also looking for integration…

i also looking forward to solution for zyxel HA integration

  • NWA55AXE
    anybody have found it and can help?

The Zyxel NWA50AX Pro has a command line interface available via ssh. Go to the support page for your model and download the CLI Reference Guide.
Using the Command Line integration, you can send commands using ssh e.g.

echo -e 'enable\nshow cpu status\nexit' | sshpass -p 'PASSWORD' ssh -o StrictHostKeyChecking=no -tt USER@HOST

There are a number of issues with Zyxel’s implementation of ssh, or perhaps my code.
Only interactive sessions are allowed, hence using echo to pipe the command to ssh.
I have not found a way to load ssh certificates onto the device and needed to use sshpass. See Add sshpass to the supervised / docker container to add sshpass to the HA docker container and Use apt-get commands to to install it after Home Assistant is updated.

These are the command line sensors I have:

command_line:
# nwa50axpro
  - sensor:
      name: nwa50axpro cpu usage
      command: echo -e 'enable\nshow cpu status\nexit' | sshpass -p 'PASSWORD' ssh -tt -o StrictHostKeyChecking=no USER@HOST | awk '/CPU utilization:/ {print $3}'
      unit_of_measurement: "%"
      unique_id: nwa50axpro_cpu_usage
      scan_interval: 60
  - sensor:
      name: nwa50axpro memory usage
      command: echo -e 'enable\nshow mem status\nexit' | sshpass -p 'PASSWORD' ssh -tt -o StrictHostKeyChecking=no USER@HOST | awk '/usage/ {print substr($3, 1, length($3)-1)}'
      unit_of_measurement: "%"
      unique_id: nwa50axpro_memory_usage
      scan_interval: 300
  - sensor:
      name: nwa50axpro storage free
      command: echo -e 'enable\nshow disk\nexit' | sshpass -p 'PASSWORD' ssh -tt -o StrictHostKeyChecking=no USER@HOST | awk '/onboard flash/ {print (1 - (substr($5, 1, length($5)-1) / 100)) * $4}'
      unit_of_measurement: "MiB"
      unique_id: nwa50axpro_storage_free
      scan_interval: 3600
  - sensor:
      name: nwa50axpro storage usage
      command: echo -e 'enable\nshow disk \nexit' | sshpass -p 'PASSWORD' ssh -tt -o StrictHostKeyChecking=no USER@HOST | awk '/onboard flash/ {print substr($5,1,length($5)-1)}'
      unit_of_measurement: "%"
      unique_id: nwa50axpro_storage_usage
      scan_interval: 3600
  - sensor:
      name: nwa50axpro uptime
      command: echo -e 'enable\nshow system uptime\nexit' | sshpass -p 'PASSWORD' ssh -tt -o StrictHostKeyChecking=no USER@HOST | awk '/system uptime:/ {if ($4 =="days")  print $3 ; else print "0"}'
      unit_of_measurement: "days"
      unique_id: nwa50axpro_uptime
      scan_interval: 3600

A nice feature is the ability to upload scripts of commands to the NWA50AX Pro. I use this script to switch off all Wi-Fi the device.

# WiFi off (wifioff.zysh)
configure terminal
wlan slot1
no activate
exit
wlan slot2
no activate
exit
exit

And run it with this command:

echo -e 'enable\nrun /script/wifioff.zysh\nexit' | sshpass -p 'PASSWORD' ssh -tt -o StrictHostKeyChecking=no USER@HOST 

Alternately there is the python library netmiko, a multi-vendor library to simplify CLI connections to network devices. You can use it like this:

from netmiko import ConnectHandler
connection = ConnectHandler(host='HOST', port='22', username='USER', password='PASSWORD', device_type='zyxel_os')
output = connection.send_command('show cpu status')
print(output)
print('Closing Connection')
connection.disconnect()
1 Like