Quellcode durchsuchen

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

mod_update
Dirk Alders vor 4 Jahren
Ursprung
Commit
e19535f047
2 geänderte Dateien mit 10 neuen und 5 gelöschten Zeilen
  1. 8
    3
      smarthome.py
  2. 2
    2
      smarthome.wxg

+ 8
- 3
smarthome.py Datei anzeigen

@@ -32,7 +32,7 @@ class Wetation(wx.Frame):
32 32
         wx.Frame.__init__(self, *args, **kwds)
33 33
         self.SetSize((800, 600))
34 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 37
         self.__set_properties()
38 38
         self.__do_layout()
@@ -183,18 +183,23 @@ def initiate_update(rt, frame, prot_out, prot_in, prot_garage):
183 183
 
184 184
 
185 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 188
     app = MyApp(0)
189 189
     #
190 190
     # Start TCP-Clients
191 191
     c_tcp = tcp_socket.tcp_client_stp(config.server_out_ip, config.server_out_port, rx_log_lvl=logging.DEBUG)
192 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 195
     c_tcp = tcp_socket.tcp_client_stp(config.server_in_ip, config.server_in_port, rx_log_lvl=logging.DEBUG)
194 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 199
     c_tcp = tcp_socket.tcp_client_stp(config.server_garage_ip, config.server_garage_port, rx_log_lvl=logging.DEBUG)
196 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 203
     app.frame.prot_garage = prot_garage
199 204
     pt = task.periodic(10, initiate_update, app.frame, prot_out, prot_in, prot_garage)
200 205
     pt.run()

+ 2
- 2
smarthome.wxg Datei anzeigen

@@ -1,5 +1,5 @@
1 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 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 5
     <object class="Wetation" name="wetation" base="EditFrame">
@@ -416,7 +416,7 @@
416 416
                             <disabled>1</disabled>
417 417
                             <style>wxSL_HORIZONTAL</style>
418 418
                             <range>0, 100</range>
419
-                            <value>0</value>
419
+                            <value>50</value>
420 420
                         </object>
421 421
                     </object>
422 422
                     <object class="sizeritem">

Laden…
Abbrechen
Speichern