Browse Source

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

mod_update
Dirk Alders 4 years ago
parent
commit
e19535f047
2 changed files with 10 additions and 5 deletions
  1. 8
    3
      smarthome.py
  2. 2
    2
      smarthome.wxg

+ 8
- 3
smarthome.py View File

32
         wx.Frame.__init__(self, *args, **kwds)
32
         wx.Frame.__init__(self, *args, **kwds)
33
         self.SetSize((800, 600))
33
         self.SetSize((800, 600))
34
         self.garage_oc = wx.Button(self, wx.ID_ANY, "Garage")
34
         self.garage_oc = wx.Button(self, wx.ID_ANY, "Garage")
35
-        self.gate_position = wx.Slider(self, wx.ID_ANY, 0, 0, 100)
35
+        self.gate_position = wx.Slider(self, wx.ID_ANY, 50, 0, 100)
36
 
36
 
37
         self.__set_properties()
37
         self.__set_properties()
38
         self.__do_layout()
38
         self.__do_layout()
183
 
183
 
184
 
184
 
185
 if __name__ == "__main__":
185
 if __name__ == "__main__":
186
-    report.appLoggingConfigure(os.path.dirname(__file__), 'stdout', config.loggers)
186
+    report.appLoggingConfigure(os.path.dirname(__file__), config.LOGTARGET, config.loggers)
187
     #
187
     #
188
     app = MyApp(0)
188
     app = MyApp(0)
189
     #
189
     #
190
     # Start TCP-Clients
190
     # Start TCP-Clients
191
     c_tcp = tcp_socket.tcp_client_stp(config.server_out_ip, config.server_out_port, rx_log_lvl=logging.DEBUG)
191
     c_tcp = tcp_socket.tcp_client_stp(config.server_out_ip, config.server_out_port, rx_log_lvl=logging.DEBUG)
192
     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)
192
     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)
193
+    if config.server_out_secret is not None:
194
+        prot_out.authentificate()
193
     c_tcp = tcp_socket.tcp_client_stp(config.server_in_ip, config.server_in_port, rx_log_lvl=logging.DEBUG)
195
     c_tcp = tcp_socket.tcp_client_stp(config.server_in_ip, config.server_in_port, rx_log_lvl=logging.DEBUG)
194
     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)
196
     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)
197
+    if config.server_in_secret is not None:
198
+        prot_in.authentificate()
195
     c_tcp = tcp_socket.tcp_client_stp(config.server_garage_ip, config.server_garage_port, rx_log_lvl=logging.DEBUG)
199
     c_tcp = tcp_socket.tcp_client_stp(config.server_garage_ip, config.server_garage_port, rx_log_lvl=logging.DEBUG)
196
     prot_garage = garage_protocol.my_smarthome_gui_client_protocol_tcp(c_tcp, app.frame.gate_position, app.frame.Layout, config.server_garage_secret)
200
     prot_garage = garage_protocol.my_smarthome_gui_client_protocol_tcp(c_tcp, app.frame.gate_position, app.frame.Layout, config.server_garage_secret)
197
-    prot_garage.authentificate()
201
+    if config.server_garage_secret is not None:
202
+        prot_garage.authentificate()
198
     app.frame.prot_garage = prot_garage
203
     app.frame.prot_garage = prot_garage
199
     pt = task.periodic(10, initiate_update, app.frame, prot_out, prot_in, prot_garage)
204
     pt = task.periodic(10, initiate_update, app.frame, prot_out, prot_in, prot_garage)
200
     pt.run()
205
     pt.run()

+ 2
- 2
smarthome.wxg View File

1
 <?xml version="1.0"?>
1
 <?xml version="1.0"?>
2
-<!-- generated by wxGlade 0.9.3 on Sun Sep  6 14:06:02 2020 -->
2
+<!-- generated by wxGlade 0.9.3 on Sun Sep  6 14:34:01 2020 -->
3
 
3
 
4
 <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">
4
 <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">
5
     <object class="Wetation" name="wetation" base="EditFrame">
5
     <object class="Wetation" name="wetation" base="EditFrame">
416
                             <disabled>1</disabled>
416
                             <disabled>1</disabled>
417
                             <style>wxSL_HORIZONTAL</style>
417
                             <style>wxSL_HORIZONTAL</style>
418
                             <range>0, 100</range>
418
                             <range>0, 100</range>
419
-                            <value>0</value>
419
+                            <value>50</value>
420
                         </object>
420
                         </object>
421
                     </object>
421
                     </object>
422
                     <object class="sizeritem">
422
                     <object class="sizeritem">

Loading…
Cancel
Save