Here is a little webpage you could install on your Raspberry Pi, saved as index.php
in the Document Root of your Apache/other web server. Then you can control the required temperature setting using any iPhone or computer on your network by going to URL:
<IP-ADDRESS-OF-PI>://index.php
It looks like this:

Obviously, I am not a trendy designer of cool-looking websites so it will need "tarting up" to look good ;-)
At the bottom of the movie, there is a little Python script running - watching the "setting.txt"
file on the server (on the Raspberry Pi in your case):
from time import sleep
while True:
file = open("setting.txt", "r")
print file.read()
file.close()
sleep(1)
Here is the web page index.php
:
<?php
// If we were POSTed, save the value in file on server
if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
file_put_contents("setting.txt",$_POST['val']);
return;
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Temperature Control</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
<?php
// Get setting from previous run and load into Javascript variable "setting"
if(!file_exists("setting.txt")){
$s=10;
} else {
$s = file_get_contents("setting.txt");
}
printf("var setting=%d;",$s);
?>
$( function() {
$( "#slider-vertical" ).slider({
orientation: "vertical",
range: "min",
// Constrain temperature setting to range [10,30]
min: 10,
max: 30,
value: setting,
change: function( event, ui ) {
$( "#amount" ).val( ui.value );
// Send value of slider back to server via AJAX POST
$.post("index.php",{val:ui.value});
}
});
// Update numeric value displayed on webpage
$( "#amount" ).val( $( "#slider-vertical" ).slider( "value" ) );
} );
</script>
</head>
<body>
<p>
<label for="amount">Setting:</label>
<input type="text" id="amount" readonly style="border:0; color:#f6931f; font-weight:bold;">
</p>
<div id="slider-vertical" style="height:200px;"></div>
</body>
</html>
Each time the slider moves, it does an AJAX POST back to the server sending the value of the slider to be saved in a file called "setting.txt"
. That is actually received by the same PHP (you can see that in the first 4 lines) so that you only have one file to maintain.
Then your Python script can just read the value set from that file each time through its main loop, or every now and then, or when the file changes - as you wish.