|  Help center

MiOS search

Create Virtual Devices in EZLogic

Virtual devices can help save you time in automations and can act as a ‘universal translator’ for unsupported devices. A virtual switch, for example, lets you control physical devices and meshbots that are monitoring the state of the virtual switch.

The example on this page shows you how to create a simple ‘On/Off’ virtual switch.

Install the Virtual Devices plugin on your controller

You need to install the virtual devices plugin in order to create virtual switches on your controller.

  • SSH into your Ezlo controller using Putty or another SSH client. You can download the Putty client at https://www.putty.org/
  • Access the controller with the following credentials:

    • Username — root
    • Password — found on the sticker underneath your controller.
  • Run these two commands at the prompt:

opkg update

opkg install firmware-plugins-test_plugin

  • Reboot your hub to complete the plugin installation. Type ‘reboot’ at the Putty (or other client) window then hit ‘Enter’.
  • You can move onto the next step once the controller has rebooted.
Create your Virtual Switches

The following section shows you how to create simple On/Off virtual switches. This type of device is known as a ‘plug_interior’ switch in the MiOS api.

  • Open the MiOS API Tool page at https://apitool.ezlo.com/dashboard
  • Login with your MiOS/Ezlo/Vera username and password.
  • Select your controller in the ‘Connection Establishment’ menu then click ‘Connect’:
  • Select ‘Custom’ in the ‘Commands’ menu.
  • Paste the following command into the resulting text box then click ‘Send’:
				
					{
 "method": "extensions.plugin.run",
 "id": "_ID_",
 "params": {
 "script": "HUB:test_plugin/scripts/generate_devices",
 "scriptParams": {
 "device_type": "plug_interior",
 "devices_count": 1
 }
 }
}
				
			
  • This will automatically create a virtual switch in the EZLogic > ‘Devices’ area with a default name similar to ‘TestSwitch_1’.

    • Tip – You can change “devices_count” in the command to any number. For example, “devices_count”:4 will create 4 virtual devices.
  • Next, login to EZLogic and open the ‘Devices’ menu:
  • Locate the new virtual switches. They will initially have default names like ‘TestSwitch_1’ etc. The following image shows what you’d see if you created 4 new virtual switches (“devices count”: 4):

You can rename these switches to whatever you like at any time. For example:

  • These switches will automatically appear in your dynamic dashboard as shown below:
Example – Use a Virtual Switch to Control a Meshbot

The following example explains how to use a virtual switch to quickly enable or disable a motion sensor meshbot. We assume the following scenario:

  • You have a motion sensor meshbot set to keep your lounge lights on if it detects motion, and turn it off if there is no motion FOR 3 minutes.

    • The ‘FOR’ 3 minutes part ensures the light will not suddenly turn off if people just stop moving for a few seconds.
  • However, you sometimes have guests staying over-night who sleep on your sofa. In this case, you don’t want the motion sensor meshbot to run because the lights would turn on as your guest tosses and turns in their sleep.
  • Similarly, you might want to quickly disable motion detection lights if you are watching a movie and don’t want to be disturbed.
  • You can use a virtual switch to quickly enable or disable the meshbot via EZLogic, the mobile app, or by voice-command.

First, create a virtual switch as explained earlier and rename it as ‘Motion Sensor V. Switch’ (or something similar):

Next, set up your motion detection meshbot:

  • Click ‘Meshbot Automation’ > ‘Create new Meshbot’ > ‘Local’:
  • Create a meshbot called ‘Motion Detection Lounge Lights’ with a trigger and true/false actions as follows:
  • Now create a second meshbot which uses your virtual switch to enable/disable the ‘Motion Detection…’ meshbot.
  • Set up the meshbot as shown below:
  • You can now use the virtual switch in the EZLogic dashboard or MiOS/Vera app to quickly toggle motion detection on or off:
Alternatively…

You could achieve similar results in a single meshbot by adding an exception to the ‘false’ action.

  • Set your motion trigger to true if no motion is detected for three minutes (exactly the same as before).
  • Make your ‘True’ action turn the lights off (also the same as above).
  • Create a ‘False’ action to turn the lights on (again, same as above).
  • Add an exception to the ‘False’ action so it only runs IF the virtual switch is set to ‘Off’
  • Your motion-based lights meshbot will operate as normal if your virtual switch is ‘On’.
  • You can disable motion activated lights as before by simply turning the virtual switch ‘Off’.
Create other types of Virtual Devices
  • You can also create other types of virtual devices apart from simple switches.
  • Just replace “plug_interior” in the command with any of the ‘Supported device types’ listed on this api page:

Some example commands for other device types:

Virtual Motion Sensor

				
					{
 "method": "extensions.plugin.run",
 "id": "_ID_",
 "params": {
 "script": "HUB:test_plugin/scripts/generate_devices",
 "scriptParams": {
 "device_type": "motion_sensor",
 "devices_count": 1
 }
 }
}
				
			

Virtual Thermostat

				
					{
 "method": "extensions.plugin.run",
 "id": "_ID_",
 "params": {
 "script": "HUB:test_plugin/scripts/generate_devices",
 "scriptParams": {
 "device_type": "thermostat",
 "devices_count": 1
 }
 }
}
				
			

Virtual Door Lock

				
					{
 "method": "extensions.plugin.run",
 "id": "_ID_",
 "params": {
 "script": "HUB:test_plugin/scripts/generate_devices",
 "scriptParams": {
 "device_type": "door_lock",
 "devices_count": 1
 }
 }
}