Beginner Question: Ideas on how to implement my proposed setup using Pi's

I believe time is a core python library. I didn’t install anything special to use it.

Do you really have both a : and a =? It should be one or the other, not both. Either

Toggle: True

or

Toggle = True

No sorry i was going off memory its Toggle: True

This is what the mqtt logs look like just for your info
2016-12-13 18:14:05,282 INFO - Received command on actuators/actuator1: 1 Toggle = True PIN = 27
2016-12-13 18:15:32,306 INFO - Received command on actuators/actuator1: ON Toggle = True PIN = 27

Hmmmm.

So first of all the message (i.e. 1, ON) doesn’t matter for Toggle = True. So we can ignore anything there. It is getting A message which is enough.

I had someone who had some problems getting the rule to work and I think I fixed it, forgot I fixed in and promptly broke it.

Remove the quotes around “True”.

if self.toggle == "True"

becomes

if self.toggle == True

Let me know if that fixes it and I’ll push a fix to the main repo.

I will let you know once i get home as i cant see the relay from work :slight_smile: Thanks though

Same reason I can’t test it myself right now. :slight_smile:

So i have not tested this yet but i noticed that there is a : after “True” so it looks like this if self.toggle == “True”: does that : need to be there? or should it look like this self.toggle == True or self.toggle == “True” or self.toggle == True: ?

The “:” is how one starts a new context in Python. It is the equivalent to { in C/C++/Java/Rules DSL et all).
So the : needs to be there.

It should look like your last example. No quotes with the colon.

So to answer my own question its if self.toggle == True: and it is working however now the ON fuction does not work but i think that is normal based on what you were telling me unless i set the toggle to false right?

Correct. Each instance of the class supports only one or the other. If the section in the ini has Toggle = True that actuator will be a toggle forever. If it is set to False it will respond to On messages and not toggle.

1 Like

Thanks again Rich… I think with this we will be able to move forward and continue implementing the different functions of my smart house! I hope you don’t mind if i pick your brain from time to time in the future as you seem to be a very good resource for programing information! Is there a function on this forum to add you as a friend or message you in the future or something ?
Again THANK YOU so much for all your help you are a inspiration and an extremely helpful resource!
If you should ever run into any networking issues that require a look over i will be more then happy to assist as that is my skill set and forte.

I don’t mind at all. I only get miffed at those who show no initiative to learn how to do some of this stuff themselves and just expect us to do it for them. I’ll help with the homework but I won’t do it for you. :yum:

My undergrad was Computer Science and I’ve been a programmer of one sort or another for more than 20 years now. I don’t do much professionally any more but home automation has helped me keep in practice.

When the little one gets older I hope to get more free time to actually contribute code to OH in addition to forum postings and docs.

There is a private message function. I think you just click on my icon and a message option pops up. Also, if you put @rlkoshak in a posting I’ll get an email notification of the posting. I read every new post (sometimes a few days later) so even if you just post a new thread I’ll get to it eventually. And there are lots of other really helpful folks on the forum too.

Good luck!