Bathroom Fan Piston + GE Switch + Relay At Fan = Push Button 10/20/30/60/Off Timer


#2

what device is keypad 22?


#3

were you looking for something like this?


#4

keypad22 was a button remote so i didnt have to test it from the room itself. yea thats much simpler.

i was originally shooting for being able to set 4 switches that are on the wall in list one and 4 relays in list 2 that turn on from counter time 1-4 and 5 being off or 0 min

i had taken the index out to keep it running, i really like what you have here, thank you


#5

so i finally had some time to test it.

the response time is much much faster, the fan used to take 2-3 seconds to turn on, the switch is turned off much quicker aswell, close enough to a push button

i have a label on the switch that says “When blue light is on, push for time”

i added to your tenary (had no idea this was possible, very cool feature cascading them through the options)

added and or counter 5 becuase it wasnt turning off.

added a set minutesleft to 0 which and moved it so it would set the state and tile correctly. no biggie.

if you have some time id like to see how youd make 2 lists of devices and use currentevent device to pull its spot (or by name) from list 2. but if you dont get to it, im still greatful for what ive learned from your version of it.

here is the latest i have if anyone wants to use it,


#6

what are you looking to achieve here?


#7

i would like to have one piston for all the fans. i was originally experimenting with indexes and arrays from the popular welcome home piston, alot of it was a tough learning curve but itd be nice to put the relays in one list, and switches in another, and…

if the current event device is the 5th device in the switch device list, turn on the 5th device in relay device list

or be im really picky on naming devices, i tried to use the functions for text to edit the name to the relay but i couldnt get it to set in a device variable. example currentevendevice is Master Bathroom Fan Switch, i trimmed off switch and added “Relay”/ i have over 100 “things” so it helps keeping things neat and accessible quickly


#8

I was messing around trying to achieve this sort of effect as well. There does not appear to be any sort of mechanism to determine the (let’s use the common term here) index value of the $currentEventDevice within the device list variable. Well…at least none that I could find. Perhaps there is and I just don’t know about it yet.

Now I do believe that if there isn’t then you could find it yourself by using a loop to iterate through the device list and testing the $currentEventDevice till you find a match. You’d have to keep a counter going and then exit the loop when you find your match. That in theory could get you the index value of the current device within the list of devices. But it almost seems like there should be a built-in way to get at that…

I don’t know though. I look forward to the replies here…


#9

got it. thats possible to do. the only challenge is when using device variables there is no way to select the sequence of devices in the device variable. are all your relays and switches named so that when they are assigned to 2 different device variables the correct relay / switch pair occupies the same position (1st, 2nd, …, nth) in each device variable?

EDIT: also see this :slight_smile:


#10

Hey bangali, yes they are all named to what they are. Its great for me to quickly find the device in the list of 130 or so and 6 are virtual. I dont use groups much in ST as i moved things around early on and it was a headache.

When i had it all controllable by alexa i used hyphenated 6 letter shortforms because she always spit back a sorry with most items having the ssme 4 words. Ex: GA-SW-OL is garage-switch-overhead lights, GA-EM-EP garage energy monitor electrical panel.

To the important stuff… my bath fan devices are as,

Downstairs Bathroom Fan Switch/Relay
Master Bath Fan Switch/Relay
Guest Bath Fan Switch/Relay
Laundry Room Fan Switch/Relay

2 devices each, first 3 words the same. If its possible id love to see it, find out where i went wrong.

You might be able to use thr nested tenary again with more logic wrapped for a second true/false for the name portion


#11

hey @JaggedIce … err which thread did you mean to respond to? :slight_smile:


#12

These, this forum style difficult on a mobile browser. Sorry


#13

ehh … no worries. try this:


#14

I follow some of it, but lost at the Boolean. I have to be up in 4 hours to drive to work, ill be back thursday to load it and test it. Id load it now but theres already 2 sets of lights on infinite loop,

And i accidentally excluded one bath fan by hitting the switches too fast when it was being really laggy. Or something happened to erase ir from ST without a clear reason, that fans been on for a week now :joy:

