WLAN remoute switch on/off

  • 1
  • Question
  • Updated 2 months ago
  • Answered
  • (Edited)
Hi all,
I have a client who would like to have an easy way to switch on/off one of WLAN. The client has two WLANs - one for employee and another one for guests. The ideal solution would be a switch or button. In this way a secretary can push the button and switch on an ofen WLAN for guests.

The client has a controller vSZ-E 3.6
Does anybody have an idea how it can be done?


Photo of Igor Tunakin

Igor Tunakin

  • 42 Posts
  • 13 Reply Likes

Posted 3 months ago

  • 1
Photo of Diego Garcia del Rio

Diego Garcia del Rio

  • 31 Posts
  • 7 Reply Likes
Probably not trivial (we had a similar request).. but you could rely on the SZ API and a raspberry pi which calls the API based on a switch. But nothing out-of-the-box vas far as I can see.

depending on how handy you feel with python.. you could base yourself on something like this:
http://www.oraclealchemist.com/news/real-push-button-refresh-raspberry-pi/

Cheers!


Photo of Alex Shalima

Alex Shalima

  • 45 Posts
  • 18 Reply Likes
Hi Igor,

These are several ways you can do this:

1. Use Scheduler, a build in feature to schedule WLAN operation based on time of the day and day of the week. This method would automatically turn on/off the WLAN based on parameters you give it. This is the easiest way to go.

It can be found in this document, on Page 132
https://support.ruckuswireless.com/documents/2081-smartzone-3-6-administrator-guide-sz100-vsz-e


2. Turn the WLAN on/off using CLI (SSH Command Line Interface)

In this method there would be some sort of script that would add or delete WLAN from the desired WLAN Group. Based on your OS implementation, it can be Bash or Power Shell scripts.

Use this document for reference:
https://support.ruckuswireless.com/documents/2083-smartzone-3-6-command-reference-guide-sz100-vsz-e


3. Same as previous, only using SNMP


4. Same as #2, only using RESTful API


Hope this helps!

Cheers,
Alex
Photo of Diego Garcia del Rio

Diego Garcia del Rio

  • 31 Posts
  • 7 Reply Likes
See here for a quick example on how to do it via the API with python and requests

import requests
import json baseUrl="https://YOUR-IP-HERE:8443/wsg/api/public/v6_0" username="admin" password="YOUR-PASSWORD" zoneId="YOUR-ZONE-ID-AS-UUID" wlanId="YOUR-WLAN-ID-AS-INTGER-ID" enableWlan=True loginData={ "username": username, "password": password, "timeZoneUtcOffset": "+03:00" } headers = {"Content-Type": "application/json;charset=UTF-8"} login=requests.post(baseUrl + "/session", headers=headers, data=json.dumps(loginData)) print login.text print login.status_code if (login.status_code == requests.codes.ok): cookieJar=login.cookies # enable below to list zone and wlan ids you need to fill above # zoneRequests=requests.get( baseUrl + '/rkszones',cookies=cookieJar, headers=headers) # print zoneRequests.text # allWlansRequest=requests.get( baseUrl + '/rkszones/' +zoneId + '/wlans' ,cookies=cookieJar, headers=headers) # print allWlansRequest.text enableWlanData = {"type": "AlwaysOn" if enableWlan else "AlwaysOff"} wlanRequest=requests.patch(baseUrl + '/rkszones/' + zoneId + '/wlans/' + wlanId + '/schedule', cookies=cookieJar, headers=headers, data=json.dumps(enableWlanData)) print wlanRequest.status_code logoutRequest=requests.delete(baseUrl + '/session', headers=headers, cookies=cookieJar) print logoutRequest.status_code
If you're using a url and have proper certificates for the server then use the proper dns name. If you're using the "untrusted"  ruckus cert for the controller, please use the parameter "verify=False" in all the calls to request. (see here http://docs.python-requests.org/en/latest/user/advanced/#ssl-cert-verification )

cheers!
Photo of Igor Tunakin

Igor Tunakin

  • 42 Posts
  • 13 Reply Likes
Thanks for help guys.
I will try to do it with a raspberry pi, python, and API