We have moved at community.getvera.com

Author Topic: MultiSwitch Plugin  (Read 114296 times)

Offline jswim788

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +58/-2
Re: MultiSwitch Plugin
« Reply #405 on: June 14, 2018, 07:18:00 pm »
Code: [Select]
local status = luup.variable_get("urn:dcineco-com:serviceId:MSwitch1","Status2",44)
if status == "0" then
  luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","SetHouseMode", {Mode = 2}, 0)
else
  luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{SceneNum = "167"}, 0)
end
Not from an expert...

Offline cw-kid

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1612
  • Karma: +18/-2
Re: MultiSwitch Plugin
« Reply #406 on: June 15, 2018, 04:55:04 am »
Code: [Select]
local status = luup.variable_get("urn:dcineco-com:serviceId:MSwitch1","Status2",44)
if status == "0" then
  luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","SetHouseMode", {Mode = 2}, 0)
else
  luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","RunScene",{SceneNum = "167"}, 0)
end
Not from an expert...

@jswim788 Thank you  ;)

I have managed to add to the code and get everything working within a single "Away" scene.

Code: [Select]
local status = luup.variable_get("urn:dcineco-com:serviceId:MSwitch1","Status2",44)
if status == "0" then
  luup.inet.wget("http://192.168.1.100:8080/api/rest/speech/tts?text=Entering%20Away%20Mode%20in%20two%20minutes")
  luup.call_action("urn:micasaverde-com:serviceId:HomeAutomationGateway1","SetHouseMode", {Mode = 2}, 0)
  luup.call_action("urn:richardgreen:serviceId:VeraAlert1", "SendAlert", {Message="Entering Away Mode",Recipients="me"}, 45)
else
  luup.inet.wget("http://192.168.1.100:8080/api/rest/speech/tts?text=Warning%20Cancelling%20Away%20Mode,%20another%20door%20or%20window%20upstairs%20is%20still%20opened")
  luup.call_action("urn:richardgreen:serviceId:VeraAlert1", "SendAlert", {Message="Cancelled Away Mode",Recipients="me"}, 45)
end

So if the multiswitch button2 is OFF then it sends a TTS to the Imperihome tablet / Google Home saying "Entering Away Mode in two mintues" it then puts Vera in to Away mode and also send me a Vera Alerts text message stating "Entering Away Mode"

However if the multiswitch button2 is ON then it sends a TTS to the Imperihome tablet announcing "Warning cancelling away mode, another door or upstairs window is still opened"

and it also sends a Vera Alerts text message stating "Cancelled Away Mode"

and it does not put Vera in to Away mode.

Here is how I associated my door / window sensors status with the multiswitch button2 if anyone is wondering.

This should stop me putting Vera into Away mode when the children have left a window opened upstairs.  :)
« Last Edit: June 15, 2018, 05:07:35 am by cw-kid »

Offline cw-kid

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1612
  • Karma: +18/-2
Re: MultiSwitch Plugin
« Reply #407 on: June 29, 2018, 06:18:05 am »
I assume you can create more than one instance of the MultiSwitch device?

By going in to Apps -> My Apps selecting the MultiSwitch and pressing the "Create Another" button.

Is it safe to do this / have more than one MultiSwitch plugin device?

Thanks

Offline pls90

  • Sr. Member
  • ****
  • Posts: 314
  • Karma: +2/-0
Re: MultiSwitch Plugin
« Reply #408 on: June 29, 2018, 07:45:39 am »
It works exactly like you described. I am using a couple of them without any problems.

Offline cw-kid

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1612
  • Karma: +18/-2
Re: MultiSwitch Plugin
« Reply #409 on: June 29, 2018, 08:06:29 am »
It works exactly like you described. I am using a couple of them without any problems.

Thank you.

Offline watsondesign

  • Newbie
  • *
  • Posts: 18
  • Karma: +0/-0
Re: MultiSwitch Plugin
« Reply #410 on: October 03, 2018, 11:29:01 am »
Hi first of all, great plugin... I'm not sure if this has been mentioned or not previously but i cant seem to find anything with a search. Is it possible to delete some of the switches as i only need 4 for what im trying to use it for?

Thanks!

Offline reneboer

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1574
  • Karma: +110/-31
Re: MultiSwitch Plugin
« Reply #411 on: October 04, 2018, 05:33:39 am »
Hi,

Nope it is coded to have eight switches.

Cheers Rene
2xVeraLite, VeraEdge, openLuup, ALTUI, 20 switches, 10 dimmers, 20 sensors, 10 scene controllers, 1 Harmony Hub, many plug-ins. Not enough time.

Offline clausnilsson

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: MultiSwitch Plugin
« Reply #412 on: October 20, 2018, 08:15:02 am »
Hi,
I have read as much as I can find, but cannot figure out why this does not work:

status1 = luup.variable_get("urn:dcineco-com:serviceId:MSwitch1","Status2",62)
status2 = luup.variable_get("urn:dcineco-com:serviceId:MSwitch1","Status3",62)
if (tonumber(Status1) == 1) or (tonumber(Status2) == 1)  then
luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus8",{newStatus8=0},62)
else
luup.call_action("urn:dcineco-com:serviceId:MSwitch1","SetStatus8",{newStatus8=1},62)
end

If button 2 or 3 is on switch button 8 off, otherwise on. But it only switches button 8 on no matter the status of button 2 and 3.
« Last Edit: October 20, 2018, 08:17:11 am by clausnilsson »

Offline jswim788

  • Hero Member
  • *****
  • Posts: 809
  • Karma: +58/-2
Re: MultiSwitch Plugin
« Reply #413 on: October 20, 2018, 02:39:10 pm »
Lua is case sensitive:
Code: [Select]
Status1 = luup.variable_get("urn:dcineco-com:serviceId:MSwitch1","Status2",62)
Status2 = luup.variable_get("urn:dcineco-com:serviceId:MSwitch1","Status3",62)
You've got "status1" and "Status1" - they are not the same, therefore your "if" clause will always hit the "else".

Offline clausnilsson

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: MultiSwitch Plugin
« Reply #414 on: October 20, 2018, 03:23:17 pm »
I DID read that it is case sensitive, but I DID NOT see the problem in my own code. And I thought I had great attention to detail  :-[

Thank you so much.