forked from ktrue/CU-HWS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwfsensor.php
90 lines (75 loc) · 5.86 KB
/
wfsensor.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php error_reporting(0);include('settings.php');
$section = file_get_contents('https://swd.weatherflow.com/swd/rest/observations/device/'.$weatherflowdairID.'?api_key='.$somethinggoeshere.'');file_put_contents('jsondata/weatherflow1.txt',$section);
$section = file_get_contents('https://swd.weatherflow.com/swd/rest/observations/device/'.$weatherflowdskyID.'?api_key='.$somethinggoeshere.'');file_put_contents('jsondata/weatherflow3.txt',$section);
$section1 = file_get_contents('https://swd.weatherflow.com/swd/rest/observations/station/'.$weatherflowID.'?api_key='.$somethinggoeshere.'');file_put_contents('jsondata/weatherflow.txt',$section1);
if(file_exists('jsondata/weatherflow2.txt')&&time()- filemtime('jsondata/weatherflow2.txt')<900)
{sleep(0);}else{sleep(1);
$url='https://swd.weatherflow.com/swd/rest/observations/station/'.$weatherflowID.'?api_key='.$somethinggoeshere.'';$json=file_get_contents($url);
$wfcachefile=fopen("jsondata/weatherflow2.txt","w");fwrite($wfcachefile,$json);fclose($wfcachefile);}
?>
<?php include('livedata2.php');
header('Content-type: text/html; charset=utf-8');date_default_timezone_set($TZ);?>
<body>
<?php
//weatherflow air temperature
if ($weather["temp_units"]=='C' && $weatherflow['temperature']<=10){echo "<div class=\"circleindoortemp\"><blue>", $weatherflow['temperature'] ;echo "° </blue><spaneindoortemp> ".$weatherunitc." </spaneindoortemp> </div> " ; }
else if ($weather["temp_units"]=='C' && $weatherflow['temperature']<=24){echo "<div class=\"circleindoortemp\">", $weatherflow['temperature'] ;echo "° <spaneindoortemp> ".$weatherunitc." </spaneindoortemp> </div> " ; }
else if ($weather["temp_units"]=='C' && $weatherflow['temperature']>26){ echo "<div class=\"circleindoortemphot\">", $weatherflow['temperature'];echo "° <spaneindoortemp> ".$weatherunitc." </spaneindoortemp> </div> " ; }
else if ($weather["temp_units"]=='C' && $weatherflow['temperature']>24){ echo "<div class=\"circleindoortempwarm\">", $weatherflow['temperature'];echo "° <spaneindoortemp> ".$weatherunitc." </spaneindoortemp> </div> " ; }
//fahrenheit
if ($weather["temp_units"]=='F' && $weatherflow['temperature']<=50){echo "<div class=\"circleindoortemp\"><blue>", $weatherflow['temperature'] ;echo "° </blue><spaneindoortemp> ".$weatherunitf." </spaneindoortemp> </div> " ; }
else if ($weather["temp_units"]=='F' && $weatherflow['temperature']<=70){echo "<div class=\"circleindoortemp\">", $weatherflow['temperature'] ;echo "° <spaneindoortemp> ".$weatherunitf." </spaneindoortemp> </div> " ; }
else if ($weather["temp_units"]=='F' && $weatherflow['temperature']>80){echo "<div class=\"circleindoortemphot\">", $weatherflow['temperature'];echo "° <spaneindoortemp> ".$weatherunitf." </spaneindoortemp> </div> " ; }
else if ($weather["temp_units"]=='F' && $weatherflow['temperature']>70){echo "<div class=\"circleindoortempwarm\">", $weatherflow['temperature'];echo "° <spaneindoortemp> ".$weatherunitf." </spaneindoortemp> </div> " ; }
?>
</div>
<div class="homeindoorfeels" style="margin-top:-28px;">
<?php //weatherflow air humidity
echo "<spanhomeindoorhumtitle>Humidity </spanhomeindoorhumtitle><orange>" .$weatherflow['humidity']."%"?>
<br>
<?php //weatherflow air dewpoint/wetbulb
//celsius dewpoint
if ($weather["temp_units"]=='C')
echo "<spanfeelstitle>Dewpoint <orange>" .$weatherflow['dewpoint']. " </blue> ° </spanfeelstitle> ".$weatherunitcsmall."";
//fahrenheit dewpoint
else if ($weather["temp_units"]=='F')
echo "<spanfeelstitle>Dewpoint <orange>" .$weatherflow['dewpoint']. "</blue> ° </spanfeelstitle> ".$weatherunitfsmall."";
?>
<br>
<?php
//weatherflow air celsius windchill,heatindex,feels
//windchill
$a='';
if ($weather["temp_units"]=='C' && $weather["windchill2"]==$a)
echo "<spanfeelstitle><blue></spanfeelstitle>";
else if ($weather["temp_units"]=='C' && $weather["windchill2"]<4)
echo "<spanfeelstitle>Wind Chill <blue>" .$weather["windchill2"]. " </blue> ° </spanfeelstitle> ".$weatherunitcsmall."";
//heatindex
else if ($weather["temp_units"]=='C' && $weather["heat_index2"]>=27)
echo "<spanfeelstitle>Heat Index <orange>" .$weather["heat_index2"]. " </blue> ° </spanfeelstitle> ".$weatherunitcsmall."";
//feel
else if ($weather["temp_units"]=='C' && $weather["temp_feel2"]<10)
echo "<spanfeelstitle>Feels <blue>" .$weather["temp_feel2"]. "</blue> ° </spanfeelstitle> ".$weatherunitcsmall."";
else if ($weather["temp_units"]=='C' && $weather["temp_feel2"]>20)
echo "<spanfeelstitle>Feels <orange>" .$weather["temp_feel2"]. "</orange> ° </spanfeelstitle> ".$weatherunitcsmall."";
else if ($weather["temp_units"]=='C' && $weather["temp_feel2"]>10)
echo "<spanfeelstitle>Feels <green>" .$weather["temp_feel2"]. "</green> ° </spanfeelstitle> ".$weatherunitcsmall."";
//weatherflow air air celsius windchill,heatindex,feels
//windchill
$a='';
if ($weather["temp_units"]=='F' && $weather["windchill2"]==$a)
echo "<spanfeelstitle><blue></spanfeelstitle>";
else if ($weather["temp_units"]=='F' && $weather["windchill2"]<40)
echo "<spanfeelstitle>Wind Chill <blue>" .$weather["windchill2"]. " </blue> ° </spanfeelstitle> ".$weatherunitfsmall."";
//heatindex
else if ($weather["temp_units"]=='F' && $weather["heat_index2"]>=80.6)
echo "<spanfeelstitle>Heat Index <orange>" .$weather["heat_index2"]. " </blue> ° </spanfeelstitle> ".$weatherunitfsmall."";
//feel
else if ($weather["temp_units"]=='F' && $weather["temp_feel2"]<43)
echo "<spanfeelstitle>Feels <blue>" .$weather["temp_feel2"]. "</blue> ° </spanfeelstitle> ".$weatherunitfsmall."";
else if ($weather["temp_units"]=='F' && $weather["temp_feel2"]>60)
echo "<spanfeelstitle>Feels <green>" .$weather["temp_feel2"]. "</green> ° </spanfeelstitle> ".$weatherunitfsmall."";
else if ($weather["temp_units"]=='F' && $weather["temp_feel2"]>43)
echo "<spanfeelstitle>Feels <orange>" .$weather["temp_feel2"]. "</orange> ° </spanfeelstitle> ".$weatherunitfsmall."";
?>
</div>