📦 Tibber Energy

v1.0.0

使用 Tibber API 获取每小时现货电价,规划最便宜的电器或电动车充电时段,侦测用电异常,并触发智能家居动作……

0· 0·0 当前·0 累计
pmagnomuller 头像by @pmagnomuller (Pedro Müller)
0

运行时依赖

无特殊依赖

安装命令

点击复制
官方npx clawhub@latest install tibber-energy
镜像加速npx clawhub@latest install tibber-energy --registry https://cn.longxiaskill.com

技能文档

Tibber Energy 何时使用 用户询问以下场景时调用:

  • 当前或即将出现的电力现货价格
  • 洗碗机、洗衣、电动车充电的最便宜时段
  • 可疑的用电激增
  • 基于价格阈值触发设备动作

配置 运行前设置环境变量: export TIBBER_ACCESS_TOKEN="your_tibber_token" export TIBBER_HOME_ID="optional_home_id" 若账户仅有一处住宅,TIBBER_HOME_ID 可省略。

也可本地复制 .env.example 为 .env 并填写: cp .env.example .env

如需可分享/持久配置,创建: ~/.config/tibber-energy/config.json 模板复制: cp config.json.example ~/.config/tibber-energy/config.json

凭据优先级:

  • 环境变量 (TIBBER_*)
  • ~/.config/tibber-energy/config.json
  • 交互提示(仅当传入 --prompt-missing-secrets)

运行 在技能目录使用包装器: bash run.sh prices

命令 1) 获取当前及未来 36 小时现货价 bash run.sh prices --hours 36

2) 为电器或电动车寻找最优充电时段 按 kWh / 功率-kW 估算时长,再寻最便宜连续块: bash run.sh optimize \ --kwh 28 \ --power-kw 11 \ --window-start "2026-04-27T18:00:00+02:00" \ --window-end "2026-04-28T08:00:00+02:00"

固定时长: bash run.sh optimize --duration-hours 2

3) 监控用电并标记异常 bash run.sh anomalies --lookback-hours 168 --sigma 2.5

4) 按价格阈值控制智能家居设备 用 shell 命令、Home Assistant script 或智能插座 CLI。 dry-run: bash run.sh control \ --price-below 0.15 \ --on-command "ha service call switch.turn_on --entity_id switch.ev_charger" \ --off-command "ha service call switch.turn_off --entity_id switch.ev_charger"

执行: bash run.sh control \ --price-above 0.35 \ --on-command "ha service call switch.turn_on --entity_id switch.boiler" \ --off-command "ha service call switch.turn_off --entity_id switch.boiler" \ --execute

说明

  • 价格取自 currentSubscription.priceInfo(今日+明日)。
  • 异常检测将最新小时与回看均值/标准差对比。
  • 控制模式先 dry-run 验证,再 --execute。

安全

  • 切勿提交含真实 token 的 .env。
  • 验证阈值逻辑后再启用 --execute。
  • --on-command / --off-command 视为可信 shell 命令。
  • 默认非交互;仅当需要交互输入时加 --prompt-missing-secrets。

发布清单(ClawHub) 包含:SKILL.md、run.sh、tibber_energy.py、.env.example、config.json.example、.gitignore 排除:.env、__pycache__/、本地日志、临时文件

验证(干净 shell): cp .env.example .env 并填入有效凭据 bash run.sh prices --hours 6 bash run.sh optimize --duration-hours 2 bash run.sh anomalies --lookback-hours 168 --sigma 2.5 bash run.sh control --price-below 0.15 --on-command "echo on" --off-command "echo off"

数据来源ClawHub ↗ · 中文优化:龙虾技能库