Rules for UPB switches

Steve

Senior Member
Well I got my first UPB switch going! When I was researching I thought I read someplace that you can create rules based on switch actions. Something like 'If lower switch is pressed x times in y seconds then perform action'. I would like to create a rule for a switch to arm the M1 in a certain mode. Like if switch# 1 lower toggle is clicked 3 times in 5 seconds then arm M1 in Night Instant mode'. I know I read this somewhere, just not sure if it could be done in M1 or if you need HomeSeer or other SW and I can't find the article I read. Any ideas?
 
Sure,

It's pretty easy to do on the M1.

Make a rule that says something like:

If light switch A3 is turned on, arm the system in away mode, etc.
 
Opps, I didn't read your message closely enough about the multiple hits in a certain time period. let me think about that one.
 
Not sure how to do it in M1. In my HV Pro - I would just have a simple UPB Receive macro that checks if the button was pushed off x times in y seconds. If this condition is true - then perform Z function. I assume M1 is similar.

If you can't monitor x times in y seconds (since I don't know M1 programming) - you can create a simple math equation as a function. Each time switch 1 is turned off, set Var 1 = Var 1 + 10. Check the status of Var1, if Var1 >= 30, then perform Z function. Set a 5 second timer when the switch is first turned off when Var1 is equal to 0. That way, you ensure the switch was turned off 3 times within 5 seconds.
 
Yeah, I would suspect you could use the counters in the Elk to do that but I haven't tried it. Perhaps Spanky can help us here.
 
I tried making some rules by turning output on as a timer and incrementing a counter but still no luck. For grins I just performed a simple action/rule each time the off toggle is pressed and it works although I notice a delay, sometimes as long as 5 or 6 seconds. I noticed I have a few errors on the bus - not sure if related. Don't want to hijack my own thread but I think I need to look at both, so...

Q1. Does a counter need to be set to zero or does it default there when first created? If not, what is the best way to set it to zero 1 time?

Q2. Could the lack of response be related to the bus error(s). There are only 1 or 2. I reset the system and it immediately comes up with 1 retry - T5A1 Retries 1. (now up to 26). The config is as follows: M1XSP goes to Bus B on Retro Hub. Termination Jumper is ON both on expander and hub. Baud set to 000, Address Switch on 1. Keypad goes to hub bus A and term jumper on both keypad and hub. Hub goes to control with jumper on both. Do you see any reason for the bus errors here?
 
You could also create a link and tie it to the double tap function of the transmit component. This can get tricky if you want that to be findependent of the switches local load though. I had a situation where I wanted a single tap on/off to control the overhead and a double tap on/off to control a fishtank light and I was unable to do it using a US1130W. I eventually solved it by changing the switch from single to dual toggle mode to activate the other two transmit components. BTW: the 1130W is simply SAI's dual channel switch with a single channel rocker installed.
 
Q1. Does a counter need to be set to zero or does it default there when first created? If not, what is the best way to set it to zero 1 time?

Again, I don't know M1 programming. In HVPro - I set the initial value of the variable to 0 (when the HVPro power resets/programs download to it, etc), and then when the timer finishes counting down - it also sets the variable to 0. Therefore, it is usually a 0 :)

Q2. Could the lack of response be related to the bus error(s).
When you say bus error, I assume that's an M1 term/issue? Have you checked your signal strength inside Upstart? Any issues?

I had a situation where I wanted a single tap on/off to control the overhead and a double tap on/off to control a fishtank light and I was unable to do it using a US1130W. I eventually solved it by changing the switch from single to dual toggle mode to activate the other two transmit components. BTW: the 1130W is simply SAI's dual channel switch with a single channel rocker installed.

Out of curiousity, how did you control the fishtank light? Did you add an appliance module that the second rocker is controlling? Just thinking through my options for some projects :)
 
I don't know how relevant this is to the M1 or not but here is how I code such functionality in C-Max for the Ocelot:

0478 - IF X10 A/1, OFF Command Pair // if command is received
0479 - AND Timer #1 = 0 // and timer is not running
0480 - THEN Timer #1 = 1 // then start timer to look for second press
0481 - THEN Skip to line 488 // and skip rest of routine for this pass
0482 - IF X10 A/1, OFF Command Pair // if command is received
0483 - AND Timer #1 is > 0 // and the timer *is* running
0484 - THEN Timer #1 = 0 // stop the timer
0485 - THEN X10, B/1 Turn OFF // do the secondary function
0486 - IF Timer #1 becomes > 6 // if 6 seconds have gone by
0487 - THEN Timer #1 = 0 // then just stop the timer

Essentially, the Ocelot watches the power line for a command that is usually done directly by the user, such as a minicontroller to turn off a light. Upon seeing that, it starts a timer to create a timing window during which if it sees a second repeat of the command, it performs a secondary function and closes the timing window immediately. If the time expires (after a set interval, like 6 seconds in this example) then the timing window is simply closed to reset the routine.

If you can translate this into M1-ese, then you should be able to do your routine.
 
This is a rough set of rules that will arm the system if the light switch is turned on 3 times within a maximum of 15 seconds. Adjust the time to suit you. Keep in mind there is sometimes as long as a two second time delay on light transmissions.

Whenever light switch is turned On
Then increment Counter
Then Set Output 200 On with 5 second delay, restart if already running

Whenever Counter >= 3
Then Arm Away Mode
Then Set Counter = 0

Whenever Output 200 turns Off
Then Set Counter = 0
 
Back
Top