from MicroWebSrv.microWebSrv import MicroWebSrv from module import mod @MicroWebSrv.route('/status') def _httpHandlerStatusGet(httpClient, httpResponse) : content = mod.get_dat() print("content:", content) httpResponse.WriteResponseOk( headers = None, contentType = "text/html", contentCharset = "UTF-8", content = content ) @MicroWebSrv.route('/heat/') def _httpHandlerHeat(httpClient, httpResponse, args={}) : content = '' if 'index' in args: if args['index'] == 'on': mod.heat_on() content = str(mod.heat.status) elif args['index'] == 'off': mod.heat_off() content = str(mod.heat.status) elif args['index'] == 'status': content = str(mod.heat.status) print('_httpHandlerHeat:', content) httpResponse.WriteResponseOk( headers = None, contentType = "text/html", contentCharset = "UTF-8", content = content ) # ---------------------------------------------------------------------------- routeHandlers = [ ( "/status", "GET", _httpHandlerStatusGet ), ( '/heat/', 'GET', _httpHandlerHeat ), ]