Hello to all
I’m new to Cayenne
I find it very interesting in combination with Raspberry
But I have many doubts about its too limited potential.
Questions:
How do I press a widget to illuminate three leds in sequence with a set delay?
How do I use a button widget to match a python script?
Is there a simple system to change the status of a widget when an interrupter is on or off?
Hello
Thanks for the reply but…
1)
A)I install library can be installed using pip
pip install cayenne-mqtt
B)In Cayenne -->Add new —>> Add a new device using the Bring Your Own Thing API selection.
Problem Waiting for board to connect… and it’s still in search. Is it normal?
2)How do I insert a python string into a widget?
3)So can I make sure that if a physical switch is off the widget is off? And if the actual switch is on the widget is on on? Changing the real switch also modifies the status of the widget? If so how?
ok I would like to solve the first problem
“Yes, you will see this message until the server sees a client connect. If you think you are connecting then yes there is a problem.”
Hii i have made a counter program using python 3 but the problem is it is very less sensitive that means if i count some objects manually then say it around 10 but in my program it shows 10 but if i use mqtt protocol then it shows around 3 . can you help me ?
import os
import time
import sys
import cayenne.client
import time
import RPi.GPIO as GPIO
# Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
MQTT_USERNAME = ""
MQTT_PASSWORD = ""
MQTT_CLIENT_ID = ""
# The callback for when a message is received from Cayenne.
def on_message(message):
print("message received: " + str(message))
# If there is an error processing the message return an error string, otherwise return nothing.
client = cayenne.client.CayenneMQTTClient()
client.on_message = on_message
client.begin(MQTT_USERNAME, MQTT_PASSWORD, MQTT_CLIENT_ID)
GPIO.setmode(GPIO.BCM)
Pin = 4
Pin1=22
count1=0
count=0
count2=0
count3=0
reject=0
index=0
index1=0
GPIO.setup(Pin, GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(Pin1, GPIO.IN,pull_up_down=GPIO.PUD_DOWN)
# Defining function for sending email
######################################## module for updating the time ######################################
while True:
client.loop()
t=time.localtime(time.time())
c=t[3]
d=t[4]
e=t[5]
Pressed1 = GPIO.input(Pin1)
Pressed = GPIO.input(Pin)
Rejection=reject
####################################### Checking staus for the sensor data ################################
if Pressed==1 and index==0: # Checking sensor status on or not !!!!!!!
count +=1
count2=1
client.virtualWrite(1,count,"tube","no.")
print(count)
index+=1
elif Pressed == 0: # Checking sensor status off or not !!!!!!
index=0
count2=0
if Pressed1==1 and index1==0: # Checking sensor status on or not !!!!!!
count1 +=1
index1 +=1
count3=1
elif Pressed1==0: # Checking sensor status off or not !!!!!!
index1=0
count3=0
Thank you for the reply but i sorted out in my own . The problem was in
loop it was making my process slow so placed the loop only when counts
instead of while true loop. It is working fine. But new problem is in line
chart it shows data but not for valid date like last week or year it shows
the past and present value on live mode only. If you can rectifi from your
side then it will be helpful. Thanks in advance.
Apologies, I’m not following the exact issue here, @kumarpravat51, could you share a screenshot that shows the trouble you’re having with the line chart?
I will share screen shots on Sunday only because that is the time for my
maintanace so i hope you ll sort it out. But really i am satisfied with
your other services . Thank you very much.
I kind of assumed he meant the “no data for this period” message on anything but live, but now that I read again I’m questioning how much history he’s seeing on live other than truly the “live” data. Let’s see what he posts back this weekend.