Compare commits

..

10 Commits

Author SHA1 Message Date
85eed58a06 added support for multiple instances
Some checks failed
Validate / Validate (push) Has been cancelled
2026-05-31 11:36:30 +02:00
nius
1f122f2235 1. Fix the issue of duplicate entity names;
2. Fix the issue of some entities being unavailable;
2026-05-06 18:13:13 +08:00
nius
3b562b0371 1. Fix the issue of duplicate entity names;
2. Fix the issue of some entities being unavailable;
2026-03-27 18:50:25 +08:00
ht-it-lab
4dfe66b635 Update README.md
version change
2026-03-26 13:56:25 +08:00
nius
ffa46ebac0 1. Fix the issue of duplicate entity names;
2. Fix the issue of some entities being unavailable;
2026-03-12 16:48:12 +08:00
ht-it-lab
618bf71296 Update README.md 2026-03-06 17:15:39 +08:00
ht-it-lab
217b277dbe Delete docs directory 2026-03-06 16:25:39 +08:00
wongshan-m1
a1a1f9d2c0 docs: replace Mermaid diagrams with PNG images for GitLab compatibility
GitLab 11 does not support Mermaid rendering. Exported 4 diagrams
(architecture, auth flow, config flow, energy mapping) as PNG images
and updated PRD.md to reference them.

Made-with: Cursor
2026-03-05 13:56:59 +08:00
wongshan-m1
6b183d6f5d docs: update PRD to MQTT architecture, add acceptance criteria
- Replace HTTP/REST with MQTT throughout PRD
- Add MQTT Broker prerequisites section (§2.2)
- Convert architecture and auth flow diagrams to Mermaid
- Add comprehensive Home Energy Management adaptation (§6.2)
- Add product acceptance criteria document (78 items)

Made-with: Cursor
2026-03-05 11:48:12 +08:00
wongshan-m1
9b4cf798ef docs: add PRD prompt and product requirements document
Add complete product requirements document (PRD) for Jackery DIY3
Home Assistant integration, covering architecture, entity mapping,
authorization flow, and future roadmap.

Made-with: Cursor
2026-03-04 20:10:01 +08:00
10 changed files with 56 additions and 57 deletions

View File

