Default gate position value to 50%, authentification if secret exists and logtarget moved to config file

This commit is contained in:
Dirk Alders 2020-09-06 14:44:03 +02:00
parent 67f9646a83
commit e19535f047
2 changed files with 10 additions and 5 deletions

View File

@ -32,7 +32,7 @@ class Wetation(wx.Frame):
wx.Frame.__init__(self, *args, **kwds) wx.Frame.__init__(self, *args, **kwds)
self.SetSize((800, 600)) self.SetSize((800, 600))
self.garage_oc = wx.Button(self, wx.ID_ANY, "Garage") self.garage_oc = wx.Button(self, wx.ID_ANY, "Garage")
self.gate_position = wx.Slider(self, wx.ID_ANY, 0, 0, 100) self.gate_position = wx.Slider(self, wx.ID_ANY, 50, 0, 100)
self.__set_properties() self.__set_properties()
self.__do_layout() self.__do_layout()
@ -183,17 +183,22 @@ def initiate_update(rt, frame, prot_out, prot_in, prot_garage):
if __name__ == "__main__": if __name__ == "__main__":
report.appLoggingConfigure(os.path.dirname(__file__), 'stdout', config.loggers) report.appLoggingConfigure(os.path.dirname(__file__), config.LOGTARGET, config.loggers)
# #
app = MyApp(0) app = MyApp(0)
# #
# Start TCP-Clients # Start TCP-Clients
c_tcp = tcp_socket.tcp_client_stp(config.server_out_ip, config.server_out_port, rx_log_lvl=logging.DEBUG) c_tcp = tcp_socket.tcp_client_stp(config.server_out_ip, config.server_out_port, rx_log_lvl=logging.DEBUG)
prot_out = wetation_protocol.my_smarthome_gui_client_protocol_tcp(c_tcp, app.frame.out_temperature, app.frame.out_humidity, app.frame.out_pressure, app.frame.Layout, config.server_out_secret) prot_out = wetation_protocol.my_smarthome_gui_client_protocol_tcp(c_tcp, app.frame.out_temperature, app.frame.out_humidity, app.frame.out_pressure, app.frame.Layout, config.server_out_secret)
if config.server_out_secret is not None:
prot_out.authentificate()
c_tcp = tcp_socket.tcp_client_stp(config.server_in_ip, config.server_in_port, rx_log_lvl=logging.DEBUG) c_tcp = tcp_socket.tcp_client_stp(config.server_in_ip, config.server_in_port, rx_log_lvl=logging.DEBUG)
prot_in = wetation_protocol.my_smarthome_gui_client_protocol_tcp(c_tcp, app.frame.in_temperature, app.frame.in_humidity, app.frame.in_pressure, app.frame.Layout, config.server_in_secret) prot_in = wetation_protocol.my_smarthome_gui_client_protocol_tcp(c_tcp, app.frame.in_temperature, app.frame.in_humidity, app.frame.in_pressure, app.frame.Layout, config.server_in_secret)
if config.server_in_secret is not None:
prot_in.authentificate()
c_tcp = tcp_socket.tcp_client_stp(config.server_garage_ip, config.server_garage_port, rx_log_lvl=logging.DEBUG) c_tcp = tcp_socket.tcp_client_stp(config.server_garage_ip, config.server_garage_port, rx_log_lvl=logging.DEBUG)
prot_garage = garage_protocol.my_smarthome_gui_client_protocol_tcp(c_tcp, app.frame.gate_position, app.frame.Layout, config.server_garage_secret) prot_garage = garage_protocol.my_smarthome_gui_client_protocol_tcp(c_tcp, app.frame.gate_position, app.frame.Layout, config.server_garage_secret)
if config.server_garage_secret is not None:
prot_garage.authentificate() prot_garage.authentificate()
app.frame.prot_garage = prot_garage app.frame.prot_garage = prot_garage
pt = task.periodic(10, initiate_update, app.frame, prot_out, prot_in, prot_garage) pt = task.periodic(10, initiate_update, app.frame, prot_out, prot_in, prot_garage)

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- generated by wxGlade 0.9.3 on Sun Sep 6 14:06:02 2020 --> <!-- generated by wxGlade 0.9.3 on Sun Sep 6 14:34:01 2020 -->
<application class="MyApp" encoding="UTF-8" for_version="3.0" header_extension=".h" indent_amount="4" indent_symbol="space" is_template="0" language="python" mark_blocks="1" name="app" option="0" overwrite="0" path="./smarthome.py" source_extension=".cpp" top_window="wetation" use_gettext="0" use_new_namespace="1"> <application class="MyApp" encoding="UTF-8" for_version="3.0" header_extension=".h" indent_amount="4" indent_symbol="space" is_template="0" language="python" mark_blocks="1" name="app" option="0" overwrite="0" path="./smarthome.py" source_extension=".cpp" top_window="wetation" use_gettext="0" use_new_namespace="1">
<object class="Wetation" name="wetation" base="EditFrame"> <object class="Wetation" name="wetation" base="EditFrame">
@ -416,7 +416,7 @@
<disabled>1</disabled> <disabled>1</disabled>
<style>wxSL_HORIZONTAL</style> <style>wxSL_HORIZONTAL</style>
<range>0, 100</range> <range>0, 100</range>
<value>0</value> <value>50</value>
</object> </object>
</object> </object>
<object class="sizeritem"> <object class="sizeritem">