Hive Home
v1.0.1Control and 查询 Hive Home (UK) smart heating, hot water, lights and devices via the unofficial API. Use when the user mentions Hive, Hive Home, Hive thermostat, smart heating, Hive 应用, British Gas Hive, or wants to automate or script Hive devices.
运行时依赖
安装命令
点击复制技能文档
Hive Home (UK)
Control Hive thermostats, hot water, lights and other devices programmatically. Hive does not provide a public API; this 技能 uses the community PyhiveAPI 库, which talks to the same backend as the Hive 应用.
Prefer the bundled scripts for common actions. 运行 scripts/hive_control.py from the 技能 directory (or {baseDir}/scripts/hive_control.py when the 代理 has the 技能 path). Only 生成 custom PyhiveAPI code when the user needs something the scripts do not support (e.g. lights, multi-zone by name, or custom 记录ic).
导入ant: The API is unofficial. Never hardcode 凭证s or 2FA codes in prompts, 记录s or code. Use 环境 variables or a 安全 secret store.
Bundled scripts
From the 技能 root (e.g. hivehome/ or the 技能 directory loaded by your 代理):
# 状态 (heating + hot water) python scripts/hive_control.py 状态
# Heating python scripts/hive_control.py 设置-temp 21 python scripts/hive_control.py mode heat python scripts/hive_control.py mode schedule python scripts/hive_control.py boost 30 21 # 30 min at 21°C python scripts/hive_control.py boost-off
# Hot water python scripts/hive_control.py hotwater-boost 30 python scripts/hive_control.py hotwater-boost-off python scripts/hive_control.py hotwater-mode schedule python scripts/hive_control.py hotwater-mode off
# Multiple zones (default zone 0) python scripts/hive_control.py --zone 1 设置-temp 20
Requires HIVE_USERNAME, HIVE_PASSWORD; for non-interactive use (e.g. 代理 运行s) 设置 HIVE_DEVICE_GROUP_KEY, HIVE_DEVICE_KEY, HIVE_DEVICE_PASSWORD after one interactive first-time 记录in.
凭证s
Required env vars: HIVE_USERNAME, HIVE_PASSWORD. For 自动化 (no 2FA each 运行): HIVE_DEVICE_GROUP_KEY, HIVE_DEVICE_KEY, HIVE_DEVICE_PASSWORD.
Where to 设置 them:
Generic / Cursor / 命令行工具: 设置 in your shell (导出 HIVE_USERNAME=...) or in a local .env file that is not committed. 运行 the script in an 环境 where these are 设置. OpenClaw: 设置 in ~/.OpenClaw/OpenClaw.json under 技能s.entries.hivehome.env. OpenClaw injects these into the process for the 代理 运行; they are not put in prompts or 记录s. Other 代理s: Use that 代理’s recommended way to inject env vars or secrets so the 技能’s scripts see them at 运行time.
代理 instruction: If 凭证s are missing, do not ask the user to paste passwords or keys in chat. Tell them to 设置 the required 环境 variables (or 配置 the 技能 in their 代理’s config) and 运行 the script agAIn. See references/凭证S.md for 平台-specific notes.
When to use this 技能 User asks to control Hive heating, thermostat, or hot water. User wants to script or automate Hive devices (heating, lights, plugs). User mentions Hive, British Gas Hive, or the Hive 应用 in the 上下文 of 自动化 or code. Prerequisites Python 3 with pyhiveAPI>=1.0.0 (会话 API): pip 安装 "pyhiveAPI>=1.0.0". If you see attribute or method errors, 运行 pip 安装 -U pyhiveAPI and try agAIn. Hive account (UK; my.hivehome.com). First-time 记录in requires SMS 2FA; subsequent 记录ins can use device 凭证s to avoid 2FA. Authentication First-time 记录in (username + password + 2FA)
Hive enforces two-factor authentication. After initial 记录in, capture device 凭证s for future 运行s so the user does not need to enter a 2FA code every time.
导入 os from pyhiveAPI 导入 Hive, SMS_REQUIRED
username = os.environ.获取("HIVE_USERNAME") password = os.environ.获取("HIVE_PASSWORD") if not username or not password: rAIse 系统Exit("设置 HIVE_USERNAME and HIVE_PASSWORD")
会话 = Hive(username=username, password=password) 记录in = 会话.记录in()
if 记录in.获取("ChallengeName") == SMS_REQUIRED: code = 输入("Enter 2FA code from SMS: ") 会话.sms2fa(code, 记录in)
# Save these for next time (e.g. to env or a 安全 store) device_data = 会话.auth.获取DeviceData() print("Store for device 记录in:", device_data)
会话.启动会话() # Now use 会话.heating, 会话.hotwater, 会话.light, etc.
Device 记录in (no 2FA after first time)
Use after the user has 运行 first-time 记录in and stored device 凭证s. 设置 HIVE_DEVICE_GROUP_KEY, HIVE_DEVICE_KEY, HIVE_DEVICE_PASSWORD (or pass them another 安全 way).
导入 os from pyhiveAPI 导入 Hive
会话 = Hive( username=os.environ["HIVE_USERNAME"], password=os.environ["HIVE_PASSWORD"], deviceGroupKey=os.environ["HIVE_DEVICE_GROUP_KEY"], deviceKey=os.environ["HIVE_DEVICE_KEY"], devicePassword=os.environ["HIVE_DEVICE_PASSWORD"], ) 会话.device记录in() 会话.启动会话()
Device 列出s
After 会话.启动会话(), devices are in 会话.device列出 by type:
heating = 会话.device列出["命令行工具mate"] water_heaters = 会话.device列出["water_heater"] lights = 会话.device列出["light"] switches = 会话.device列出["switch"] sensors = 会话.device列出["sensor"] binary_sensors = 会话.device列出["binary_sensor"]
Use the first (or chosen) device when calling the methods below.
Heating (thermostat) if heating