Леонид
Леонид

Reputation: 5

raspberry pi pico temperature reading and output to zabbix

there is a raspberry pi pico that I want to configure as a temperature sensor, and output data to zabbix

raspberry pi pico I have, connected to a computer with ubuntu 22.04 via usb, I have a code for reading the temperature, which I run in thonny and get the temperature, but the problem is that this temperature is output either to the thonny terminal or to .txt in the pico file system.

I could not find information on how to write a file.the txt file with the temperature directly to the computer or any other ways to output from raspbery Pi from pico to Zabbix

code for getting the temperature:

import machine
import utime
 
sensor_temp = machine.ADC(4)
conversion_factor = 3.3 / (65535)

temp = ()

while True:
    reading = sensor_temp.read_u16() * conversion_factor 
    temperature = 27 - (reading - 0.706)/0.001721
#    print(f'Температура: {temperature}°C')
    temp = temperature
    print(temp)
    utime.sleep(1)

thank you very much!

Upvotes: 0

Views: 225

Answers (1)

Iron Bishop
Iron Bishop

Reputation: 1988

If it's the Pico with WiFi, install Zabbix Agent on RaspberryPi, add a userparameter to launch python temperature.py.

Upvotes: 0

Related Questions