diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2023-05-18 05:12:35 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2023-05-18 05:12:35 +0300 |
commit | 2960f9f09a9991e342a676999e498b08affa4dff (patch) | |
tree | 3198fed18a400588bb38dd1e523b0e50ba07917b /src/home | |
parent | c0111bf4d3dd91f54d27346970e4c6e0a1ce357e (diff) |
openwrt: home side changes
Diffstat (limited to 'src/home')
-rw-r--r-- | src/home/api/web_api_client.py | 6 | ||||
-rw-r--r-- | src/home/database/bots.py | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/home/api/web_api_client.py b/src/home/api/web_api_client.py index ca9a9ee..6677182 100644 --- a/src/home/api/web_api_client.py +++ b/src/home/api/web_api_client.py @@ -66,9 +66,11 @@ class WebAPIClient: }) def log_openwrt(self, - lines: List[Tuple[int, str]]): + lines: List[Tuple[int, str]], + access_point: int): return self._post('log/openwrt/', { - 'logs': stringify(lines) + 'logs': stringify(lines), + 'ap': access_point }) def get_sensors_data(self, diff --git a/src/home/database/bots.py b/src/home/database/bots.py index 99befc0..26fb170 100644 --- a/src/home/database/bots.py +++ b/src/home/database/bots.py @@ -37,13 +37,14 @@ class BotsDatabase(MySQLDatabase): self.commit() def add_openwrt_logs(self, - lines: List[Tuple[datetime, str]]): + lines: List[Tuple[datetime, str]], + access_point: int): now = datetime.now() with self.cursor() as cursor: for line in lines: time, text = line - cursor.execute("INSERT INTO openwrt (log_time, received_time, text) VALUES (%s, %s, %s)", - (time.strftime(datetime_fmt), now.strftime(datetime_fmt), text)) + cursor.execute("INSERT INTO openwrt (log_time, received_time, text, ap) VALUES (%s, %s, %s, %s)", + (time.strftime(datetime_fmt), now.strftime(datetime_fmt), text, access_point)) self.commit() def add_sound_hits(self, |