Skip to content

Commit

Permalink
Merge pull request #90 from DankersW/feature/update
Browse files Browse the repository at this point in the history
Feature/update
  • Loading branch information
DankersW authored Jan 30, 2022
2 parents c9981e3 + fb22a08 commit cbba19f
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ name: build_docker

on:
push:
branches: master
branches: [master]
tags:
- 'v*.*.*'
- '*.*.*'

jobs:
buildx:
Expand Down
2 changes: 1 addition & 1 deletion bin/g_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def create_jwt(project_id, private_key_file, algorithm):
'exp': datetime.datetime.utcnow() + datetime.timedelta(minutes=60),
'aud': project_id
}
with open(private_key_file, 'r') as f:
with open(private_key_file, 'r', encoding="utf8") as f:
private_key = f.read()
return jwt.encode(token, private_key, algorithm=algorithm)

Expand Down
4 changes: 2 additions & 2 deletions docker/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ system_components:

logging:
file_log_folder: 'C:\Users\woute\development\logs'
min_log_level: info
min_log_level: warning
log_collection_name: logs

mqtt_gateway:
Expand All @@ -23,5 +23,5 @@ mongo_db:
host_ip: 'mongo'

device_manager:
poll_interval: 3000 # Interval in seconds that the device_manager polls devices
poll_interval: 6000 # Interval in seconds that the device_manager polls devices
wait_period: 600 # Time in sec spend waiting for status messages
2 changes: 1 addition & 1 deletion home_automation_framework/framework/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class Subject:
def __init__(self, events) -> None:
self.events = {event: dict() for event in events}
self.events = {event: {} for event in events}

def get_subscribers(self, event) -> dict:
return self.events[event]
Expand Down
4 changes: 2 additions & 2 deletions home_automation_framework/host_health/health_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

class HealthMonitor(Thread):
running = True
update_time_sec = 600
update_time_sec = 6000
subscribed_event = []

def __init__(self, queue: Queue, thread_event: Event) -> None:
Expand Down Expand Up @@ -55,7 +55,7 @@ def _get_timestamp() -> datetime:
def poll_system_temp(self) -> float:
temp_file = self._get_temperature_file()
try:
with open(temp_file) as file:
with open(temp_file, encoding="utf8") as file:
return float(file.readline()) / 1000
except FileNotFoundError:
self.log.critical(f'Temperature file {temp_file!r} does not exist')
Expand Down
2 changes: 1 addition & 1 deletion home_automation_framework/logging/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _log(self, msg, log_lvl):
return None

def _write_to_file(self, log_msg):
with open(self.filename, "a") as file:
with open(self.filename, "a", encoding="utf8") as file:
file.write(log_msg + '\n')
file.close()

Expand Down
2 changes: 1 addition & 1 deletion home_automation_framework/utils/configuration_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ def _get_path_to_conf_file(self) -> Path:

@staticmethod
def _yml_to_dict(file_path: Path) -> Union[dict, list, None]:
with open(file_path) as yml_file:
with open(file_path, encoding="utf8") as yml_file:
return yaml.safe_load(yml_file)
2 changes: 1 addition & 1 deletion tests/helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def create_test_file_with_data(file: Path, data: str) -> None:
with open(file, 'w') as file:
with open(file, 'w', encoding="utf8") as file:
file.write(data)


Expand Down
2 changes: 1 addition & 1 deletion tests/utils/test_configuration_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_yml_to_dict_mock_conf_file(self):
test_content = {'a': 123, 'b': 456}
filename = 'test.yaml'
yml_path = Path.cwd().joinpath(filename)
with open(yml_path, 'w') as file:
with open(yml_path, 'w', encoding="utf8") as file:
yaml.dump(test_content, file)
result = self.conf_parser._yml_to_dict(file_path=yml_path)
self.assertDictEqual(result, test_content)
Expand Down

0 comments on commit cbba19f

Please sign in to comment.