Jump to content
C4 Forums | Control4

What am I doing wrong?


mas0282

Recommended Posts

Hi guys

I've been having lots of fun using Composer HE to program my system - what a fantastic option for Control 4. I hope they never move away from giving enthusiastic users this level of control.

Anyway, I have a door sensor - its programmed (with some bells and whistles) to essentially try and (i) turn on the lights when someone comes home, and (ii) turn everything off when someone leaves.

I've been having a bit of a problem with (ii) - basically, I might open the door to take out the trash and obviously I dont want everything to turn off at that point. I fixed that problem partially by programming the system to wait for 3 minutes and only turn everything off if the door hasnt been opened again in the meantime (indicating that the house is vacant, rather than someone has just popped out).

But that still doesnt stop the system occassionally turning everything off when not required. So I thought...ok, there's an easy fix for this. I'll just program it so that it wont turn anything off if the TV is on (either watching cable or a blu ray), because if the TV has been left on then someone is watching it. So this is the code I now have for the "exit":

When door closes

--------

If apartment occupied = TRUE (this is a variable I added, which crudely tells the system if someone's home or not)

----> If living room power is OFF

------> execute off scene, etc

Since I added the line in bold it's stopped working - is this the correct code to use to tell the system that "If nobody is watching the TV, do X", or should I be using a different room variable?

Any help much appreciated. Thanks

Link to comment
Share on other sites


Mhh what is the variable "occupied" based off of?

Because if THAT is correct you shouldn't need the living room IF to begin with.

As such, yes: IF living room is off would mean that as long as there is no source being played in the living room (audio OR video) it WILL execute, so in reverse if there IS something on it won't.

While semantics, you are however doing things a little backwards - occupied TRUE logically means there IS someone at home.

Generally however, using a door contact isn't great for this sort of thing. As you've sort of noticed already.

If you have security installed (and arm it when you leave) it's easier to program off of that, or at least use THAT as your IF on the door opening/closing (WHEN door closes IF alarm is armed).

Another option is, if you have your doorbell on the system:

WHEN door closes - start timer (leaving)

WHEN doorbell is pressed - set variable (leave confirm) to true , and - start timer (leave confirm timer)

WHEN timer (leaving) expires - IF variable (leave confirm) is true --- execute what ever leave programming you want.

WHEN timer (leave confirm timer) expires - set leave confirm to false.

Make sure the (leave confirm timer) is as long or longer than the (leaving) timer.

Basically you now exit through the door, press you doorbell and everything turns off.

Link to comment
Share on other sites

Thanks for the responses. You are quite right that a door sensor isnt the ideal option here, but it's the best I can do in the circumstances.

The occupied variable works like this:

The default state is FALSE, the aparment is empty / everything is off

The door opens and the sensor changes state

The change in state sets the occupied variable to TRUE

Just in case the door sensor misses it, other actions in the apartment will set the variable to true. So for example, turning on the TV will also set the variable to true.

The idea now is that I'm in the apartment doing whatever I want...then when I go out....

Door opens

Sensor changes state

Occupied state is TRUE

So the "turn everything off scene" executes

The occupied variable then switches back to FALSE

I know you're all going to say that I should have motion sensors, etc but unfortunately I dont - it's a one bed apartment, a very small Control 4 set up and I'm in the UK so everything is more expensive....a door sensor is the best I could do!

Link to comment
Share on other sites

Lol was just pointing out it wasn't ideal, not impossible .

Your problem is likely the door opening changing it to true.

It may be setting it to true every time, then reading it true and executing what's behind there.

Or reversed it sometimes sets it to false when it shouldn't.

I'll have a look a little later - see if you can pm me some screen shots.

Link to comment
Share on other sites

If your budget allows you can use a Kwikset Deadbolt. I use this for the very same reason.

When I lock the door with the button or a key, nothing happens, usually someone is still home.

When I lock the door with the code (type pin code then hit lock) then the house shuts down as no one is home.

Link to comment
Share on other sites

If your budget allows you can use a Kwikset Deadbolt.

HAH! I think he already answered that one - I'll see if I can come up with some solution for you OP, but the true/false toggle/change (specifically having both) on the door may be an issue. Give me an hour or so and I'll post back.

Link to comment
Share on other sites

Alright, this might be worth a try.

One variable, boolean [occupied] - True when there is someone in the house.

One timer, 3minute, non-repeating [leaving]

Under the door contact:

WHEN contact opens

IF Variable [occupied] is False

--Variable [occupied] = True

--Stop

IF Variable [occupied] is True

--Variable [occupied] = False

Then under the variable:

WHEN Variable [occupied] changes

IF Variable [occupied] is True

--Stop Timer [leaving]

--IF Living Room is ON

----[Whatever programming you want when entering]

IF Variable [occupied] is False

--Start Timer [leaving]

Last, under the timer

WHEN timer [leaving] expires

IF Living Room is Off

--[Whatever programming you want on leaving]

That should cover most eventualities, but you'll have to test it a bit.

Note that the IF Living Room is ON in the second part is to prevent the "on" programming from executing should there be someone "home" (such as when you went to get the mail) so lights etc don't turn on when you don't want to.

The Living Room OFF in the third part is to prevent the "off" programming from executing in similar circumstances - ie you have a visitor who leaves but your tv is on.

They can be removed but it stops those "safeguards" of course.

This bit of programming SHOULD do the following.

If the house was occupied, do the "off" programming AFTER a 3 minute delay (time in the form of the timer can be changed of course).

If the house was NOT occupied, do the "on" programming.

Hope this one works out for you, if you find any gaps just let me know, I'll see what I can do.

Link to comment
Share on other sites

Thank you very much for taking the time to help - I will need a bit of time to digest this but will report back on the results!

In response to the other points - I'm now realising a Kwikset would have been a better use of the money spent on the door contact sensor, but then it involves drilling the door and having another lock which, for various reasons, I decided against.

Using the switch next to the front door to toggle "occupied mode" is also an interesting idea.

Btw, I am still having problems getting the "room off" coding line to work - does anyone else find that occassionally programming in HE doesn't work (perhaps sometimes there are bugs?). I appreciate that more often than not it's a human error in writing the code, but even so, I sometimes find that accurately written code doesnt do what it's supposed to - often a reboot solves this. This isn't a criticism, all computer programs suffer from the odd bug, I was just curious if others ever experienced this? Sometimes I find lighting scenes "corrupt" when changed as well and have to be deleted and added again.

Link to comment
Share on other sites

Btw, I am still having problems getting the "room off" coding line to work - does anyone else find that occassionally programming in HE doesn't work (perhaps sometimes there are bugs?). I appreciate that more often than not it's a human error in writing the code, but even so, I sometimes find that accurately written code doesnt do what it's supposed to - often a reboot solves this. This isn't a criticism, all computer programs suffer from the odd bug, I was just curious if others ever experienced this? Sometimes I find lighting scenes "corrupt" when changed as well and have to be deleted and added again.

If you have project corruption issues, I'd be concerned that the controller you're using may be having a hardware issue. It's pretty rare (RMA rates are very low), but it's possible, especially with an older controller.

As far as Control4 programming just not triggering, or not executing correctly when triggered, that's really *basic core* code within Control4, and I can't recall the last time I've seen Control4 programming not trigger when it was programmed correctly.

RyanE

Link to comment
Share on other sites

Thank you very much for taking the time to help - I will need a bit of time to digest this but will report back on the results!

In response to the other points - I'm now realising a Kwikset would have been a better use of the money spent on the door contact sensor, but then it involves drilling the door and having another lock which, for various reasons, I decided against.

Using the switch next to the front door to toggle "occupied mode" is also an interesting idea.

Btw, I am still having problems getting the "room off" coding line to work - does anyone else find that occassionally programming in HE doesn't work (perhaps sometimes there are bugs?). I appreciate that more often than not it's a human error in writing the code, but even so, I sometimes find that accurately written code doesnt do what it's supposed to - often a reboot solves this. This isn't a criticism, all computer programs suffer from the odd bug, I was just curious if others ever experienced this? Sometimes I find lighting scenes "corrupt" when changed as well and have to be deleted and added again.

Post a screenshot. I'd bet it's not properly nested under the conditional.

Link to comment
Share on other sites

Thanks again for the responses.

I'm aware that more often than not it's human error, i.e. failure to properly nest, etc. so I do check these things closely. Perhaps it is just that I do not understand how some of the conditionals/events work or how my system responds to them. If the community here is telling me that bugs are very rare then I'm inclined to believe it must be me that's at fault.

Link to comment
Share on other sites

It's not that bugs / defects are rare, they're just rare in the *core programming* functionality you can do through Composer (Pro or HE).

It's more likely that a defect is actually a defect in a driver than in the Control4 Events/Commands/Conditionals/Variables programming.

(or, user error in the Composer programming).

RyanE

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.