Questions about Cayenne and Raspberry

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:

  1. How do I press a widget to illuminate three leds in sequence with a set delay?
  2. How do I use a button widget to match a python script?
  3. Is there a simple system to change the status of a widget when an interrupter is on or off?
  4. Can Cayenne control the display as output?

Thanks for any answers

Hello Sir and Welcome to the Cayenne Community,
Here are some answers to your questions:

  1. You can manually program this feature using MQTT connection and make a python file that triggers the LEDS.
  2. What do you mean to match ? I never tried this but for sure you can manually attach a command to a button.
  3. I think that the status of the widget is updating automatically.
  4. This feature is not implemented yet. There are some widgets that are coming soon.

For better understanding, can you read this post: Executing custom code on your Raspberry Pi from Cayenne

and then also refer to the Cayenne docs: Cayenne Features - Developer | myDevices.com

2 Likes

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?

4)I hope in a short time

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.

Unfortunately right now there is no text widget available.

Yes, if you send the value of the pin to Cayenne when it changes status the dashboard will also update with the correct state of the button.

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.”

What can I do?

Did you run any code that would connect to the Cayenne servers yet? If so what was the code?

No I did not run any code
you have a sample code. I feel happy.
You can write step by step what should I do for a quick test?
Thank you

What language are you planning on coding with?

Python

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

Hi @fammagg

Here is a good example:
https://www.raspinews.com/dht11-raspberry-pi-cayenne/

@kumarpravat51 I’m not following your code, what are you trying to do?

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.

Regards,
Pravat kumar sahoo

That’s interesting, I haven’t seen that yet. @rsiegel any thoughts?

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.

Regards,
Pravat Kumar Sahoo

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.