Compare commits
10 Commits
26bc49a202
...
85eed58a06
| Author | SHA1 | Date | |
|---|---|---|---|
| 85eed58a06 | |||
|
|
1f122f2235 | ||
|
|
3b562b0371 | ||
|
|
4dfe66b635 | ||
|
|
ffa46ebac0 | ||
|
|
618bf71296 | ||
|
|
217b277dbe | ||
|
|
a1a1f9d2c0 | ||
|
|
6b183d6f5d | ||
|
|
9b4cf798ef |
22
README.md
22
README.md
@@ -1,8 +1,8 @@
|
||||
## Jackery – Home Assistant Energy Monitoring Integration
|
||||
|
||||
[](https://github.com/hacs/integration)
|
||||
[](https://github.com/suyulin/jackery/releases)
|
||||
[](LICENSE)
|
||||
[](https://github.com/ht-it-lab/jackery/releases)
|
||||
[](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**.
|
||||

|
||||
|
||||
@@ -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
|
||||

|
||||

|
||||

|
||||

|
||||
> **Requirement**: The built-in **MQTT integration** must be configured and connected to your MQTT broker **before** Jackery will work.
|
||||
|
||||
### Example: Energy Flow Card Plus
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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",
|
||||
}
|
||||
|
||||
@@ -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,9 +644,12 @@ 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}")
|
||||
return
|
||||
@@ -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",
|
||||
}
|
||||
|
||||
@@ -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": "已配置相同序列号的设备"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
}
|
||||
|
||||
@@ -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 |
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user