i recently set up my hp micro server with open media vault 4. now i wanted to log the hdd temperatures on pimatic and found this https://forum.pimatic.org/topic/2134/values-from-synology that @Stokstaart wrote which i now want to adopt for omv 4 servers.

first step is get the devices
0_1565778139451_01_get_devices.png
you find the device names under “Storage -> Disks”

next step is to install curl and write the script for getting temperatures.
so ssh into your server. i did this using the root user.
then install curl using apt-get install -y curl.

i then created a script folder and the script itself.

mkdir /usr/scripts
nano /usr/scripts/get_hdd_temp.sh

in nano enter the following script (adopt it to your needs [user, pass, pimaticip, devices])

#!/bin/sh
TEMP1=$(smartctl -n standby -d sat -A /dev/sda | grep -i Temperature_Celsius | tr -s ' ' | cut -d\  -f 10)
TEMP2=$(smartctl -n standby -d sat -A /dev/sdb | grep -i Temperature_Celsius | tr -s ' ' | cut -d\  -f 10)
TEMP3=$(smartctl -n standby -d sat -A /dev/sdc | grep -i Temperature_Celsius | tr -s ' ' | cut -d\  -f 10)
if ( ! test -z $TEMP1 ); then curl --user USER:PASS -X PATCH "http://PIMATICIP/api/variables/nas_temp_disk_1?type=value&valueOrExpression=$TEMP1"; fi
if ( ! test -z $TEMP2 ); then curl --user USER:PASS -X PATCH "http://PIMATICIP/api/variables/nas_temp_disk_2?type=value&valueOrExpression=$TEMP2"; fi
if ( ! test -z $TEMP3 ); then curl --user USER:PASS -X PATCH "http://PIMATICIP/api/variables/nas_temp_disk_3?type=value&valueOrExpression=$TEMP3"; fi

what’s the difference to the thread linked on the top? here the drive status is considered. i had the problems that getting the temperature woke up the drives. so if a drive is in standby no temp is received and no temp will be sent to pimatic.

as you can see the devices from the first image are back here. you can duplicate those lines for each device you have.

finally the script needs to be marked as executable: chmod +x /usr/scripts/get_hdd_temp.sh
and a little test run /usr/scripts/get_hdd_temp.sh

next step is to execute the script regularly. i configured this via the omv webinterface (System -> Scheduled Jobs).
0_1565781109751_02_cron.png

here comes the important part: smartctl prevents the drives from spinning down into standby (at least for me). i have configured the drives to spin down after 5 minutes, so the interval for the script needs to be higher that the spindown interval.

thats it for the server side.

in pimatic

at first you have to generate the variables used in the script.
0_1565782004430_03_pimatic_new_variable.png
and repeat this for all hdds you have so that it looks something linke this
0_1565782024383_04_pimatic_new_variable.png

now pimatic is already able to receive the temperatures.

if you want to display them you have to create a new device
0_1565782086407_05_new_device.png

and in the variables section (again for each single hdd / created variable)
0_1565782116963_06_add_variable.png

after this it should look something ike this:
0_1565782145822_08_result.png