VERA

From Domoticz
Jump to navigation Jump to search

Principles

Following devices you have in the Vera, you *must* chose who will be the master (the one that initiates) and who will be the slave (the one executing). You can't have both at the same time or for example a switch you would get an infinite loop of each device asking the other to change its state.

A common pattern to have :

  • a switch has Domoticz as a master, and Vera as a slave
  • a power unity or temperature get its information from a sensor, and propagates from Vera to Domoticz, so Vera is the master and Domoticz the slave
  • a door/window sensor is activated, and propagates from Vera to Domoticz, so Vera is the master and Domoticz the slave.

How to prepare

Domoticz

  • Create in Setup/Hardware a hardware of the type "Dummy", let's call it VERA and click Add
  • Now it is created, click on it on the button "Create Virtual sensor"
  • Add as many virtual devices as you need to expose in Domoticz
  • Now go to Setup/Devices and mark down their device number

Vera

  • Under "Apps" install the one called EventWatcher
  • Then click on the configuration link of the app
  • Click on "Devices"

You will get there the id list of all your vera devices you will use later

Devices specific installation

Switch Master on Vera and slave on Domoticz

  • Go to "Automation" and click "New scene"
  • Under "Trigger" gives is a name (instead of "new scene" by default)
  • For each device that will be master on Vera (and thus push a state do Domoticz) do the following (you can do it all in the same scene):
  • Click on "add trigger"
  • Select the vera device in the list
  • Select "a device is turned on or off"
  • Give the trigger a name "Name for this trigger:" ; if this is a switch you will have to make two, one for On and one for Off, better to add this in the name
  • Select "device is turned on" for the first trigger (and do the "device is turned off" as a second trigger later)
  • Click "back to trigger" to return to the triggers list
  • Now on that device click on "Luup event"
  • input the following, replacing "433" by your device Id in domoticz, and adapt your domoticz IP
   local status, result = luup.inet.wget("http://192.168.0.28:8080/json.htm?type=command&dparam=switchlight&idx=433&switchcmd=On", 5)
  • Click on "Save"
  • In Domoticz, it is better to make the switch as "protected" in its options.

Switch Master Domoticz and Slave on Vera

  • On Domoticz, edit the virtual switch you will match to the one in Vera
  • Fill in the On Action with this (change to your IP and replace 41 by your vera device ID)
   http://192.168.0.26:3480/data_request?id=lu_action&output_format=json&DeviceNum=41&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=100
  • Fill in the Off Action with this (change to your IP and replace 41 by your vera device ID)
   http://192.168.0.26:3480/data_request?id=lu_action&output_format=json&DeviceNum=41&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget&newLoadlevelTarget=0
  • click on "Save"

Energy device

Vera

Fibraro wall plug

FWP:schedule 10mn local kw = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "Watts", 69) luup.log(kw)

local kwh = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "KWH", 69)*1000 luup.log(kwh)

local status, result = luup.inet.wget("http://192.168.0.28:8080/json.htm?type=command&dparam=udevice&idx=267&nvalue=0&svalue="..kw..";"..kwh, 5)

Nuon 6 plugs

Nuon: schedule -- Multiprise #1 -- 70 1 Multiprise Salon BinaryLight 28 local kw = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "Watts", 70) local kwh = luup.variable_get("urn:micasaverde-com:serviceId:EnergyMetering1", "KWH", 70)*1000 local status, result = luup.inet.wget("http://192.168.0.28:8080/json.htm?type=command&dparam=udevice&idx=268&nvalue=0&svalue="..kw..";"..kwh, 5)