📦 Ostrom Energy

v1.0.1

获取 Ostrom 每小时电力现货价格,找出最便宜的电器/电动车充电时段,并按价格阈值触发智能家居动作。用于 Ostro…

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

运行时依赖

无特殊依赖

安装命令

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

技能文档

Ostrom Energy 使用时机 当用户询问:

  • 当前或即将出现的电力现货价格
  • 运行负载(洗碗机、洗衣、EV 充电)的最便宜时段
  • 基于价格阈值触发设备动作

配置 运行前设置环境变量: export OSTROM_CLIENT_ID="your_ostrom_client_id" export OSTROM_CLIENT_SECRET="your_ostrom_client_secret" export OSTROM_ZIP="optional_zip_code" export OSTROM_ENV="production" # 或 sandbox

OSTROM_ZIP 可选,但建议填写以包含地方税费和网基费。

持久配置: mkdir -p ~/.config/ostrom-energy cp config.json.example ~/.config/ostrom-energy/config.json $EDITOR ~/.config/ostrom-energy/config.json

仅本地测试时,将 .env.example 复制为本技能目录下的 .env 并填入值。切勿提交真实凭据。

凭据优先级:

  • 环境变量(OSTROM_*,含 .env 加载)
  • ~/.config/ostrom-energy/config.json
  • 交互提示(仅当传入 --prompt-missing-secrets)

运行 除非已安装本地包装器,否则始终在本技能目录运行。

可靠目录内调用: bash run.sh prices

直接可执行: ./ostrom-energy prices

一次性本地 CLI 安装: bash install-local-command.sh ostrom-energy prices

若提示 command not found,用 bash run.sh … 或重新运行 install-local-command.sh。

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

2) 为电器或 EV 充电找最优时段 估算小时数:kwh / power-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 control \ --price-below 0.20 \ --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.40 \ --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

说明 每次运行前通过 client credentials (/oauth2/token) 获取 OAuth2 令牌。 价格来自 /spot-prices,显示为: spot = grossKwhPrice (ct/kWh) taxes = grossKwhTaxAndLevies (ct/kWh) total = spot + taxes optimize 与 control 使用转为 EUR/kWh 的 total。

先用干跑验证控制逻辑,确认无误后再加 --execute。

安全

  • 切勿提交含真实凭据的 .env
  • 验证阈值逻辑前保持 --execute 关闭
  • 将 --on-command / --off-command 视为受信输入(直接执行 shell 命令)
  • 默认非交互,仅当需要交互输入凭据时加 --prompt-missing-secrets

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

验证(干净 shell): bash run.sh --help ./ostrom-energy --help bash install-local-command.sh && ostrom-energy --help

凭据有效时: bash run.sh prices --hours 6 bash run.sh optimize --duration-hours 2 bash run.sh control --price-below 0.20 --on-command "echo on" --off-command "echo off"

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