Help with Python and Mqtt virtualwrite

Hello every body
first sorry of my english :slight_smile:
i tried some tutoriel but nothing, the sensors work i get the value on the rpi but to publish it
need help to publish data on dashbord aaaaa


client.virtualWrite(1, "distance", "analog_sensor", "null")


client.virtualWrite(1, distance, "analog_sensor", "null")

thank you think its work better
because now i have this on terminal

but no thing on the dasbord i add new widget/Custom widget / value / and i choose a analog sensor and i have nothing on the dashbord?

And what about the dashboard. do you see data on the cayenne dashboard?

they dont work… i dont now why

what do you mean by dont work?

i see my widget wthout a value just --…

seems like on the terminal all right but i see nothing on the dashbord
the addresse of py file is on crontabe
the same channel in the py file and the widget … so im lost

what are you doing? the dashboard is an cayenne pi agent. Are you trying to publish data using cayenne python library to it? that is not possible and will cause disconnect issue again and again as you cannot connect two device with same client id simultaneously.

im very confused now …
i want to publish data on dashbord
this data is a distance who i convert it to volume
so : i installed cayenne on the pi
after a do a py file, with scripte for sensor , and cayenne and mqtt info log

First of all remove all the devices from the dashboard.
Next, add a new device add new ----> devices/widget ----> arduino(to get new MQTT credentials, you can change name to raspberry pi)
once done you will be on the screen which displays the MQTT username, password and client id. Copy and paste them in your above code. Run the code, it will make the device online and show a green temporary widget. Add it by clicking on the + of the widget.

Omg :smiling_face_with_three_hearts: :smiling_face_with_three_hearts: :smiling_face_with_three_hearts: thank guys thanks bro
it works i have a single widget with that value

when i close ssh terminal
in the web interface i see the device off

in this topic it is shown how to run the script on boot DHT11/DHT22 with Raspberry Pi

1 Like