@@ -1,8 +1,8 @@
## Jackery Home Assistant Energy Monitoring Integration
[![hacs_badge](https://img.shields.io/badge/HACS-Custom-orange.svg)](https://github.com/hacs/integration)
[![GitHub Release](https://img.shields.io/github/release/suyulin/jackery.svg)](https://github.com/suyulin/jackery/releases)
[![License](https://img.shields.io/github/license/suyulin/jackery.svg)](LICENSE)
[![GitHub Release](https://img.shields.io/github/release/ht-it-lab/jackery.svg)](https://github.com/ht-it-lab/jackery/releases)
[![License](https://img.shields.io/github/license/ht-it-lab/jackery.svg)](LICENSE)
> **⚠️ Beta Stage**: This integration is currently in Beta testing phase and may be unstable. Please use with caution and report any issues.
@@ -36,9 +36,9 @@ Before the Jackery integration can receive any data, **two things must be in pla
2. **Device is configured from the Jackery app**
- Use the vendor/Jackery mobile app to add the device/gateway and complete its initial setup.
- **⚠️ APP Version Requirement**: Jackery APP version must be greater than **2.10.18** to support this integration.
- **⚠️ APP Version Requirement**: Jackery APP version must be greater than **2.0.0** to support this integration.
- Make sure the device has network access and is configured so that it can connect to your MQTT/cloud backend.
- In the Jackery app, long-press the app logo to open the configuration screen.
- Go to Device Details Page > Settings > MQTT in the Jackery app to open the configuration page.
- In the Jackery app configuration, **replace the IP with the address of your own MQTT server**.
![jackery_config](./img/app_config_mqtt.png)
@@ -52,24 +52,18 @@ Before the Jackery integration can receive any data, **two things must be in pla
- Open HACS in Home Assistant
- Click the three dots in the top-right → **Custom repositories**
- Add repository URL: `https://github.com/suyulin/jackery`
- Add repository URL: `https://github.com/ht-it-lab/jackery`
- Category: `Integration`
- Click **Add**
2. **Install the integration**
- In HACS, search for **"Jackery"**
- Click **Install**
- Restart Home Assistant
3. **Configure the integration**
2. **Configure the integration**
- Go to **Settings → Devices & Services → Add Integration**
- Search for **"Jackery"**
- **Enter your Token** (Required for authentication)
- You can find this token in your Jackery app settings or device documentation.
- Enter an MQTT topic prefix if needed (default: `hb`)
- Submit to finish configuration
![config](./img/jackery_home_add.png)
![config](./img/jackery_home_config.png)
![config](./img/jackery_home_add.png)
![config](./img/jackery_home_config.png)
> **Requirement**: The built-in **MQTT integration** must be configured and connected to your MQTT broker **before** Jackery will work.
### Example: Energy Flow Card Plus

View File

@@ -35,12 +35,15 @@ class JackeryConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
"""Handle the initial step."""
if self._async_current_entries():
return self.async_abort(reason="single_instance_allowed")
errors = {}
if user_input is not None:
# Check for duplicate device SN
new_sn = user_input.get("device_sn", "")
for entry in self._async_current_entries():
if entry.data.get("device_sn") == new_sn:
return self.async_abort(reason="already_configured")
# 检查 MQTT 集成是否已配置
if not await mqtt.async_wait_for_mqtt_client(self.hass):
errors["base"] = "mqtt_not_configured"
@@ -52,7 +55,7 @@ class JackeryConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
)
return self.async_create_entry(
title="Jackery",
title=f"Jackery {new_sn}",
data=user_input,
)

View File

@@ -2,14 +2,14 @@
"domain": "jackery",
"name": "Jackery",
"codeowners": [
"@suyulin"
"@ht-it-lab"
],
"config_flow": true,
"dependencies": [
"mqtt"
],
"documentation": "https://github.com/suyulin/jackery",
"issue_tracker": "https://github.com/suyulin/jackery/issues",
"documentation": "https://github.com/ht-it-lab/jackery",
"issue_tracker": "https://github.com/ht-it-lab/jackery/issues",
"iot_class": "local_push",
"version": "1.1.62"
}

View File

@@ -68,15 +68,16 @@ class JackeryMainNumber(NumberEntity):
self._key = key
self._coordinator = coordinator
self._attr_name = name
self._attr_unique_id = f"jackery_main_{key}"
self._attr_unique_id = f"jackery_{config_entry_id}_main_{key}"
self._attr_has_entity_name = True
self._attr_mode = NumberMode.SLIDER
self._attr_native_min_value = min_value
self._attr_native_max_value = max_value
self._attr_native_step = step
device_sn = coordinator._device_sn or "Unknown"
self._attr_device_info = {
"identifiers": {(DOMAIN, config_entry_id)},
"name": "Jackery",
"name": f"Jackery {device_sn}",
"manufacturer": "Jackery",
"model": "Energy Monitor",
}

View File

@@ -288,22 +288,22 @@ SENSORS = {
"device_class": None,
"state_class": SensorStateClass.MEASUREMENT,
},
"is_auto_standby": {
"json_key": "isAutoStandby",
"name": "Auto Standby Allowed",
"unit": None,
"icon": "mdi:power-sleep",
"device_class": None,
"state_class": None, # 1-Allowed, 0-Not Allowed
},
"auto_standby_status": {
"json_key": "autoStandby",
"name": "Auto Standby Status",
"unit": None,
"icon": "mdi:power-sleep",
"device_class": None,
"state_class": None, # 0-Invalid, 1-Sleep/Off, 2-On
},
# "is_auto_standby": {
# "json_key": "isAutoStandby",
# "name": "Auto Standby Allowed",
# "unit": None,
# "icon": "mdi:power-sleep",
# "device_class": None,
# "state_class": None, # 1-Allowed, 0-Not Allowed
# },
# "auto_standby_status": {
# "json_key": "autoStandby",
# "name": "Auto Standby Mode",
# "unit": None,
# "icon": "mdi:power-sleep",
# "device_class": None,
# "state_class": None, # 0-Invalid, 1-Sleep/Off, 2-On
# },
# Calculated Sensors
"home_power": {
@@ -644,8 +644,11 @@ class JackeryDataCoordinator:
# Type 25 or Status: Main device data
elif isinstance(body, dict):
# Merge top-level keys
# Merge top-level keys into cache to preserve fields not present in current message
self._data_cache.update(body)
# Special handling for isAutoStandby/autoStandby to ensure they are always available if ever seen
# (Optional: can add more critical fields here if needed)
except json.JSONDecodeError:
_LOGGER.warning(f"Invalid JSON payload on {topic}")
@@ -900,8 +903,8 @@ class JackeryDataCoordinator:
# 兼容旧逻辑或直接字段 (如果 cts 不存在)
if not grid_available:
grid_buy_raw = data.get("gridBuyPw") # Hypothetical key
grid_sell_raw = data.get("gridSellPw") # Hypothetical key
grid_buy_raw = data.get("gridBuyPw") or data.get("gridInPw")
grid_sell_raw = data.get("gridSellPw") or data.get("gridOutPw")
if grid_buy_raw is not None and grid_sell_raw is not None:
grid_available = True
grid_buy = float(grid_buy_raw)
@@ -1112,12 +1115,13 @@ class JackerySensor(SensorEntity):
self._attr_icon = self._config["icon"]
self._attr_device_class = self._config["device_class"]
self._attr_state_class = self._config["state_class"]
self._attr_unique_id = f"jackery_{sensor_id}"
self._attr_unique_id = f"jackery_{config_entry_id}_{sensor_id}"
self._attr_has_entity_name = True
device_sn = coordinator._device_sn or "Unknown"
self._attr_device_info = {
"identifiers": {(DOMAIN, config_entry_id)},
"name": "Jackery",
"name": f"Jackery {device_sn}",
"manufacturer": "Jackery",
"model": "Energy Monitor",
}

View File

@@ -13,13 +13,11 @@
}
},
"error": {
"already_configured": "该集成已配置",
"mqtt_not_configured": "MQTT 集成未配置或不可用。请先设置 MQTT 集成:设置 -> 设备与服务 -> 添加集成 -> MQTT",
"single_instance_allowed": "只允许一个此集成的实例"
"already_configured": "已配置相同序列号的设备",
"mqtt_not_configured": "MQTT 集成未配置或不可用。请先设置 MQTT 集成:设置 -> 设备与服务 -> 添加集成 -> MQTT"
},
"abort": {
"already_configured": "该集成已配置",
"single_instance_allowed": "只允许一个此集成的实例"
"already_configured": "已配置相同序列号的设备"
}
}
}

View File

@@ -167,11 +167,12 @@ class JackeryMainSwitch(SwitchEntity):
self._key = key
self._coordinator = coordinator
self._attr_name = name
self._attr_unique_id = f"jackery_main_{key}"
self._attr_unique_id = f"jackery_{config_entry_id}_main_{key}"
self._attr_has_entity_name = True
device_sn = coordinator._device_sn or "Unknown"
self._attr_device_info = {
"identifiers": {(DOMAIN, config_entry_id)},
"name": "Jackery",
"name": f"Jackery {device_sn}",
"manufacturer": "Jackery",
"model": "Energy Monitor",
}

View File

@@ -13,13 +13,11 @@
}
},
"error": {
"already_configured": "该集成已配置",
"mqtt_not_configured": "MQTT 集成未配置或不可用。请先设置 MQTT 集成:设置 -> 设备与服务 -> 添加集成 -> MQTT",
"single_instance_allowed": "只允许一个此集成的实例"
"already_configured": "已配置相同序列号的设备",
"mqtt_not_configured": "MQTT 集成未配置或不可用。请先设置 MQTT 集成:设置 -> 设备与服务 -> 添加集成 -> MQTT"
},
"abort": {
"already_configured": "该集成已配置",
"single_instance_allowed": "只允许一个此集成的实例"
"already_configured": "已配置相同序列号的设备"
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -167,7 +167,7 @@ fi
if [ "$RELEASE_CREATED" = false ]; then
echo "📋 下一步操作 (手动发布):"
echo "1. 访问 GitHub 创建 Release:"
echo " https://github.com/suyulin/jackery/releases/new?tag=$TAG_NAME"
echo " https://github.com/ht-it-lab/jackery/releases/new?tag=$TAG_NAME"
echo ""
echo "2. 如果尚未安装,推荐安装 GitHub CLI (gh) 以便下次自动发布。"
fi