Got tired of the bug the makes SK lose connection with telldusd (at least on Linux) and wrote a hack to work around the problem.
The hack is a bash script that I add to crontab to make it run at a set interval.
The script is in no way pretty and might not work for you, but it works just fine for me.
What it does is to invoke tdtool --list and extract the sensor values from there, and then save the values into one file for each sensor for easy adding into SK.
It is expected that you have some (limited) knowledge in cron and bash to make this work for you.
Remember to make the script executable...
Code: Select all
#!/bin/bash
# Define path to save files. Do not add trailing slash.
CONF_PATH="/var/www/default/telldus"
# Define sensors, one array id per sensor
# Example:
# CONF_PROTOCOL[1]=protocol_name
# CONF_MODEL[1]=model_name
# CONF_ID[1]=id_number
CONF_PROTOCOL[1]=mandolyn
CONF_MODEL[1]=temperaturehumidity
CONF_ID[1]=11
CONF_PROTOCOL[2]=mandolyn
CONF_MODEL[2]=temperaturehumidity
CONF_ID[2]=12
CONF_PROTOCOL[3]=mandolyn
CONF_MODEL[3]=temperaturehumidity
CONF_ID[3]=51
# Run 'tdtool --list' and save into array
values=($(tdtool --list))
# Loop through array
while :
do
# If array index is empty, break loop
if [ -z ${values[i]} ]; then
break
fi
# Loop through defined sensors to find matches
for (( j = 0 ; j <= ${#CONF_PROTOCOL[@]} ; j++ ))
do
# Found match? All three identifiers must match.
if [ "${values[i]}" == "${CONF_PROTOCOL[j]}" -a "${values[i+1]}" == "${CONF_MODEL[j]}" -a "${values[i+2]}" == "${CONF_ID[j]}" ]
then
# For debugging, uncomment to print match
# echo ID:${values[i+2]}, TEMP:${values[i+3]}, HUM:${values[i+4]}, TIME:${values[i+5]} ${values[i+6]}
# Save matched values in variables for easier reading
save_id=${values[i+2]}
save_temp=$(tr -d "°" <<< ${values[i+3]}) # Strip degree char
save_hum=$(tr -d "%" <<< ${values[i+4]}) # Strip percent char
save_time="${values[i+5]} ${values[i+6]}"
# Write values into file
echo "$save_temp;$save_hum;$save_time" > $CONF_PATH/$save_id
fi
done
# Increment counter
i=$((i+1));
done
edit: fixed wrong variable in a for-loop