Add notion table
This commit is contained in:
@@ -2,9 +2,12 @@ from datetime import datetime
|
||||
|
||||
from fastapi_mqtt import FastMQTT, MQTTConfig
|
||||
|
||||
from recorder.notion_handle import NotionClient
|
||||
|
||||
|
||||
class PooRecorder:
|
||||
mqtt_config = MQTTConfig(username="mqtt", password="mqtt", reconnect_retries=-1) # noqa: S106
|
||||
notion = NotionClient()
|
||||
mqtt = FastMQTT(config=mqtt_config, client_id="poo_recorder")
|
||||
CONFIG_TOPIC = "homeassistant/text/poo_recorder/config"
|
||||
AVAILABILITY_TOPIC = "studiotj/poo_recorder/status"
|
||||
@@ -29,6 +32,7 @@ class PooRecorder:
|
||||
PooRecorder.publish_text(status)
|
||||
now = datetime.now(tz=datetime.now().astimezone().tzinfo)
|
||||
PooRecorder.publish_time(now)
|
||||
await PooRecorder.notion.note(now, status)
|
||||
|
||||
@staticmethod
|
||||
@mqtt.on_connect()
|
||||
|
||||
Reference in New Issue
Block a user