diff --git a/custom_components/jackery/sensor.py b/custom_components/jackery/sensor.py index fbc343c..17f2930 100644 --- a/custom_components/jackery/sensor.py +++ b/custom_components/jackery/sensor.py @@ -400,7 +400,8 @@ class JackeryCoordinator: msg_type = raw.get("type") body = raw.get("body") - _LOGGER.info("Jackery %s: received type=%s on %s", self.device_sn, msg_type, msg.topic) + keys = list(body.keys()) if isinstance(body, dict) else body + _LOGGER.info("Jackery %s: received type=%s keys=%s", self.device_sn, msg_type, keys) try: if msg_type == 101: @@ -543,6 +544,16 @@ class JackeryCoordinator: }), 0, False, ) + # Request energy statistics + await ha_mqtt.async_publish( + self.hass, self._action_topic, + json.dumps({ + "type": 23, "eventId": 0, + "messageId": random.randint(1000, 9999), + "ts": ts, "token": self._token, "body": None, + }), 0, False, + ) + for dev_type in (2, 6): await ha_mqtt.async_publish( self.hass, self._action_topic,