File tree 4 files changed +17
-5
lines changed
4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change
1
+ layout python python3.10
Original file line number Diff line number Diff line change 1
1
__pycache__
2
+ .direnv
2
3
.env
3
4
.venv
4
5
.vscode
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
1
2
import datetime
2
3
import json
3
4
import sqlite3
@@ -43,6 +44,8 @@ def _check_database(con):
43
44
def import_data ():
44
45
for account_path in _settings .storage_path .iterdir ():
45
46
# account_id = account_path.name
47
+ if not account_path .is_dir ():
48
+ continue
46
49
47
50
for energy_meter_path in account_path .iterdir ():
48
51
# energy_meter = energy_meter_path.name
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
1
2
import datetime
2
3
import json
3
4
import logging
@@ -135,12 +136,18 @@ def download_consumptions_for_meter(
135
136
)
136
137
continue
137
138
138
- json_file .write_text (
139
- json .dumps (
140
- smartmeter .get_consumption_records_for_day (energy_meter , day ),
141
- indent = 4 ,
142
- )
139
+ consumption_records = smartmeter .get_consumption_records_for_day (
140
+ energy_meter , day
143
141
)
142
+ if not consumption_records ["meteredValues" ]:
143
+ _logger .error (
144
+ "Consumption records for '%s' and '%s' missing data." ,
145
+ energy_meter ,
146
+ day .isoformat (),
147
+ )
148
+ continue
149
+
150
+ json_file .write_text (json .dumps (consumption_records , indent = 4 ))
144
151
145
152
146
153
def main ():
You can’t perform that action at this time.
0 commit comments