我想跟踪我在工作计算机上花费了多少时间。我希望将其集成到家庭助理中。这个想法是如果我在过去 30 秒内处于活动状态,则每 30 秒向webhook发送一个 POST 请求。Home Assistant 只需要 (1) 将这些 ping 连接到连续时间,并且 (2) 向我显示我每天(过去 30 天左右)在该机器上的时间。
我很难找到如何在家庭助手中获取 webhook 信息。我认为通过history_stats集成一定有可能,但我不知道如何。
我做了什么
我创建了activity_tracker
Python 包,它可以在活动时调用 webhook。
我想我需要在我的configuration.yaml
:
sensor:
- platform: history_stats
name: Martin is working
entity_id: # the webhook id?
state: "on"
type: time
start: "{{ now().replace(minute=0, second=0) }}"
end: "{{ now() }}"