This may already be part of the planned trigger/scheduling update, but I would really like to have access to customize the actions that take place on a trigger. Ideally as part of the trigger setup there should be an option to create custom python code do do whatever we want it to do instead of predefined functions.
Thank you for your suggestion I will pass this on to our team
we have identified to integrate existing macro feature into webiopi, but we want to make it the more user friendly possible.
will you support this suggestion? I also would love to hit a button and it run a python script?!!
Yes, I’ll be organizing an online meetup so we can get your input on this very soon. I’ll be sure to notify you so you can participate
I would also love this option as well.
So much easier for some of us to just write a quick script or make a script to run the gpio/relays in a set to make lights blink a certain way ect…
nothing against your triggers menu but some of us would love this feature.
Is there any news regarding this topic?
Any updates on this?
I’ll make an example today and post it in The Library, then link it here so you can see how I’m accomplishing this.
Hi again @julian,
Please find the post I mentioned detailing how to trigger python scripts from a Pi custom button widget here. If you have any questions or trouble with it, please let me know.
Thanks a lot!
I tried this tutorial but when I run the code I get an error message saying:
self.on_connect(self._userdata, flags_dict, result) TypeError: on_connect() takes 3 positional arguments but 4 were given
This seems to be a problem in the cayenne.client code.
If you want the entire error message let me know and I can include it.
I ran into this on one of my Pi’s last week. It turned out to be that we use a package called paho-mqtt, and we’re expecting version 1.2.3 with the example code with have in Github. When version 1.3.0 is installed, it left that error message. While we need to adjust our code so it will play nice with 1.3.0, in the meantime this can be worked around by simply installing v1.2.3 of the paho-mqtt package.
You can first check to make sure that it is the same thing, if you have paho-mqtt 1.3.0 running:
pip show paho-mqtt
Assuming you are, to change it to version 1.2.3:
sudo pip install paho-mqtt==1.2.3
Again you could run
pip show paho-mqtt to verify the change was made correctly. At this point you should be able to run our example code without that error message about the number of arguments.
Thanks a lot. Will I have to update this again to 1.3.0 later or will that be automatic?
For where the code stands right now, you actually want it to say on 1.2.3, so I’d say the real question is the opposite: will running some update on the Pi update you to 1.3.0 (which you don’t want right now) and break the example agent code?
Fortunately I think the answer is no unless you very specifically went into
pip and started running updates. You can easily toggle between the two (or any other version) with the same commands though, so
sudo pip install paho-mqtt==1.3.0 to install 1.3.0
sudo pip install paho-mqtt==1.2.3 to install 1.2.3
and so on.
Does updating the Pi always mean that it might break something on Cayenne? Or is there a way to make this future proof so that there is 0 risk of it breaking? What if I made a project for someone less tech savvy and give them instructions on how to run, it is there a way to guarantee that it’ll always work for them?
One of the features of software is that updates always have the risk of breaking. You have to update to keep compatibility with the server and fix security, bugs, performance, etc. In short, there’s no way to guarantee anything with any product, however, if done correctly on server and client you shouldn’t have any problems.
Has the code been adjusted so that version 1.3.0 works or should I still use 1.2.3?