Why i Can´t create a widget


#1

Hi,
I start using the Cayenne API´s with my python scrips and a raspberrypi , i actually get conection with mqtt pythons’s library but when i create the widget (it doesn’t metter which one of the options i select) the button of add widget never is habilitated, i fill all the fields, i dont know if i forget someting, help please :s

title|690x387


#2

Hi,
Would it be possible to share the code you’re using?
Also, maybe some screenshots of what you’re seeing as well.

Then we can look into the issue you’re experiencing.

Thanks.
-Jesse


#3

I’m seeing the same thing. And my code was working. I’ve not made any changes to it.


#4

What exactly are you seeing? Your device is not online in Cayenne or you can’t add widgets? Screenshots help.

~Benny


#5

Sorry, i got a connection with MQTT this is the code that i use to get connected:

import cayenne.client #Cayenne MQTT Client
from time import sleep
import serial
from gpiozero import Button
button=Button(2) # Declaring button pin 2

MQTT_USERNAME = “"
MQTT_PASSWORD = "
"
MQTT_CLIENT_ID = "
***************************”

client = cayenne.client.CayenneMQTTClient()

client.begin(MQTT_USERNAME, MQTT_PASSWORD, MQTT_CLIENT_ID)

def send_on():
client.virtualWrite(3, 1) #Publish “1” to Cayenne MQTT Broker Channel 3
print(“Button pressed\n”)

def send_off():
client.virtualWrite(3, 0) #Publish “0” to Cayenne MQTT Broker Channel 3
print(“Button released\n”)

button.when_pressed=send_on #When button pressed run send_on function
button.when_released=send_off #When button released run send_off function

while True:
client.loop()

(note: i dont put in the post the MTTQ username and pasword but in python i do)

I want to see the state of a push button in a 2 state widget and when i get conected to the mqtt this happen

before that i run the code:

after i run the code i get this on the consol from my rpi


after all of that i cant press the add widget button to can send data