Virtual HTTP Devices Plug-in v2

I just released v2 of my Virtual HTTP Devices Plug-in. As always, 100% local, 100% standard, mobile friendly and working on openluup/altui as well.

What’s new in v2:

  • Master/Children: now you can just create a master and have any number of children attached. They will still work separately, but this will greatly improve memory consumption on Vera. Please see GitHub for guidance on migration. No need to do it unless you have many devices on your system.
  • async update of device’s status. If you want to update the status of a device separately, just return something different than the HTTP code 200/300 family. it’s useful if your device doesn’t complete the response with the call and you want to update its status. Just use a normal Vera call to update the corresponding variable
  • added support for Scene Controllers (see my post in Shelly i3 for a use case)
  • more work around switches/heaters
  • stabilization and fixes

I’m still not sure I will add it to the official store, so get it from GitHub.

6 Likes

Hello @therealdb,

there is a bug in the dimmable light, the brightness url is missing

1 Like

@therealdb Well done superb plugin :wink:

1 Like

yep, thanks for noticing. fixed in the new version published on GitHub.

Hi @therealdb

Hope all is well, I’m trying to figure out how best I can make a 4 plug IP switch work with your http plugin, any guidance would be appreciated… The details below hopefully will help.

  1. on / off commands for one socket are sent via the following command.
http://192.168.1.199/set.cmd?user=admin+pass=12345678+cmd=setpower+p61=1
http://192.168.1.199/set.cmd?user=admin+pass=12345678+cmd=setpower+p61=0
  1. on/off commands for multiple sockets sent at the same time is as follows
http://192.168.1.199:80/set.cmd?user=admin+pass=12345678+cmd=setpower+p61=1+p62=0+p63=1+p64=0 
  1. the status of all sockets can be requested like this.
http://192.168.1.199/set.cmd?user=admin+pass=12345678+cmd=getpower

Which returns this.

p61=1,p62=0,p63=0,p64=0 
HTTP/1.0 200 OK 
Connection: close 

The last one, (FYI) I’ve got a bit of Lua code to capture the specific socket values.

local http = require "socket.http"
local result, status = http.request("http://192.168.1.199:80/set.cmd?user=admin+pass=12345678+cmd=getpower")
local report = string.match(result, 'p61=%d.p62=%d.p63=%d.p64=%d')
local pw1, pw2, pw3, pw4 = string.match(report, "(p%d+=%d),(p%d+=%d),(p%d+=%d),(p%d+=%d)")
print(string.sub(pw1, -1))
print(string.sub(pw2, -1))
print(string.sub(pw3, -1))
print(string.sub(pw4, -1))

I have the plugin installed and added the on and off commands, but they don’t seem to work. (See below)

@therealdb

Another question I wanted to ask was around future support for command line requests? For example I make a few calls to other devices, e.g. my NAS to see if a VM is running on a host. E.g below.

local command = io.popen("ssh -y -i /etc/dropbear/dropbear_rsa_host_key pi@192.168.1.37 '/QVS/usr/bin/virsh list --all' 2>&1")
print(command)
local msg = command:read("*a")
print(msg)

Which returns this.

Id    Name                           State
----------------------------------------------------
 5     6e856cb2-2793-4acd-9a15-9e1d28ff0caf running
 -     137f2fcf-2db2-43a8-8dc3-9964dfe6aabf shut off
 -     4ad65c4d-99d5-4c2f-aca4-edaca820e8df shut off
 -     7b0f8c69-de6y-4aa2-a601-1414304fff30 shut off
 -     84e9b437-7e09-4ee6-ba4e-201096b9266c shut off
 -     d7216338-8e39-4107-b8e0-2019cd150ed2 shut off
  1. set debugmode variable to 1 and look at logs. There’s maybe something going on.
  2. you could send any complex command via curl support. Look at docs.

If you want to sync back status, you’ll have to write some code. I was thinking of a way to ping an endpoint for status, but I’m not sure it could be an easy task to be general enough.

Hi @therealdb

Just wanted to suggest a possible idea for a future feature and that’s to add a ‘GetStatusURL’ option, where the person can add a url in to get the current status and your plugin will looks for either a “1” or “True” for on, and a “0” or “false” for off being returned.

If their ‘GetStatusURL’ does not return exactly that, then also have a ‘GetStatusLua’ option too, where you can put some Lua code in that the plugin runs to return once again either a “1” or “True” for on, and a “0” or “false” for off.

I appreciate you can do scene for this , and set variables, but I just thought it would be nice to have everything in the same device/plugin etc.

Best Home Automation shopping experience. Shop at getvera!

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules