Browse Source

slight c2r.py adaption

master
Dirk Alders 1 year ago
parent
commit
9af9397324
2 changed files with 2 additions and 19 deletions
  1. 1
    18
      bin/c2r.py
  2. 1
    1
      config_example/configuration.yaml

+ 1
- 18
bin/c2r.py View File

3
 import re
3
 import re
4
 import sys
4
 import sys
5
 
5
 
6
-s = """homeassistant: false
7
-permit_join: false
8
-mqtt:
9
-  base_topic: zigbee/gfw
10
-  server: mqtt://mqtt
11
-  user: smarthome
12
-  password: Tc1IsZENNnSldRu8CGA6
13
-serial:
14
-  port: /dev/ttyACM0
15
-advanced:
16
-  ikea_ota_use_test_url: true
17
-  legacy_api: false
18
-  log_level: debug
19
-  channel: 15
20
-  homeassistant_legacy_entity_attributes: false
21
-  legacy_availability_payload: false
22
-"""
23
 try:
6
 try:
24
     src_file = sys.argv[1]
7
     src_file = sys.argv[1]
25
     dst_file = sys.argv[2]
8
     dst_file = sys.argv[2]
34
     print("Unable to open", '"' + src_file + '"')
17
     print("Unable to open", '"' + src_file + '"')
35
     sys.exit(18)
18
     sys.exit(18)
36
 
19
 
37
-n = re.sub('^.*server: .*', '  server: <mqtt_smarthome_hostname>', s, flags=re.MULTILINE)
20
+n = re.sub('^.*server: .*', '  server: mqtt://<mqtt_smarthome_hostname>', s, flags=re.MULTILINE)
38
 n = re.sub('^.*user: .*', '  user: <mqtt_smarthome_username>', n, flags=re.MULTILINE)
21
 n = re.sub('^.*user: .*', '  user: <mqtt_smarthome_username>', n, flags=re.MULTILINE)
39
 n = re.sub('^.*password: .*', '  password: <mqtt_smarthome_password>', n, flags=re.MULTILINE)
22
 n = re.sub('^.*password: .*', '  password: <mqtt_smarthome_password>', n, flags=re.MULTILINE)
40
 n = re.sub('^.*auth_token: .*', '  auth_token: <zigbee_auth_token>', n, flags=re.MULTILINE)
23
 n = re.sub('^.*auth_token: .*', '  auth_token: <zigbee_auth_token>', n, flags=re.MULTILINE)

+ 1
- 1
config_example/configuration.yaml View File

2
 permit_join: false
2
 permit_join: false
3
 mqtt:
3
 mqtt:
4
   base_topic: zigbee/gfw
4
   base_topic: zigbee/gfw
5
-  server: <mqtt_smarthome_hostname>
5
+  server: mqtt://<mqtt_smarthome_hostname>
6
   user: <mqtt_smarthome_username>
6
   user: <mqtt_smarthome_username>
7
   password: <mqtt_smarthome_password>
7
   password: <mqtt_smarthome_password>
8
 serial:
8
 serial:

Loading…
Cancel
Save