Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspberry pi CPU temp #9

Closed
vzorglub opened this issue Sep 6, 2018 · 18 comments
Closed

Raspberry pi CPU temp #9

vzorglub opened this issue Sep 6, 2018 · 18 comments

Comments

@vzorglub
Copy link

vzorglub commented Sep 6, 2018

Hello,
I get an error:
Exception: Element 'sensors_temperatures' in 'sensors_temperatures/*' is not supported
When using psmqtt on a rapsberry pi zero
Has the CPU temperature been implemented for raspis yet?

@eschava
Copy link
Owner

eschava commented Sep 17, 2018

Sorry, could you please provide more info?
What type of request do you use? Is it scheduled request or request via request/* topic?

@vzorglub
Copy link
Author

I use a scheduled request:

import socket

mqtt_broker = 'localhost'       # default: 'localhost'
mqtt_port = 1883                # default: 1883
mqtt_clientid = 'psmqtt-1'
mqtt_username = 'username'
mqtt_password = 'password'
mqtt_clean_session = False
mqtt_qos = 0
mqtt_retain = False
mqtt_topic_prefix = 'psmqtt/pizero/'
#mqtt_topic_prefix = 'psmqtt/' + socket.gethostname() + '/'
mqtt_request_topic = 'request'

schedule = {
    "every 1 minute" :    [
        "cpu_percent",
        "virtual_memory/percent",
        "boot_time",
        "sensors_temperatures/*",
     ],
    "every 60 minutes"  :     "disk_usage/percent/|",  # slash replaced with ve$
    "every 3 hours" : {
        "boot_time/{{x|uptime}}": "uptime",
    }
}

@eschava
Copy link
Owner

eschava commented Sep 17, 2018

I see. Could you please ensure that you use the latest version of psmqtt?
I've checked your configuration and it works OK at my box

@vzorglub
Copy link
Author

Do I just replace the psmqtt.py file with the new one?

@eschava
Copy link
Owner

eschava commented Sep 17, 2018

psmqtt.py + handlers.py

@vzorglub
Copy link
Author

Nope, not working
I'll do a fresh install from rasbian image anyway in a few days time and let you know how it goes
Thanks

@vzorglub
Copy link
Author

Nope,
Fresh raspbian install
I am using a pizero

@eschava
Copy link
Owner

eschava commented Sep 19, 2018

same error?

@vzorglub
Copy link
Author

vzorglub commented Sep 19, 2018 via email

@eschava
Copy link
Owner

eschava commented Sep 19, 2018

How do you check the output?

You can try
mosquitto_sub -t -v psmqtt/#
command to see all messages sent by psqmtt

Also I've committed minor change that should improve messages sent for sensor_temparatures request

@vzorglub
Copy link
Author

vzorglub commented Sep 19, 2018 via email

@vzorglub
Copy link
Author

Still the same,
I have changed handlers.py with your latest code but no luck.

@vzorglub
Copy link
Author

vzorglub commented Sep 21, 2018

Ok, I have done a bit of research and it appears that the psutil library doesn't work for sensors_temperature on raspberry pis:

giampaolo/psutil#1310

@eschava
Copy link
Owner

eschava commented Sep 21, 2018

Thanks for your research! Subscribing to the original issue

@eschava eschava closed this as completed Sep 21, 2018
@vzorglub
Copy link
Author

vzorglub commented Sep 21, 2018 via email

@eschava
Copy link
Owner

eschava commented Sep 26, 2018

It's reopened without my influence :)

@vzorglub
Copy link
Author

vzorglub commented Sep 26, 2018 via email

@osos
Copy link
Contributor

osos commented Aug 7, 2021

There is a specieal command to view rasperry pi temperature. Some info here: https://pimylifeup.com/raspberry-pi-temperature/

Running in bash:

$ /opt/vc/bin/vcgencmd measure_temp
temp=42.0'C

Maybe psmqtt could call that process on raspberry pies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants