#!/bin/sh

/usr/bin/digitemp_DS9097 -i -s /dev/ttyUSB0

temp=`/usr/bin/lynx -source https://finnish.wunderground.com/fi//tiilimaeki/ |grep og:title | awk  '{print $6}' | sed 's/[^.0-9][^.0-9]*/ /g'`
#temp=`lynx -source "https://euweather.eu/stations.php?lang=fi&lat=61.47892&lon=21.78320" |grep "maxbox" | head -1 | sed 's/[^.0-9][^.0-9]*/ /g' | xargs`
room=`/usr/bin/digitemp_DS9097 -q -t 0 -c .digitemprc | awk  '{print $7}'`
wind=`lynx -source https://www.supersaa.fi/suomi/pori/ |grep "supers-windspeed" | head -1 | sed 's/[^.0-9][^.0-9]*/ /g' | xargs`
rain=`lynx -source http://www.kaleva.fi/saa/pori/ |egrep "shy;määrä" -A1 | sed -n '2p' | sed 's/[^.0-9][^.0-9]*/ /g' | xargs`

echo "temp.value $temp" > /tmp/temp
echo "room.value $room" >> /tmp/temp
echo "wind.value $wind" >> /tmp/temp
echo "rain.value $rain" >> /tmp/temp