You are reading a single comment by @AaronB and its replies. Click here to read the full conversation.
  • Hello,

    I currently have a pico running my heating through a few 5V relays. It is not quite as simple as a thermostat; It heats a store of water and uses a pump to provide hot water and heating. I would like to be able to connect to the system over wifi, gather the data and adjust variables. I may install home-assistant so I would like to emulate a rest type interface. I am testing the wifi on a ESP8266 at the moment until I buy a shim.

    I have played with examples previously with control over wifi, I can turn on a pin and read variables but I don’t understand how to interrogate the url and move the information into a variable. I thought of using an if statement to check if the number is 1 and incrementing to by 1 if it’s not and rechecking but it seems a bit adhoc.

    I would like to be able to type something like:


    and have the 23 move to the variable for the target room temperature. I assume I would need to use the parse function? A simple example of how to achieve this would be very much appreciated.

    Basic example that I have been using:

    // define the function beServer
    function beServer() { 
      var http = require ("http");
      var httpServer = http.createServer(function(request, response) {
        //Handle favicon requests
        if (request.url == "/favicon.ico") {
    // handle requests and serve web page
        if (request.url == "/ledOn"){
          response.write("The led is on.");
          digitalWrite(ledPin, 1);
        } else if (request.url == "/ledOff"){
          response.write("The led is off");
          digitalWrite(ledPin, 0);
        } else {
          response.write("Sorry... I didn't understand");
        response.end(" ");
      }); // End of new browser request
      print("Now being an HTTP server!");
    } // End of beServer

    Background information about the actual system:
    A thermometer switches the boiler when the store cools below a pre-set limit currently cutting in at 62 and out at 72 deg. A valve lets water from the heating circuit into the cylinder when the flow is above 45 deg and within 10 deg of the cylinder temp and the boiler is running. The water pump starts (and pumps water through a heat exchanger) when a flowmeter picks up a flow higher than 1l/min. so lots for thermometers basically.


Avatar for AaronB @AaronB started