Python BYOT Manual Send AND Verify

We would like to send And verify using python and MQTT from a button option of ccontrol From MQTT dashboard. There is a nice example proviided in C at:
Just want a pythoin example. Seeing the command go flying past is one thing on the selected channel but the Full hand shake and verify is pretty elusive and complex…
~ Andrew

the cayenne python handles all this

Thanks for this.
Will go do some homework and make up some sort of a practical hardware demo test. Our present system is using python that ports state changes, monitor and control in and out of Cayenne via Pi Serial port. This can then be sent out over bare 433MHz LoRa radio devices over some nice long distances to and from uAmp idling devices.
~ Andrew

sounds pretty interesting. Let me know if you need any further help.

Thanks @shramik_salgaonkar! I’m a research collaborator with @picaxe1. Andrew does hardware, I do software and networking. We have different motivations, but 80% of our needs are in common and we accommodate each other for the rest.
Andrew got example 2 working, using Python 2.7. It is clear that the Cayenne libraries do a lot behind the scenes, making life easier. Sadly, the example doesn’t seem to work in Python 3.7, despite the docs saying it should work in ‘Python 3.4+’. Specifically, when using python3, I get an error: “begin() got an unexpected keyword argument ‘loglevel’”. Works fine with python 2.7! Re-reading today, that is totally consistent with what we see in example 2.
Thanks for your support. Steve

You can delete the loglevel=logging.INFO

i am not sure what is causing the issue with you, but i just run the code with python3.7 and it works just fine without any issue.
Are you running the sketch on raspberry pi?
have you used pip to install cayenne library?

As it happens, my main server has some pip issues, and is up for replacement soon. I ran my code on another server, with the same result - no loglevel keyword when running Python 3.6. Not running on a Pi - using Ubuntu 18.4 LTS, and tried using pip and pip3, as well installing from the repository as outlined here: Same result - no logging.
In the meantime, I’ve been building some code to manage a button using generic paho.mqtt.client libraries directly. Seems to work fine! (Dirt alert - very early, untidy, code):
Is there a widget designed to operate as a ‘push push’, ‘bell’, or ‘momentary’ button?
I changed line 50 so that instead of confirming the value (‘1’ or ‘0’, variable DATA) received, it always sends back a ‘0’. This results in the button always sending a ‘1’, which is what I want, but the dashboard doesn’t reflect this. The button should remain gray (0, or off), but in reality keeps alternating between Green and Grey. The colour doesn’t reflect the value being published when the button is pressed. Interestingly, @picaxe1 noticed that 0 values are not recorded in the dashboard data records.
Cheers! Steve

let me check what the issue with loglevel producing error. There is no support for the momentary button in cayenne. I guess you are much familiar with programming language then you can create a momentary button and .your own custom dashboard using cayenne API. here is some topic to get started with it. How to access Cayenne API using Insomnia, Node-red and Thunkable and Python code to access basic cayenne API