Skip to content

Commit 56a7223

Browse files
committed
python, README style
1 parent e00f8c8 commit 56a7223

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ data:
18551855
# Optional: JSON file to write devices data to - located in /config/json/...
18561856
json_out: zha_devices.json
18571857
# Optional: Add timestamp to Filename of JSON file. Defaults to False.
1858-
json_timestamp: True
1858+
json_timestamp: true
18591859
event_done: zha_devices
18601860
```
18611861

custom_components/zha_toolkit/utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -580,11 +580,11 @@ def write_json_to_file(
580580
os.mkdir(out_dir)
581581

582582
if ts is not None:
583-
if '.' in fname:
584-
base, ext = fname.rsplit('.', 1)
585-
fname = base + '_' + ts + '.' + ext
583+
if "." in fname:
584+
base, ext = fname.rsplit(".", 1)
585+
fname = base + "_" + ts + "." + ext
586586
else:
587-
fname = fname + '_' + ts
587+
fname = fname + "_" + ts
588588
if normalize_name:
589589
file_name = os.path.join(out_dir, normalize_filename(fname))
590590
else:

custom_components/zha_toolkit/zha.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,13 @@ async def zha_devices(
125125
if params[p.JSON_OUT] is not None:
126126
timeStamp = None
127127
if params[p.JSON_TIMESTAMP] is not None:
128-
timeStamp = event_data['start_time'].split('.', 1)[0]
128+
timeStamp = event_data["start_time"].split(".", 1)[0]
129129
u.write_json_to_file(
130130
event_data,
131131
subdir="json",
132132
fname=params[p.JSON_OUT],
133133
desc="zha_devices",
134134
listener=listener,
135135
normalize_name=False,
136-
ts=timeStamp
136+
ts=timeStamp,
137137
)
138-

0 commit comments

Comments
 (0)