diff --git a/chata/index.html b/chata/index.html index 197321f..2b4e947 100644 --- a/chata/index.html +++ b/chata/index.html @@ -1,231 +1,129 @@ - - - - - WiFi test - + + + +

Dálkové ovládání chaty.

+ + + + + + + + + + + +
+
+ - + } + // Receive messages + client.on('message', function (topic, message) { + const tstr = topic.toString(); + const tmsg = message.toString(); + // message is Buffer + TextOut.value += tstr + ' : ' + tmsg + '\n'; + if (tstr === InpTops + Main.tstr) { + ChangeStatus (Main, tmsg); + } else if (tstr === InpTops + Refr.tstr) { + ChangeStatus (Refr, tmsg); + } + }) + } + } + function chPower (relay) { + if (relay.status) { + relay.status = false; + client.publish(OutTops + relay.tstr, '0'); + TextOut.value += relay.tstr + ' off\n'; + } else { + relay.status = true; + client.publish(OutTops + relay.tstr, '1'); + TextOut.value += relay.tstr + ' on\n'; + } + } + + +