Full re-deploy did the trick, thanks! I'm now noticing something else weird. I have 2 web pages controlling the same gpio pin, one for mobile and one for desktop. After I put in the mobile version (the flow this thread is about) the desktop page will no longer update the values and it was working fine with no changes before. Whatever I last had the mobile page set to is what it always reverts the fan settings to. Is there something in the background with websockets that constantly run? Here is what I have in my flow:
[{"id":"8d3eeda3.29971","type":"websocket-listener","path":"/app","wholemsg":"true"},{"id":"e00a1942.7d2d4","type":"mqtt-broker","broker":"localhost","port":"1883","clientid":""},{"id":"b3bb40e2.2d92","type":"http in","name":"Temp Standard","url":"/temp","method":"get","x":83.5,"y":527,"z":"abafa038.54fa88","wires":[["61d29d3b.18a4cc"]]},{"id":"ca26a7dc.33f038","type":"http response","name":"Temp Standard","x":709.5,"y":527,"z":"abafa038.54fa88","wires":[]},{"id":"61d29d3b.18a4cc","type":"function","name":"Get Current Values","func":"msg.current = {\n insidetemp: context.global.insidetemp,\n outsidetemp: context.global.outsidetemp,\n fanspeed: context.global.fanspeed,\n fansdisabled: context.global.fansdisabled\n};\n\nif (context.global.fansdisabled == \"Disabled\"){\n msg.dropdown = \"<select id=\\\"fan_status\\\"><option selected>Disabled</option><option>Auto</option><option>Manual</option></select>\";\n}\nif (context.global.fansdisabled == \"Auto\"){\n msg.dropdown = \"<select id=\\\"fan_status\\\"><option>Disabled</option><option selected>Auto</option><option>Manual</option></select>\";\n}\nif (context.global.fansdisabled == \"Manual\"){\n msg.dropdown = \"<select id=\\\"fan_status\\\"><option>Disabled</option><option>Auto</option><option selected>Manual</option></select>\";\n}\n\nreturn msg;","outputs":1,"valid":true,"x":288,"y":527,"z":"abafa038.54fa88","wires":[["76e37074.8e19a8"]]},{"id":"76e37074.8e19a8","type":"template","name":"","field":"payload","format":"handlebars","template":"<html>\n<head>\n</head>\n<body>\n <form method=\"POST\" action=\"/disablefans\">\n <p>Inside Temp: <input name=\"insidetemp\" value=\"{{current.insidetemp}}\"></p>\n <p>Outside Temp: <input name=\"outsidetemp\" value=\"{{current.outsidetemp}}\"></p>\n <p>Fan Speed: <input name=\"outsidetemp\" value=\"{{current.fanspeed}}%\"></p>\n <p>Fan Status: {{{dropdown}}}</p>\n <p><input type=\"range\" name=\"slider_1\" value=\"{{current.fanspeed}}\" min=\"0\" max=\"100\" /></p>\n <p><input type=\"submit\" value=\"Update Fan Status\"></p>\n </form>\n <form method=\"POST\" action=\"/updatetemp\">\n <p><input type=\"submit\" value=\"Update Values\" onclick=\"history.go(0)\"></p>\n </form>\n</body>\n</html>","x":525.5,"y":527,"z":"abafa038.54fa88","wires":[["ca26a7dc.33f038"]]},{"id":"b3231d0a.18df28","type":"function","name":"Set Values/Update Fan","func":"context.global.insidetemp = msg.payload * (9/5) + 32;\n\nif (context.global.fansdisabled == \"Auto\"){\n if (context.global.insidetemp < 60){\n context.global.fanspeed = 0;\n }\n if (context.global.insidetemp >= 60 && context.global.insidetemp < 68){\n context.global.fanspeed = 15;\n }\n if (context.global.insidetemp >= 68 && context.global.insidetemp < 73){\n context.global.fanspeed = 30;\n }\n if (context.global.insidetemp >= 73 && context.global.insidetemp < 77.5){\n context.global.fanspeed = 40;\n }\n if (context.global.insidetemp >= 77.5 && context.global.insidetemp < 80){\n context.global.fanspeed = 50;\n }\n if (context.global.insidetemp >= 80 && context.global.insidetemp < 82.5){\n context.global.fanspeed = 60;\n }\n if (context.global.insidetemp >= 82.5 && context.global.insidetemp < 85){\n context.global.fanspeed = 75;\n }\n if (context.global.insidetemp >= 85 && context.global.insidetemp < 87.5){\n context.global.fanspeed = 90;\n }\n if (context.global.insidetemp >= 87.5){\n context.global.fanspeed = 100;\n }\n}\nif (context.global.fansdisabled == \"Disabled\"){\n context.global.fanspeed = 0;\n}\n\nmsg.current = {\n fanspeed: context.global.fanspeed,\n insidetemp: context.global.insidetemp,\n fanstatus: context.global.fansdisabled\n}\n\nmsg.payload = context.global.fanspeed;\n\nreturn msg;","outputs":1,"valid":true,"x":300,"y":339,"z":"abafa038.54fa88","wires":[["69a1289e.ec28c","c9b4cb6e.c568a8"]]},{"id":"177e6002.bff4e8","type":"ds18b20","name":"Shed Inisde","sensorid":"28-000006154ba3","timer":"1","x":74,"y":339,"z":"abafa038.54fa88","wires":[["b3231d0a.18df28"]]},{"id":"b647f4e6.6196f8","type":"debug","name":"","active":false,"console":"false","complete":"false","x":721,"y":271,"z":"abafa038.54fa88","wires":[]},{"id":"6d56f263.9f937c","type":"function","name":"Set Values","func":"var fahrenheit = msg.payload * (9/5) + 32;\n\ncontext.global.outsidetemp = fahrenheit;\n\nmsg.current = {\n outsidetemp: context.global.outsidetemp\n}\n\nreturn msg;","outputs":1,"valid":true,"x":263,"y":406,"z":"abafa038.54fa88","wires":[["790f4fa7.5fe4f"]]},{"id":"16104bda.b13fdc","type":"ds18b20","name":"Shed Outside","sensorid":"28-000006155474","timer":"1","x":78,"y":406,"z":"abafa038.54fa88","wires":[["6d56f263.9f937c"]]},{"id":"b93bf43d.ad6c8","type":"debug","name":"","active":false,"console":"false","complete":"false","x":717,"y":470,"z":"abafa038.54fa88","wires":[]},{"id":"69a1289e.ec28c","type":"rpi-gpio out","name":"","pin":"22","set":"","level":"0","out":"pwm","x":542,"y":270,"z":"abafa038.54fa88","wires":[]},{"id":"c9b4cb6e.c568a8","type":"template","name":"","field":"payload","format":"handlebars","template":"Current fan speed: {{current.fanspeed}} Current inside temp: {{current.insidetemp}} Current fan status: {{current.fanstatus}}","x":532,"y":338,"z":"abafa038.54fa88","wires":[["b647f4e6.6196f8","be901cc1.2c2b1"]]},{"id":"790f4fa7.5fe4f","type":"template","name":"","field":"payload","format":"handlebars","template":"Current outside temp: {{current.outsidetemp}}","x":530,"y":406,"z":"abafa038.54fa88","wires":[["b93bf43d.ad6c8","996c686c.e78c58"]]},{"id":"be901cc1.2c2b1","type":"mqtt out","name":"","topic":"fans","qos":"","retain":"","broker":"e00a1942.7d2d4","x":738,"y":338,"z":"abafa038.54fa88","wires":[]},{"id":"996c686c.e78c58","type":"mqtt out","name":"","topic":"fans","qos":"","retain":"","broker":"e00a1942.7d2d4","x":736,"y":406,"z":"abafa038.54fa88","wires":[]},{"id":"7c376171.5b3758","type":"http in","name":"","url":"/disablefans","method":"post","x":95.5,"y":211,"z":"abafa038.54fa88","wires":[["cb0d7eb7.90fb98"]]},{"id":"9ee21763.3627f","type":"function","name":"Redirect back to /temp","func":"msg.res.redirect(\"/temp\");\n","outputs":"0","valid":true,"x":695,"y":211,"z":"abafa038.54fa88","wires":[]},{"id":"cb0d7eb7.90fb98","type":"function","name":"Set Values/Update Fan","func":"if (msg.payload.fan_status == \"Disabled\"){\n msg.current = {\n fanspeed: 0,\n insidetemp: context.global.insidetemp\n }\n context.global.fanspeed = 0;\n context.global.fansdisabled = \"Disabled\";\n}\n\nif (msg.payload.fan_status == \"Auto\"){\n msg.current = {\n fanspeed: context.global.fanspeed,\n insidetemp: context.global.insidetemp\n }\n context.global.fansdisabled = \"Auto\";\n \n if (context.global.insidetemp < 60){\n context.global.fanspeed = 0;\n }\n if (context.global.insidetemp >= 60 && context.global.insidetemp < 68){\n context.global.fanspeed = 15;\n }\n if (context.global.insidetemp >= 68 && context.global.insidetemp < 72){\n context.global.fanspeed = 30;\n }\n if (context.global.insidetemp >= 72 && context.global.insidetemp < 76.5){\n context.global.fanspeed = 40;\n }\n if (context.global.insidetemp >= 76.5 && context.global.insidetemp < 80){\n context.global.fanspeed = 50;\n }\n if (context.global.insidetemp >= 80 && context.global.insidetemp < 82.5){\n context.global.fanspeed = 60;\n }\n if (context.global.insidetemp >= 82.5 && context.global.insidetemp < 85){\n context.global.fanspeed = 75;\n }\n if (context.global.insidetemp >= 85 && context.global.insidetemp < 87.5){\n context.global.fanspeed = 90;\n }\n if (context.global.insidetemp >= 87.5){\n context.global.fanspeed = 100;\n }\n}\n\nif (msg.payload.fan_status == \"Manual\"){\n context.global.fansdisabled = \"Manual\";\n context.global.fanspeed = msg.payload.slider_1;\n}\n\nmsg.payload = context.global.fanspeed;\n\nreturn msg;","outputs":1,"valid":true,"x":300,"y":211,"z":"abafa038.54fa88","wires":[["9ee21763.3627f","69a1289e.ec28c"]]},{"id":"dfc10029.7e1ec","type":"http in","name":"","url":"/updatetemp","method":"post","x":96.5,"y":89.88333129882812,"z":"abafa038.54fa88","wires":[["a56fe28c.7dd64"]]},{"id":"a56fe28c.7dd64","type":"function","name":"Redirect back to /temp","func":"msg.res.redirect(\"/temp\");\n","outputs":"0","valid":true,"x":696,"y":89.88333129882812,"z":"abafa038.54fa88","wires":[]},{"id":"f1a4f857.082b4","type":"inject","name":"","topic":"","payload":"Auto","payloadType":"string","repeat":"","crontab":"","once":true,"x":72.88333129882812,"y":34.883331298828125,"z":"abafa038.54fa88","wires":[["86d64d8.bc17cb"]]},{"id":"86d64d8.bc17cb","type":"function","name":"Redirect back to /temp","func":"context.global.fansdisabled = msg.payload;","outputs":"0","valid":true,"x":694.88330078125,"y":35.883331298828125,"z":"abafa038.54fa88","wires":[]},{"id":"fb35b8cb.7ff7d8","type":"websocket in","name":"app in","server":"8d3eeda3.29971","client":"","x":59.883331298828125,"y":149.88333129882812,"z":"abafa038.54fa88","wires":[["33c54437.d0f724"]]},{"id":"33c54437.d0f724","type":"function","name":"Kill Session","func":"msg._session=\"\";\n\nif (msg.fanstatus == \"Auto\"){\n context.global.fansdisabled = \"Auto\";\n if (context.global.insidetemp < 60){\n context.global.fanspeed = 0;\n }\n if (context.global.insidetemp >= 60 && context.global.insidetemp < 68){\n context.global.fanspeed = 15;\n }\n if (context.global.insidetemp >= 68 && context.global.insidetemp < 72){\n context.global.fanspeed = 30;\n }\n if (context.global.insidetemp >= 72 && context.global.insidetemp < 76.5){\n context.global.fanspeed = 40;\n }\n if (context.global.insidetemp >= 76.5 && context.global.insidetemp < 80){\n context.global.fanspeed = 50;\n }\n if (context.global.insidetemp >= 80 && context.global.insidetemp < 82.5){\n context.global.fanspeed = 60;\n }\n if (context.global.insidetemp >= 82.5 && context.global.insidetemp < 85){\n context.global.fanspeed = 75;\n }\n if (context.global.insidetemp >= 85 && context.global.insidetemp < 87.5){\n context.global.fanspeed = 90;\n }\n if (context.global.insidetemp >= 87.5){\n context.global.fanspeed = 100;\n }\n}\nif (msg.fanstatus == \"Disabled\"){\n context.global.fansdisabled = \"Disabled\";\n context.global.fanspeed = 0;\n}\nif (msg.fanstatus == \"Manual\"){\n context.global.fansdisabled = \"Manual\";\n context.global.fanspeed = msg.manualspeed;\n}\n\nmsg.current = {\n insidetemp: context.global.insidetemp,\n outsidetemp: context.global.outsidetemp,\n fanspeed: context.global.fanspeed,\n fansdisabled: context.global.fansdisabled\n};\n\nmsg.payload = context.global.fanspeed;\n\nreturn msg; ","outputs":1,"valid":true,"x":262.8833312988281,"y":149.88330078125,"z":"abafa038.54fa88","wires":[["c72d3fb3.2ee13","69a1289e.ec28c"]]},{"id":"c72d3fb3.2ee13","type":"websocket out","name":"app out","server":"8d3eeda3.29971","client":"","x":742.8833312988281,"y":149.88333129882812,"z":"abafa038.54fa88","wires":[]},{"id":"329c8209.e3ce4e","type":"http in","name":"Temp Mobile","url":"/tempmobile","method":"get","x":77,"y":593.88330078125,"z":"abafa038.54fa88","wires":[["80d6c2f1.442348"]]},{"id":"663e563.967f128","type":"http response","name":"Temp Mobile","x":720.9999694824219,"y":593.8832702636719,"z":"abafa038.54fa88","wires":[]},{"id":"7df06785.a18be8","type":"template","name":"","field":"payload","format":"handlebars","template":"<html>\n<head>\n\t<title>Simple Display</title>\n\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\t<link rel=\"stylesheet\" href=\"
http://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.css\">\n\t<script src=\"
http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js\"></script>\n\t<script src=\"
http://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js\"></script>\n</head>\n<script type=\"text/javascript\">\n\tvar server = window.location.hostname;\n\tvar topics = {};\n\tvar wsUriC = \"ws://\"+server+\":1880/app\";\n\tvar ws;\n\tfunction wsConnectC() {\n\t\tconsole.log(\"connect\",wsUriC);\n\t\tws = new WebSocket(wsUriC);\n\t\tws.onmessage = function(msg) {\n\t\t\tconsole.log(msg.data);\n\t\t\tvar fromPage=JSON.parse(msg.data);\n\t\t\tif (fromPage.current.insidetemp) {\n\t\t $(\"#insidetemp\").html(\"Inside Temp: \" + fromPage.current.insidetemp); \n }\n if (fromPage.current.outsidetemp) {\n\t\t $(\"#outsidetemp\").html(\"Outside Temp: \" + fromPage.current.outsidetemp);\n }\n if (fromPage.current.fanstatus) {\n\t\t +$(\"#fan_status\").val(fromPage.current.fansdisabled);\n }\n $(\"#fanspeed\").html(\"Fan Speed: \" + fromPage.current.fanspeed);\n $(\"#slider_1\").val(fromPage.current.fanspeed);\n\t\t}\n\t\tws.onopen = function() {\n\t\t\t$(\"#status\").html(\"connected\");\n\t\t\tconsole.log(\"connected\");\n\t\t}\n\t\tws.onclose = function() {\n\t\t\t$(\"#status\").html(\"not connected\");\n\t\t\tsetTimeout(wsConnectC,1000);\n\t\t}\n\t}\n \n\tfunction sendMessage(){\n\t\t// send message back to page in simple JSON format\n\t\t// example {\"part1\":\"Hello\",\"part2\":\"50\"}\n\t\tvar fanstatus=$(\"#fan_status\").val();\n\t\tvar speedslider=$(\"#slider_1\").val();\n\t\tvar jsontext = '{\"fanstatus\":\"' + fanstatus + '\", \"manualspeed\":\"' + speedslider + '\"}';//' + speedslider + '\n\t\tws.send(jsontext);\n\t} // end sendMessage\n\n</script>\n<body onload=\"wsConnectC();\" onunload=\"ws.disconnect;\">\n\t<div data-role=\"page\" id=\"one\">\n\t\t<div data-role=\"header\">\n\t\t\t<h1>Websockets Test Page</h1>\n\t\t</div>\n\t\t<div role=\"main\" class=\"ui-content\">\n\t\t\t<h1>Temperature Display</h1>\n\t\t\t<div id=\"status\">status unknown</div>\n\t\t\t<hr/>\n\t\t\t<div id=\"insidetemp\">Inside Temp: {{current.insidetemp}}</div>\n\t\t\t<div id=\"outsidetemp\">Outside Temp: {{current.outsidetemp}}</div>\n\t\t\t<div id=\"fanspeed\">Fan Speed: {{current.fanspeed}}</div>\n\t\t\t<div id=\"fanstatus\">Fan Status: {{{dropdown}}}</div>\n\t\t\t<hr/>\n\t\t\t<label for=\"slider_1\">Input slider:</label>\n\t\t\t<input type=\"range\" id=\"slider_1\" value={{current.fanspeed}} min=\"0\" max=\"100\" />\n\t\t\t<input type=\"button\" value=\"Update\" onClick=\"sendMessage()\" />\n\t\t</div>\n\t</div>\n</body>\n</html>","x":526.5,"y":593.8832702636719,"z":"abafa038.54fa88","wires":[["663e563.967f128"]]},{"id":"80d6c2f1.442348","type":"function","name":"Get Current Values","func":"msg.current = {\n insidetemp: context.global.insidetemp,\n outsidetemp: context.global.outsidetemp,\n fanspeed: context.global.fanspeed,\n fansdisabled: context.global.fansdisabled\n};\n\nif (context.global.fansdisabled == \"Disabled\"){\n msg.dropdown = \"<select id=\\\"fan_status\\\"><option selected>Disabled</option><option>Auto</option><option>Manual</option></select>\";\n}\nif (context.global.fansdisabled == \"Auto\"){\n msg.dropdown = \"<select id=\\\"fan_status\\\"><option>Disabled</option><option selected>Auto</option><option>Manual</option></select>\";\n}\nif (context.global.fansdisabled == \"Manual\"){\n msg.dropdown = \"<select id=\\\"fan_status\\\"><option>Disabled</option><option>Auto</option><option selected>Manual</option></select>\";\n}\n\nreturn msg;","outputs":1,"valid":true,"x":291,"y":593.8832702636719,"z":"abafa038.54fa88","wires":[["7df06785.a18be8"]]}]