#HDD Temperature Monitoring
1 messages · Page 1 of 1 (latest)
Can anyone help please
Does the temperature show in glances?
Otherwise can you try this? https://gist.github.com/Impact123/e9a4a07b184eb393d2ff762e3b1b0a05#run-commands-in-a-containeraddon
# In Advanced SSH Addon
docker exec -it homeassistant bash
# Inside HA
apk add smartmontools lsblk
# Find disk
lsblk -o+FSTYPE,LABEL,MODEL
update-smart-drivedb
smartctl -a /dev/sda
Thanks for helping, Doing smartctl -a /dev/sda says operation not permitted
Can you show me a not too cropped picture? I'm not sure you're running it in the right context.
You need to follow exactly what I wrote.
In Advanced SSH Addon
The Core SSH Addon is inadequate for this.
Good. Basically you need an automation that runs this on startup or before running the command
(command -v smartctl || apk add --no-cache smartmontools) >/dev/null 2>&1
And a command_line sensor to call commands and extract the data: https://www.home-assistant.io/integrations/command_line/
Ok thanks
For example try this command
smartctl -A /dev/sda | awk '/^190/ {print $10}'
You might want to apk add gawk first.
Yeah just trying to figure out how to do the automation to run the apk command
You can also just add the code above before every call. Fairly lightweight.
You could put in in a script like this for example and clal that instead
#!/usr/bin/env bash
(command -v smartctl || apk add --no-cache smartmontools) >/dev/null 2>&1
smartctl -A "$@"
Save it in /share/hddtemp.sh and call it like bash /share/hddtemp.sh /dev/sda or something.
tbh im not sure how to do any of this, fairly new to all of this
Note that these sdX names are not reliable and will change upon reboot but I already wrote all the code you need so I leave that to you to figure out 🙂
ok thx
Hint. Try to give it a disk from the output here
ls -l /dev/disk/by-id/
ok
You can still ask me things and keep me updated on your progress.
will do
Error:extra keys not allowed @ data['hdd_temp']. Got '(command -v smartctl || apk add --no-cache smartmontools) >/dev/null 2>&1' extra keys not allowed @ data['shell_command']. Got None.
ive made an automation doesnt seem to work
` alias: HDD Temp
description: ''
triggers:
- trigger: homeassistant
event: start
conditions: []
actions: - action: shell_command.hdd_temp
mode: single
shell_command:
hdd_temp: '(command -v smartctl || apk add --no-cache smartmontools) >/dev/null 2>&1' `
Please use a code share site to share code or logs, for example:
- https://dpaste.org/ (select YAML for the language, and consider picking a longer expiry)
- http://pastie.org/ (select YAML for the language)
- https://paste.debian.net/ (you guessed it, select YAML as the language)
Please don't use Pastebin, since it can randomly add spaces to the main view. Please also don't share text as images since it makes it harder for people to help you. Remember that others may have colour blindness, impaired vision, etc.
Your automation only installs the package. I recommend you to put this in a script as explained and call that.
Ah ok
It's less work to use the script and it's self-contained. You can call it again and easily test it. The disadvantage is that there can be a slight delay for the first call but that shouldn't be an issue.
Yeah I'll try it in a bit
still getting this error for some reason
Error:expected dictionary @ data['actions'][0]. Got 's' extra keys not allowed @ data['run_backup']. Got 'bash homeassistant/hdd_temp.sh /dev/sda' extra keys not allowed @ data['shell_command']. Got None.
I'd recommend you use full paths (leading /) and enclose the command in quotes. It's also not indented properly.
Does the command work in the CLI?
Ah I see
Ye initially I tried /bin/bash it didn't work so I tried bash on its own,
I meant the path to the file, actually. You have no idea what the path is the script runs in so relative paths are unwise.