Closed raviwarrier closed 2 years ago
Do you get any error and could you send your config?
I get no error when I run the service.
pi@rwpi:~ $ cat system_sensors/src/settings.yaml mqtt: hostname: 192.168.1.14 port: 1883 #defaults to 1883 user: password: **** deviceName: RWPI client_id: RWPI_SS timezone: Asia/Kolkata update_interval: 60 #Defaults to 60 sensors: temperature: true clock_speed: true disk_use: true memory_use: true cpu_usage: true load_1m: true load_5m: true load_15m: true net_tx: true net_rx: true swap_usage: true power_status: true last_boot: true hostname: true host_ip: true host_os: true host_arch: true last_message: true updates: true wifi_strength: true wifi_ssid: true external_drives:
# Drive1: /media/storage
SSD: /srv/dev-disk-by-uuid-E4FAC652FAC62122/
SDCard: /boot/
I hope I sent you the correct info.
Edit: the spacing under external_drives: is as per your example, but it's not showing up here.
Here's the screenshot from HA for the SSD:
I get no error when I run the service.
pi@rwpi:~ $ cat system_sensors/src/settings.yaml mqtt: hostname: 192.168.1.14 port: 1883 #defaults to 1883 user: password: **** deviceName: RWPI client_id: RWPI_SS timezone: Asia/Kolkata update_interval: 60 #Defaults to 60 sensors: temperature: true clock_speed: true disk_use: true memory_use: true cpu_usage: true load_1m: true load_5m: true load_15m: true net_tx: true net_rx: true swap_usage: true power_status: true last_boot: true hostname: true host_ip: true host_os: true host_arch: true last_message: true updates: true wifi_strength: true wifi_ssid: true external_drives: # Only add mounted drives here, e.g.: # Drive1: /media/storage SSD: /srv/dev-disk-by-uuid-E4FAC652FAC62122/ SDCard: /boot/
I hope I sent you the correct info.
Edit: the spacing under external_drives: is as per your example, but it's not showing up here.
Could you format the config so I can see that is right intended (https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks)
What do you get when you run sudo systemctl status system_sensors
trying. if this doesn't work, will upload the yaml file and share the link
mqtt:
hostname: 192.168.1.14
port: 1883 #defaults to 1883
user: ***
password: ****
deviceName: RWPI
client_id: RWPI_SS
timezone: Asia/Kolkata
update_interval: 60 #Defaults to 60
sensors:
temperature: true
clock_speed: true
disk_use: true
memory_use: true
cpu_usage: true
load_1m: true
load_5m: true
load_15m: true
net_tx: true
net_rx: true
swap_usage: true
power_status: true
last_boot: true
hostname: true
host_ip: true
host_os: true
host_arch: true
last_message: true
updates: true
wifi_strength: true
wifi_ssid: true
external_drives:
# Only add mounted drives here, e.g.:
# Drive1: /media/storage
SSD: /srv/dev-disk-by-uuid-E4FAC652FAC62122/
SDCard: /boot/
What do you get when you run sudo systemctl status system_sensors
Nothing. Just the next line as captured in the image.
that's the start command not the status command
What do you get when you run sudo systemctl status system_sensors
Nothing. Just the next line as captured in the image.
That's start not status
My bad.
system_sensors.service - System Sensor service
Loaded: loaded (/etc/systemd/system/system_sensors.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-11-19 04:01:35 IST; 16h ago
Main PID: 6880 (python3)
Tasks: 3 (limit: 4915)
CPU: 1h 10min 47.360s
CGroup: /system.slice/system_sensors.service
└─6880 /usr/bin/python3 /home/pi/system_sensors/src/system_sensors.py /home/pi/system_sensors/src/settings>
Nov 19 04:03:42 rwpi python3[6880]: Sending config message to host...
Nov 19 04:03:47 rwpi python3[6880]: Connected to broker
Okay could you try following for me enter following
python3
import psutil
psutil.disk_usage('/srv/dev-disk-by-uuid-E4FAC652FAC62122/')
exit()
what output do you get?
pi@rwpi:~ $ python3
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.disk_usage('/srv/dev-disk-by-uuid-E4FAC652FAC62122/')
sdiskusage(total=1000200990720, used=691900743680, free=308300247040, percent=69.2)
>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit
>>> exit()
pi@rwpi:~ $
When I went through your code, I saw the psutil stuff and wanted to run it to do this very test, but didn't know how. Learned something new today. Thanks.
I did the same for /boot and got the following:
>>> psutil.disk_usage('/boot/')
sdiskusage(total=264289280, used=50422784, free=213866496, percent=19.1)
okay could you do following thing:
sudo systemctl stop system_sensors
cd system_sensors/src
python3 system_sensors.py settings.yaml
let that run and see if you get the right value in HASS
It worked for SSD but not for boot. Boot disk usage entity is still disabled.
Edit/Update: It worked for both.
Now what should I do? Can I Ctrl+C the python command? It's late here (perhaps there as well). Let me know what you need me to do next and I'll do it tomorrow morning when I wake up.
Cheers and goodnight.
Just Ctrl + c and restart the service by following command:
sudo systemctl start system_sensors
Okay. Done. Will check tomorrow morning and report back.
I realized I didn't get back to you. It worked fine, so thank you. I just had to reinstall my RPI (damn homeassistant keeps mucking up) and installed (and even followed the steps we did above), but my SSD shows 0%. Will try it out again tomorrow (might have missed a step above). Thanks for all your help.
Edit: got it working. thanks a ton again. closing this request.
This is similar to #75 but since that was closed without resolution...
This used to work before, but somehow I can't make it work after I reformatted+reinstalled my pi.
Here an image of the result of blkid:
My external SSD is mounted as '/dev/sda1' is accessed by '/srv/dev-disk-by-uuid-E4FAC652FAC62122/'.
I have tried everything '/dev/sd1', '/dev/disk/by-uuid/E4FAC652FAC62122' (i don't know, but I saw this on Webmin's dashboard) and '/srv/dev-disk-by-uuid-E4FAC652FAC62122/', but everything gives out 0% or Unavailable or Unknown.
I also have a problem with my /boot (used to work before the clean install) and tried permutations of that as well.
Please help. Also, you had asked for this in #75 (> Can you send me the config that's send to mqtt (homeassistant/sensor/{device name}/disk_use{name of disk}) and also the resulting json that's send as value (system-sensors/sensor/{device name}/state)) and I would gladly give it only if I understood what that was and how to get it.
Thanks.