Wouldnt the first line in the repeat loop make the untill portion true and itd stop?

Thanks again, its so much easief to learn these methods with usable examples, ill test it as soon as i can


#15

i hope not :wink:

give it a shot when you have time and we will figure it out from there. :slight_smile:


#16

it turns on all fans, idx gets set as zero cascading the probem. heres the logs and var display

 Local variables

integertime_a 10
integertime_b 20
integertime_c 30
integertime_d 60
integertime_e 0
deviceswitches Downstairs Bath Fan Switch, Guest Bath Fan Switch, Laundry Room Fan Switch, and Master Bath Fan Switch
devicefans Downstairs Bath Fan Relay, Guest Bath Fan Relay, Laundry Room Fan Relay, and Master Bath Fan Relay
integeridx 0
integer[]minutesLeft {“0”:20}
integer[]ctr {“0”:2}
booleanoneMore false
booleanmaster false
devicethisFan Downstairs Bath Fan Relay, Guest Bath Fan Relay, Laundry Room Fan Relay, and Master Bath Fan Relay
timewaitAMinute 10:40:28 PM

Logs
+1ms â•”Received event [Downstairs Bath Fan Switch].switch = off with a delay of 743ms
+9650ms â•‘RunTime Analysis CS > 16ms > PS > 9570ms > PE > 63ms > CE
+9651ms â•‘Piston waited at a semaphore for 9516ms
+9654ms â•‘Runtime (52980 bytes) successfully initialized in 9570ms (v0.3.000.20180224) (9652ms)
+9655ms â•‘â•”Execution stage started
+9667ms â•‘â•‘Comparison (dynamic) off is (string) off = true (1ms)
+9669ms ║║Cancelling condition #129’s schedules…
+9669ms â•‘â•‘Condition #129 evaluated true (5ms)
+9670ms ║║Cancelling condition #128’s schedules…
+9671ms â•‘â•‘Condition group #128 evaluated true (state changed) (8ms)
+9676ms â•‘â•šExecution stage complete. (22ms)
+9677ms â•šEvent processed successfully (9677ms)
3/16/2018, 10:40:27 PM +902ms
+1ms â•”Received event [Downstairs Bath Fan Switch].switch = on with a delay of 729ms
+142ms â•‘RunTime Analysis CS > 17ms > PS > 70ms > PE > 54ms > CE
+145ms â•‘Runtime (53053 bytes) successfully initialized in 70ms (v0.3.000.20180224) (143ms)
+146ms â•‘â•”Execution stage started
+158ms â•‘â•‘Comparison (dynamic) on is (string) off = false (1ms)
+159ms â•‘â•‘Condition #129 evaluated false (5ms)
+160ms â•‘â•‘Condition group #128 evaluated false (state did not change) (6ms)
+162ms ║║Cancelling statement #124’s schedules…
+173ms â•‘â•‘Executed virtual command setVariable (3ms)
+179ms â•‘â•‘Comparison (integer) 0 is_equal_to (integer) -1 = false (2ms)
+180ms â•‘â•‘Condition #127 evaluated false (4ms)
+181ms â•‘â•‘Condition group #126 evaluated false (state did not change) (6ms)
+183ms ║║Cancelling statement #2’s schedules…
+189ms â•‘â•‘Calculating (integer) 1 + (integer) 1 >> (integer) 2
+192ms â•‘â•‘Calculating (integer) 2 % (integer) 5 >> (integer) 2
+199ms â•‘â•‘Executed virtual command [Downstairs Bath Fan Switch].setVariable (4ms)
+210ms â•‘â•‘Executed physical command [Downstairs Bath Fan Switch].off() (10ms)
+211ms â•‘â•‘Executed [Downstairs Bath Fan Switch].off (11ms)
+798ms â•‘â•‘Executed virtual command [Downstairs Bath Fan Switch].setVariable (4ms)
+801ms ║║Cancelling statement #158’s schedules…
+816ms â•‘â•‘Calculating (integer) 2 == (integer) 4 >> (boolean) false
+820ms â•‘â•‘Calculating (integer) 2 == (integer) 3 >> (boolean) false
+824ms â•‘â•‘Calculating (integer) 2 == (integer) 2 >> (boolean) true
+827ms â•‘â•‘Calculating (integer) 2 == (integer) 1 >> (boolean) false
+835ms â•‘â•‘Executed virtual command [Downstairs Bath Fan Relay, Guest Bath Fan Relay, Laundry Room Fan Relay, Master Bath Fan Relay].setVariable (4ms)
+842ms â•‘â•‘Calculating (integer) 20 > (integer) 0 >> (boolean) true
+857ms â•‘â•‘Executed physical command [Downstairs Bath Fan Relay].on() (13ms)
+858ms â•‘â•‘Executed virtual command [Downstairs Bath Fan Relay].setSwitch (14ms)
+872ms â•‘â•‘Executed physical command [Guest Bath Fan Relay].on() (12ms)
+872ms â•‘â•‘Executed virtual command [Guest Bath Fan Relay].setSwitch (12ms)
+886ms â•‘â•‘Executed physical command [Laundry Room Fan Relay].on() (11ms)
+887ms â•‘â•‘Executed virtual command [Laundry Room Fan Relay].setSwitch (12ms)
+901ms â•‘â•‘Executed physical command [Master Bath Fan Relay].on() (11ms)
+902ms â•‘â•‘Executed virtual command [Master Bath Fan Relay].setSwitch (13ms)
+906ms â•‘â•‘Calculating (integer) 0 + (integer) 1 >> (integer) 1
+916ms â•‘â•‘Calculating (integer) 20 > (integer) 0 >> (boolean) true
+922ms â•‘â•‘Calculating (string) 20 + (string) mins >> (string) 20 mins
+927ms â•‘â•‘Executed virtual command [Downstairs Bath Fan Relay, Guest Bath Fan Relay, Laundry Room Fan Relay, Master Bath Fan Relay].setTile (1ms)
+933ms â•‘â•‘Comparison (boolean) false is (boolean) true = false (1ms)
+934ms â•‘â•‘Condition #133 evaluated false (5ms)
+935ms â•‘â•‘Condition group #130 evaluated false (state did not change) (5ms)
+936ms ║║Cancelling statement #131’s schedules…
+942ms â•‘â•‘Executed virtual command setVariable (3ms)
+946ms ║║Cancelling statement #135’s schedules…
+951ms â•‘â•‘Executed virtual command setVariable (3ms)
+957ms â•‘â•‘Executed virtual command setVariable (3ms)
+967ms â•‘â•‘Calculating (decimal) 0.0 - (decimal) 1.0 >> (decimal) -1.0
+974ms â•‘â•‘Comparison (boolean) false is (boolean) true = false (2ms)
+975ms â•‘â•‘Condition #153 evaluated false (4ms)
+976ms â•‘â•‘Condition group #150 evaluated false (state did not change) (6ms)
+980ms â•‘â•‘Comparison (boolean) false is (boolean) false = true (1ms)
+981ms â•‘â•‘Condition #154 evaluated true (4ms)
+982ms â•‘â•‘Condition group #134 evaluated true (state did not change) (5ms)
+984ms ║║Cancelling statement #155’s schedules…
+990ms â•‘â•‘Executed virtual command setVariable (3ms)
+992ms â•‘â•šExecution stage complete. (847ms)
+993ms â•šEvent processed successfully (993ms)


#17

try this please:


#18

Idx list current device is in.

Set integerVAR: Currentthing == switch1 ? 1 : ( switch2 ? 2 : (switch3 ? 3 : ( switch4 ? 4 : 5)

Idx list that your going to pull from

Set device_VAR: new device[integer_VAR]


#19

Must of messed up the tag a while back, my last reply above was meant for you


#20

ok. looked at your previous reply. unfortunately not following what you mean there. please expand on what you mean?


#21

disregard, for some reason its really hard to use the forums on my phone, i had the posts confused or accidentally scrolled up right after your reply,