Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I have one set of control (on/off) buttons for multiple devices?
#1
I want to create a small UI for my PPC that will allow me to control the lights from it. I'd like to have a number of buttons along the top for the diff rooms. Below those I'd like to have controls for On, Off, and the level of lighting. When I tap on the "Living Room" button I can click the On button to turn on the Living room lights. Then I tap on "Kitchen" and click the same On buttong to turn on the kitchen lights. Is this possible? How do I do this?
Reply
#2
Pretty easy in 2.0 using a global variable and an if-then. Set a global variable i.e., "RoomToControl"=LivingRoom when you tap the "living room" button.

Then, in the "On" command button, have the following (it's psuedo-code. The actual code looks scary, but it's mostly done through point&click so I won't post it)
Code:
IF GVar:RoomToControl = LivingRoom
THEN
   WhateverYouDoToTurnOnLivRmLights
ELSE
  IF GVar:RoomToControl = Kitchen
  THEN
     WhateverYouDoToTurnOnKitchenLights
   ENDIF
ENDIF
------------------------------------
Some of my devices: Sonos, Aeotec zWave, Nest, Rain8Net, Various H/T
What's next: CQC-Voice, Brultech GEM
My vlogs: https://www.youtube.com/c/IVBsHomeAutomation
Reply
#3
IVB Wrote:Pretty easy in 2.0 using a global variable and an if-then. Set a global variable i.e., "RoomToControl"=LivingRoom when you tap the "living room" button.

Then, in the "On" command button, have the following (it's psuedo-code. The actual code looks scary, but it's mostly done through point&click so I won't post it)
Code:
IF GVar:RoomToControl = LivingRoom
THEN
   WhateverYouDoToTurnOnLivRmLights
ELSE
  IF GVar:RoomToControl = Kitchen
  THEN
     WhateverYouDoToTurnOnKitchenLights
   ENDIF
ENDIF


Hmm, thats close, but not quite what I want. I want to have something more like:
"Devices::Field Write(GVAR:RoomToControl,100) On Click"

And any time I click the room button it will set the GVar:RoomToControl to the correct value.

I don't want to have to do a lot of IF statements. That makes it a pain to add any new rooms and the code gets very long when I have at least 8 rooms already.

Is this possible in 2.0?
Reply
#4
As long as the lighting fields you want to write to are consistently named, then you can set up a variable in each button that can be used to then build up the correct field in the buttons of the overlay, by just appending a few things to a variable to build up the whole name, and then do the write.

If they are consistently enough named, then no logic would be required. I.e. if every reach had a XXXLights, where XXX is the name of the room, then just set the variable to that XXX value, then build up a string by setting a variable to XX value, then append Lights and then write the value.
Dean Roddey
Explorans limites defectum
Reply
#5
Would you use a Global Variable if you want to control a device from multiple zones? If so why would you ever not make it a Global Variable?
tia, Ron

My HT equipment I want to control by CQC (some day hopefully)
Yamaha CX-A5100, Dune HD pro 4k, Dune HD Pro 4k plus, ISY 994i, LG 86" 4k FP, and a projector in the future
Reply
#6
Dean Roddey Wrote:As long as the lighting fields you want to write to are consistently named, then you can set up a variable in each button that can be used to then build up the correct field in the buttons of the overlay, by just appending a few things to a variable to build up the whole name, and then do the write.

If they are consistently enough named, then no logic would be required. I.e. if every reach had a XXXLights, where XXX is the name of the room, then just set the variable to that XXX value, then build up a string by setting a variable to XX value, then append Lights and then write the value.

Yup, all lights will be named consistently. I don't think I understand exactly how to do what you're saying though. In my current implementation I am only doing it on a single screen that is not using multiple overlays. I admit I still learning at this Smile I'd like to have just one variable (selectedLight) that any button can set and then when I click the On button it uses that variable name as in my wish code above.

Also, how do I go about getting a download of the 2.0 beta? Smile
Reply
#7
Sendero Wrote:Yup, all lights will be named consistently. I don't think I understand exactly how to do what you're saying though. In my current implementation I am only doing it on a single screen that is not using multiple overlays. I admit I still learning at this Smile I'd like to have just one variable (selectedLight) that any button can set and then when I click the On button it uses that variable name as in my wish code above.

Also, how do I go about getting a download of the 2.0 beta? Smile
try this..

http://www.charmedquark.com/Web2/Downloa...1_7_15.Zip
tia, Ron

My HT equipment I want to control by CQC (some day hopefully)
Yamaha CX-A5100, Dune HD pro 4k, Dune HD Pro 4k plus, ISY 994i, LG 86" 4k FP, and a projector in the future
Reply
#8
Wait a bit and get the 1.7.16 version. It fixes some known issues, and you might as well start with that. I'm testing it now.
Dean Roddey
Explorans limites defectum
Reply
#9
Quote:Yup, all lights will be named consistently. I don't think I understand exactly how to do what you're saying though. In my current implementation I am only doing it on a single screen that is not using multiple overlays. I admit I still learning at this Smile I'd like to have just one variable (selectedLight) that any button can set and then when I click the On button it uses that variable name as in my wish code above.

That'll work. The buttons at the top just set the variable. The buttons at the bottom, when pressed, use that variable to build up the name of the fields they will write to.

You will want to have an OnLoad of the template to set the variable to some initial value so that it's always set.
Dean Roddey
Explorans limites defectum
Reply
#10
Dean Roddey Wrote:That'll work. The buttons at the top just set the variable. The buttons at the bottom, when pressed, use that variable to build up the name of the fields they will write to.

You will want to have an OnLoad of the template to set the variable to some initial value so that it's always set.

Cool, I'll wait for the next version of the beta to be ready.


In the meantime, another question: Is there an easy way to do search/replace on a set of widgets? The full experience UI has a number of lightswitch graphics for controlling lights in diff areas. When I make new areas I select the set of widgets and copy/paste them but then I manually have to go into each one and change the target. I figure there has to be an easier way to do this.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Hue Lighting Control jokermac 17 6,665 03-28-2020, 06:18 AM
Last Post: jokermac
  ZWave / Add all devices or just as you need them? gReatAutomation 2 1,321 09-16-2019, 01:42 PM
Last Post: gReatAutomation
  Jandy Pool Control avtexan 20 8,908 06-07-2018, 01:09 PM
Last Post: Dean Roddey
  Multiple IV clients on the same machine NightLight 4 2,948 01-03-2017, 05:52 PM
Last Post: NightLight
  Fonts, mobile devices IVB 5 3,013 08-14-2016, 06:54 PM
Last Post: sic0048
  Use single On/Off/Slider to control group jkmonroe 3 3,149 08-06-2016, 09:28 AM
Last Post: pinballmark
  Help figuring out projector serial control! Deane Johnson 19 8,595 07-30-2016, 11:08 AM
Last Post: Deane Johnson
  Harmony Hub Device Control jkmonroe 6 4,889 07-03-2016, 02:36 PM
Last Post: potts.mike
  how deep is your (echo voice control) love? IVB 197 51,140 05-23-2016, 08:47 AM
Last Post: Dean Roddey
  delete zwave devices? jkmonroe 8 5,139 05-23-2016, 08:46 AM
Last Post: Dean Roddey

Forum Jump:


Users browsing this thread: 1 Guest(s)