FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Tapo P110M: Error processing Energy for device, module will be unavailable: get_energy_usage for Energy · Issue #1243 · python-kasa/python-kasa · GitHub

Tapo P110M: Error processing Energy for device, module will be unavailable: get_energy_usage for Energy · Issue #1243 · python-kasa/python-kasa · GitHub
Skip to content

Navigation Menu

Repository navigation

Tapo P110M: Error processing Energy for device, module will be unavailable: get_energy_usage for Energy  #1243

Description

Tapo P110M AU & Home Assistant 2024.11.1

On/off works in Home Assistant but energy consumption sensors say Unavailable.

Fixture file attached.
P110M(AU)_1.0_1.2.3.json

Kasa 0.7.7:

kasa --username <u>  --password <p> --host <ip> feature

Discovering device redacted for 10 seconds
WARNING:kasa.smart.smartdevice:Error processing Energy for device 10.0.1.115, module will be unavailable: get_energy_usage for Energy (error_code=JSON_DECODE_FAIL_ERROR)
== Primary features ==
State (state): True
Unable to read value (current_consumption): ('Module update error', DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))

== Information ==
Signal Level (signal_level): 2
Auto off at (auto_off_at): None
Cloud connection (cloud_connection): False
Unable to read value (consumption_today): ('Module update error', DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
Unable to read value (consumption_this_month): ('Module update error', DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
Update available (update_available): None
Check latest firmware (check_latest_firmware): <Action>

== Configuration ==
Auto off enabled (auto_off_enabled): False
Auto off in (auto_off_minutes): 120 min (range: 0-65536)
Auto update enabled (auto_update_enabled): False
LED (led): True

== Debug ==
Device ID (device_id): redacted
RSSI (rssi): -58 dBm
SSID (ssid): redacted
On since (on_since): 2000-01-02 11:12:02+11:00
Reboot (reboot): <Action>
Current firmware version (current_firmware_version): 1.2.3 Build 240617 Rel.153525
Available firmware version (available_firmware_version): None
Device time (device_time): 2000-01-08 07:49:26+11:00

Activity

  1. rytilahti commented on Nov 11, 2024

    Member

    Hi & thanks for the report and the fixture! Could you try if #1245 fixes the issue?

  2. a81j commented on Nov 12, 2024

    Author

    I'm not sure this is running the fixed branch, but this is what I tried:

    git clone https://github.com/python-kasa/python-kasa.git
    cd python-kasa
    git checkout fix/p110m_emeter
    uv sync --all-extras
    uv run kasa  --username redacted  --password redacted--host redacted feature
    Discovering device redacted for 10 seconds
    WARNING  Error processing Energy for device redacted, module will be unavailable:             smartdevice.py:224
             get_energy_usage for Energy (error_code=JSON_DECODE_FAIL_ERROR)                                          
    == Primary features ==
    State (state): True
    Unable to read value (current_consumption): ('Module update error', 
    DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
    
    == Information ==
    Signal Level (signal_level): 2
    Auto off at (auto_off_at): None
    Cloud connection (cloud_connection): False
    Unable to read value (consumption_today): ('Module update error', 
    DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
    Unable to read value (consumption_this_month): ('Module update error', 
    DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
    Update available (update_available): None
    Check latest firmware (check_latest_firmware): <Action>
    
    == Configuration ==
    Auto off enabled (auto_off_enabled): False
    Auto off in (auto_off_minutes): 120 min (range: 0-65536)
    Auto update enabled (auto_update_enabled): False
    LED (led): True
    
    == Debug ==
    Device ID (device_id): redacted
    RSSI (rssi): -55 dBm
    SSID (ssid): redacted
    On since (on_since): 2000-01-02 11:12:02+11:00
    Reboot (reboot): <Action>
    Current firmware version (current_firmware_version): 1.2.3 Build 240617 Rel.153525
    Available firmware version (available_firmware_version): None
    Device time (device_time): 2000-01-09 06:18:10+11:00`
    
  3. MrEbbinghaus commented on Nov 14, 2024

    @a81j Can you please run the feature command with --debug?

    kasa .... --debug feature

    Furthermore, could you check if this also fails?
    kasa .... --debug command get_energy_usage

    feature runs multiple requests at once, which had issues in the past: #1027

    command get_energy_usage just requests the one thing that fails.


    The --debug command logs the queries sent to the device, so you can check what request causes the issue.

    Example

    DEBUG:kasa.smartprotocol:192.168.178.149 >> '{"method":"get_energy_usage","request_time_milis":1731593717136,"terminal_uuid":"TVHjVu8VSP1i5XUMgUP+Pg=="}'
    DEBUG:kasa.smartprotocol:192.168.178.149 << {'error_code': 0,
     'result': {'current_power': 5330,
                'electricity_charge': [0, 0, 0],
                'local_time': '2024-11-14 15:15:09',
                'month_energy': 3712,
                'month_runtime': 7885,
                'today_energy': 78,
                'today_runtime': 466}}
    
  4. donleistman commented on Nov 15, 2024

    Hi, I think I may be encountering the same issue.

    Here's what I get when running `kasa ... --host `
    Discovering device 10.0.50.16 for 10 seconds
    WARNING:kasa.smart.smartdevice:Error processing Energy for device 10.0.50.16, module will be unavailable: get_energy_usage for Energy (error_code=JSON_DECODE_FAIL_ERROR)
    == None - EP25 ==
    Host: 10.0.50.16
    Port: 80
    Device state: True
    Time:         2000-01-02 00:18:43+00:00 (tz: UTC)
    Hardware:     2.6
    Software:     1.0.2 Build 231108 Rel.163012
    MAC (rssi):   24:2F:D0:24:AA:A6 (-44)
    
    == Primary features ==
    State (state): True
    Unable to read value (current_consumption): ('Module update error', DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
    
    == Information ==
    Signal Level (signal_level): 3
    Overheated (overheated): False
    Auto off at (auto_off_at): None
    Cloud connection (cloud_connection): False
    Unable to read value (consumption_today): ('Module update error', DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
    Unable to read value (consumption_this_month): ('Module update error', DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
    Update available (update_available): None
    Check latest firmware (check_latest_firmware): <Action>
    
    == Configuration ==
    Auto off enabled (auto_off_enabled): False
    Auto off in (auto_off_minutes): 120 min (range: 0-65536)
    Auto update enabled (auto_update_enabled): False
    LED (led): False
    
    == Debug ==
    Device ID (device_id): 803AB65AFCF2ADAE6BB5120537EEF97B22560110
    RSSI (rssi): -44 dBm
    SSID (ssid): CHOAM-iot
    On since (on_since): 2000-01-02 00:02:13+00:00
    Reboot (reboot): <Action>
    Current firmware version (current_firmware_version): 1.0.2 Build 231108 Rel.163012
    Available firmware version (available_firmware_version): None
    Device time (device_time): 2000-01-02 00:18:43+00:00
    
    Here's what I get when I try `kasa .... --debug command get_energy_usage`
    Discovering device 10.0.50.16 for 10 seconds
    DEBUG:kasa.discover:[DISCOVERY] 10.0.50.16 >> {'system': {'get_sysinfo': {}}}
    DEBUG:kasa.discover:Waiting a total of 10 seconds for responses...
    DEBUG:kasa.aestransport:Created AES transport for 10.0.50.16
    DEBUG:kasa.discover:[DISCOVERY] 10.0.50.16 << {'error_code': 0,
     'result': {'device_id': 'REDACTED_a0948946bc6e5f059060143',
                'device_model': 'EP25(US)',
                'device_type': 'SMART.KASAPLUG',
                'factory_default': False,
                'ip': '10.0.50.16',
                'is_support_iot_cloud': True,
                'mac': '24-2F-D0-00-00-00',
                'mgt_encrypt_schm': {'encrypt_type': 'AES',
                                     'http_port': 80,
                                     'is_support_https': False,
                                     'lv': 2},
                'obd_src': 'tplink',
                'owner': 'REDACTED_172639E770A6AACB78A3ED4'}}
    DEBUG:kasa.device:Initializing 10.0.50.16 of type <class 'kasa.smart.smartdevice.SmartDevice'>
    DEBUG:kasa.smartprotocol:10.0.50.16 >> '{"method":"get_energy_usage","request_time_milis":1731645851018,"terminal_uuid":"R6OVeYb63RY+7JCF7fDKeQ=="}'
    DEBUG:kasa.aestransport:Will perform handshaking...
    DEBUG:kasa.httpclient:Posting to http://10.0.50.16/app
    DEBUG:kasa.aestransport:Generating keypair
    DEBUG:kasa.aestransport:Handshake request: {'method': 'handshake', 'params': {'key': '-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDMUVQMmNTH/FfcEq6viMynOXd1d0UmRmSNXntaxTzG3dpPW09oCz1TcBsLJ3Vp8p0UbB01/35nMthlefBBp4iWOQy6opwCxxeoJCJHyDXjXm18S4euK8E/lrpJw9QsisaY6r/x6YTjDY4VLcCfnRM0zepfK7gypOrbfS5gt/sZMQIDAQAB\n-----END PUBLIC KEY-----\n'}}
    DEBUG:kasa.aestransport:Device responded with: {'error_code': 0, 'result': {'key': 'aN2cC1omia2Qtb9hnCUHV8fT9CQS3TMJi4lkh4OAh8mkDItmZO11Addtw4dkW97ktpzWdEvpLg88uWlmXciX59AjodWjFCZVylwpHSp4xMD+6ZEIrIbViPFS07gz+n3FtiCJwWHDDgx5B2Ht+VsQaDbv4dvUq/AhY3tytR3jWEM='}}
    DEBUG:kasa.aestransport:Handshake with 10.0.50.16 complete
    DEBUG:kasa.httpclient:Posting to http://10.0.50.16/app
    DEBUG:kasa.aestransport:10.0.50.16: logged in with provided credentials
    DEBUG:kasa.httpclient:Posting to http://10.0.50.16/app?token=682E6FC3F5736FC1283D6DC1E6536DC0
    DEBUG:kasa.smartprotocol:10.0.50.16 << {'error_code': -1003}
    DEBUG:kasa.smartprotocol:Unable to query the device: 10.0.50.16, not retrying: Error querying device: 10.0.50.16: JSON_DECODE_FAIL_ERROR(-1003) for method: get_energy_usage (error_code=JSON_DECODE_FAIL_ERROR)
    Raised error: Error querying device: 10.0.50.16: JSON_DECODE_FAIL_ERROR(-1003) for method: get_energy_usage (error_code=JSON_DECODE_FAIL_ERROR)
    Traceback (most recent call last):
      File "/Users/don/Documents/repos/kasa_env/bin/kasa", line 8, in <module>
        sys.exit(cli())
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/asyncclick/core.py", line 1205, in __call__
        return anyio.run(self._main, main, args, kwargs, **opts)
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/anyio/_core/_eventloop.py", line 74, in run
        return async_backend.run(func, args, {}, backend_options)
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 2284, in run
        return runner.run(wrapper())
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 210, in run
        return self._loop.run_until_complete(task)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
        return future.result()
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 2272, in wrapper
        return await func(*args)
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/asyncclick/core.py", line 1208, in _main
        return await main(*args, **kwargs)
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/asyncclick/core.py", line 1120, in main
        rv = await self.invoke(ctx)
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/kasa/cli/common.py", line 231, in invoke
        _handle_exception(self._debug, exc)
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/kasa/cli/common.py", line 229, in invoke
        return await super().invoke(ctx)
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/asyncclick/core.py", line 1739, in invoke
        return await _process_result(await sub_ctx.command.invoke(sub_ctx))
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/asyncclick/core.py", line 1485, in invoke
        return await ctx.invoke(self.callback, **ctx.params)
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/asyncclick/core.py", line 824, in invoke
        rv = await rv
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/kasa/cli/common.py", line 129, in wrapper
        return await ctx.invoke(wrapped_function, dev, *args, **kwargs)
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/asyncclick/core.py", line 824, in invoke
        rv = await rv
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/kasa/cli/main.py", line 446, in cmd_command
        res = await dev._query_helper(command, parameters)
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/kasa/smart/smartdevice.py", line 592, in _query_helper
        res = await self.protocol.query({method: params})
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/kasa/smartprotocol.py", line 89, in query
        return await self._query(request, retry_count)
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/kasa/smartprotocol.py", line 150, in _query
        raise ex
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/kasa/smartprotocol.py", line 94, in _query
        return await self._execute_query(
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/kasa/smartprotocol.py", line 281, in _execute_query
        self._handle_response_error_code(response_data, smart_method)
      File "/Users/don/Documents/repos/kasa_env/lib/python3.9/site-packages/kasa/smartprotocol.py", line 354, in _handle_response_error_code
        raise DeviceError(msg, error_code=error_code)
    kasa.exceptions.DeviceError: Error querying device: 10.0.50.16: JSON_DECODE_FAIL_ERROR(-1003) for method: get_energy_usage (error_code=JSON_DECODE_FAIL_ERROR)
    
    This is what I'm seeing in Home Assistant:

    Happy to provide anything else that might be helpful.

  5. sdb9696 commented on Nov 15, 2024

    Contributor

    Hi, could you try with the latest commit to #1245. I've pushed an experimental fix.

  6. MrEbbinghaus commented on Nov 15, 2024

    Funny. Today I had the same issue after I had to unplug my P110M because apparently the relay got stuck.

    Then I noticed, that the clock had reset, because the device was without power.
    Syncing the clock fixed the issue.

    @a81j @donleistman I see that the clocks on your devices are also back in the year 2000.

    Run kasa --host xxx.xxx.xxx.xxx time sync to set the time.


    @sdb9696 @rytilahti At first I thought that the wrong time would break the encrypted communication, but other commands clearly work.

    My next guess is that the device needs the time for the stats and that fails because the clock is now in the past. This would explain, why only this one command fails.

  7. sdb9696 commented on Nov 15, 2024

    Contributor

    Did you test today with the latest commit to 1245?

  8. MrEbbinghaus commented on Nov 15, 2024

    No. I used the 0.7.7 release.

    Setting the time back manually doesn't seem to break it. (for the release version and for af8e648)

    ❯ kasa --host 192.168.178.34 time set 2000 01 01 01 00
    Discovering device 192.168.178.34 for 10 seconds
    Old time: 2024-11-15 16:02:06+01:00 (CET)
    New time: 2000-01-01 01:00:00+01:00 (CET)
    ❯ kasa --host 192.168.178.34 command get_energy_usage
    Discovering device 192.168.178.34 for 10 seconds
    {"get_energy_usage": {"today_runtime": 0, "month_runtime": 0, "today_energy": 0, "month_energy": 0, "local_time": "2000-01-01 01:00:08", "electricity_charge": [0, 0, 0], "current_power": 5283}}
    ❯ uv run kasa --host 192.168.178.34 command get_energy_usage
    Discovering device 192.168.178.34 for 10 seconds
    {"get_energy_usage": {"today_runtime": 0, "month_runtime": 0, "today_energy": 0, "month_energy": 0, "local_time": "2000-01-01 01:00:22", "electricity_charge": [0, 0, 0], "current_power": 5457}}
  9. sdb9696 commented on Nov 15, 2024

    Contributor

    No. I used the 0.7.7 release.

    @MrEbbinghaus, were you definitely getting the same error beforehand? i.e. JSON_DECODE_FAIL_ERROR

  10. MrEbbinghaus commented on Nov 15, 2024

    @sdb9696 Yes, see my console log:

    console log
    ❯ kasa
    No host name given, trying discovery..
    Discovering devices on 255.255.255.255 for 10 seconds
    WARNING:kasa.smart.smartdevice:Error processing Energy for device 192.168.178.34, module will be unavailable: get_energy_usage for Energy (error_code=JSON_DECODE_FAIL_ERROR)
    == Tapo1 - P110M ==
    Host: 192.168.178.34
    Port: 80
    Device state: True
    Time:         2000-01-02 01:04:57+01:00 (tz: CET)
    Hardware:     1.0
    Software:     1.2.3 Build 240617 Rel.153525
    MAC (rssi):   REDACTED (-34)
    
    == Primary features ==
    State (state): True
    Unable to read value (current_consumption): ('Module update error', DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
    
    == Information ==
    Signal Level (signal_level): 3
    Auto off at (auto_off_at): None
    Cloud connection (cloud_connection): False
    Unable to read value (consumption_today): ('Module update error', DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
    Unable to read value (consumption_this_month): ('Module update error', DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
    Update available (update_available): None
    Check latest firmware (check_latest_firmware): <Action>
    
    == Configuration ==
    Auto off enabled (auto_off_enabled): False
    Auto off in (auto_off_minutes): 120 min (range: 0-65536)
    Auto update enabled (auto_update_enabled): False
    LED (led): True
    
    == Debug ==
    Device ID (device_id): REDACTED
    RSSI (rssi): -34 dBm
    SSID (ssid): REDACTED
    On since (on_since): 2000-01-02 01:02:26+01:00
    Reboot (reboot): <Action>
    Current firmware version (current_firmware_version): 1.2.3 Build 240617 Rel.153525
    Available firmware version (available_firmware_version): None
    Device time (device_time): 2000-01-02 01:04:57+01:00
    
    Found 1 devices
    ❯ kasa --host 192.168.178.34 time sync
    Discovering device 192.168.178.34 for 10 seconds
    WARNING:kasa.smart.smartdevice:Error processing Energy for device 192.168.178.34, module will be unavailable: get_energy_usage for Energy (error_code=JSON_DECODE_FAIL_ERROR)
    Old time: 2000-01-02 01:05:33+01:00 (CET)
    New time: 2024-11-15 14:58:28+01:00 (CET)
    ❯ kasa
    No host name given, trying discovery..
    Discovering devices on 255.255.255.255 for 10 seconds
    == Tapo1 - P110M ==
    Host: 192.168.178.34
    Port: 80
    Device state: True
    Time:         2024-11-15 14:58:33+01:00 (tz: CET)
    Hardware:     1.0
    Software:     1.2.3 Build 240617 Rel.153525
    MAC (rssi):   REDACTED (-34)
    
    == Primary features ==
    State (state): True
    Current consumption (current_consumption): 16.1 W
    
    == Information ==
    Signal Level (signal_level): 3
    Auto off at (auto_off_at): None
    Cloud connection (cloud_connection): False
    Today's consumption (consumption_today): 0.063 kWh
    This month's consumption (consumption_this_month): 3.928 kWh
    Update available (update_available): None
    Check latest firmware (check_latest_firmware): <Action>
    
    == Configuration ==
    Auto off enabled (auto_off_enabled): False
    Auto off in (auto_off_minutes): 120 min (range: 0-65536)
    Auto update enabled (auto_update_enabled): False
    LED (led): True
    
    == Debug ==
    Device ID (device_id): REDACTED
    RSSI (rssi): -34 dBm
    SSID (ssid): REDACTED
    On since (on_since): 2024-11-15 14:55:21+01:00
    Reboot (reboot): <Action>
    Current firmware version (current_firmware_version): 1.2.3 Build 240617 Rel.153525
    Available firmware version (available_firmware_version): None
    Device time (device_time): 2024-11-15 14:58:33+01:00
    
    Found 1 devices
  11. sdb9696 commented on Nov 15, 2024

    Contributor

    Cool thanks.

    Would you be able to test the PR with the device time set wrong again to see if the {} avoids the JSON_DECODE_FAIL even if the time is wrong?

    uvx --from "python-kasa[speedups] @ git+https://github.com/python-kasa/python-kasa.git@fix/p110m_emeter" kasa --host <etc and any other options>
    
  12. donleistman commented on Nov 17, 2024

    @MrEbbinghaus Syncing the clock fixed my issue, thanks! I had synced it previously, but it looks like it was reset when I moved the plug. Is it necessary to sync the clock whenever the device loses power?

  13. a81j commented on Nov 17, 2024

    Author

    Cool thanks.

    Would you be able to test the PR with the device time set wrong again to see if the {} avoids the JSON_DECODE_FAIL even if the time is wrong?

    uvx --from "python-kasa[speedups] @ git+https://github.com/python-kasa/python-kasa.git@fix/p110m_emeter" kasa --host <etc and any other options>
    

    The official app works just fine with the time not set. I have NTP blocked on this subnet, so it would be great if it would work without it too.

    I have tried the latest with the same errors:

    debug --feature:

    uvx --from "python-kasa[speedups] @ git+https://github.com/python-kasa/python-kasa.git@fix/p110m_emeter" kasa  --username redacted  --password redacted --host 10.0.1.2 --debug  feature
     Updated https://github.com/python-kasa/python-kasa.git (af8e648)
    Discovering device 10.0.1.2 for 10 seconds
    DEBUG:kasa.discover:[DISCOVERY] 10.0.1.2 >> {'system': {'get_sysinfo': {}}}
    DEBUG:kasa.discover:Waiting a total of 10 seconds for responses...
    DEBUG:kasa.klaptransport:Created KLAP transport for 10.0.1.2
    DEBUG:kasa.discover:[DISCOVERY] 10.0.1.2 << {'error_code': 0,
     'result': {'device_id': 'redacted',
                'device_model': 'P110M(AU)',
                'device_type': 'SMART.TAPOPLUG',
                'factory_default': False,
                'ip': '10.0.1.2',
                'is_support_iot_cloud': True,
                'mac': 'F0-09-0D-00-00-00',
                'mgt_encrypt_schm': {'encrypt_type': 'KLAP',
                                     'http_port': 80,
                                     'is_support_https': False,
                                     'lv': 2},
                'obd_src': 'tplink',
                'owner': 'REDACTED_14252709E4C2C1AED6D6E5F',
                'protocol_version': 1}}
    DEBUG:kasa.device:Initializing 10.0.1.2 of type <class 'kasa.smart.smartdevice.SmartDevice'>
    DEBUG:kasa.smartprotocol:10.0.1.2 multi-request-batch-1-of-1 >> '{"method":"multipleRequest","request_time_milis":1731836979145,"terminal_uuid":"DR/K8KRIbCdJEYmleeeK3A==","params":{"requests":[{"method":"component_nego"},{"method":"get_device_info"},{"method":"get_connect_cloud_state"}]}}'
    DEBUG:kasa.klaptransport:Starting handshake with 10.0.1.2
    DEBUG:kasa.httpclient:Posting to http://10.0.1.2/app/handshake1
    DEBUG:kasa.klaptransport:Handshake1 posted at 2024-11-17 20:49:39.159362. Host is 10.0.1.2, Response status is 200, Request was ba00de73d3b40c1e9ce707e2cc531aeb
    DEBUG:kasa.klaptransport:Handshake1 success at 2024-11-17 20:49:39.159451. Host is 10.0.1.2, Server remote_seed is: 10669461c60d1562ade69662c6531663, server hash is: edbc22227d9b6912687f6ecc5b7cc30013fcbb04f72c92049e576723ceabf0ec
    DEBUG:kasa.klaptransport:handshake1 hashes match with expected credentials
    DEBUG:kasa.httpclient:Posting to http://10.0.1.2/app/handshake2
    DEBUG:kasa.klaptransport:Handshake2 posted 2024-11-17 20:49:39.166244. Host is 10.0.1.2, Response status is 200, Request was 652af77d2da908a8cea1db1b9b7d709839e5ac949390a3154313961276cf63c0
    DEBUG:kasa.klaptransport:Handshake with 10.0.1.2 complete
    DEBUG:kasa.httpclient:Posting to http://10.0.1.2/app/request
    DEBUG:kasa.klaptransport:Device 10.0.1.2 query posted Host is 10.0.1.2, Sequence is -1490096695, Response status is 200, Request was {"method":"multipleRequest","request_time_milis":1731836979145,"terminal_uuid":"DR/K8KRIbCdJEYmleeeK3A==","params":{"requests":[{"method":"component_nego"},{"method":"get_device_info"},{"method":"get_connect_cloud_state"}]}}
    DEBUG:kasa.klaptransport:Device 10.0.1.2 query response received
    DEBUG:kasa.smartprotocol:10.0.1.2 multi-request-batch-1-of-1 << {'error_code': 0,
     'result': {'responses': [{'error_code': 0,
                               'method': 'component_nego',
                               'result': {'component_list': [{'id': 'device',
                                                              'ver_code': 2},
                                                             {'id': 'firmware',
                                                              'ver_code': 2},
                                                             {'id': 'quick_setup',
                                                              'ver_code': 3},
                                                             {'id': 'time',
                                                              'ver_code': 1},
                                                             {'id': 'wireless',
                                                              'ver_code': 1},
                                                             {'id': 'schedule',
                                                              'ver_code': 2},
                                                             {'id': 'countdown',
                                                              'ver_code': 2},
                                                             {'id': 'antitheft',
                                                              'ver_code': 1},
                                                             {'id': 'account',
                                                              'ver_code': 1},
                                                             {'id': 'synchronize',
                                                              'ver_code': 1},
                                                             {'id': 'sunrise_sunset',
                                                              'ver_code': 1},
                                                             {'id': 'led',
                                                              'ver_code': 1},
                                                             {'id': 'cloud_connect',
                                                              'ver_code': 1},
                                                             {'id': 'iot_cloud',
                                                              'ver_code': 1},
                                                             {'id': 'device_local_time',
                                                              'ver_code': 1},
                                                             {'id': 'default_states',
                                                              'ver_code': 1},
                                                             {'id': 'auto_off',
                                                              'ver_code': 2},
                                                             {'id': 'localSmart',
                                                              'ver_code': 1},
                                                             {'id': 'energy_monitoring',
                                                              'ver_code': 2},
                                                             {'id': 'power_protection',
                                                              'ver_code': 1},
                                                             {'id': 'charging_protection',
                                                              'ver_code': 2},
                                                             {'id': 'matter',
                                                              'ver_code': 2},
                                                             {'id': 'current_protection',
                                                              'ver_code': 1}]}},
                              {'error_code': 0,
                               'method': 'get_device_info',
                               'result': {'auto_off_remain_time': 0,
                                          'auto_off_status': 'off',
                                          'avatar': 'plug',
                                          'charging_status': 'normal',
                                          'default_states': {'state': {},
                                                             'type': 'last_states'},
                                          'device_id': 'REDACTED_4233F584FA8A442C95CFF922300F272',
                                          'device_on': True,
                                          'fw_id': '00000000000000000000000000000000',
                                          'fw_ver': '1.2.3 Build 240617 Rel.153525',
                                          'has_set_location_info': False,
                                          'hw_id': 'B675F6FC1F9EE35C951B7E88DBD148E4',
                                          'hw_ver': '1.0',
                                          'ip': '10.0.1.2',
                                          'lang': 'en_US',
                                          'latitude': 0,
                                          'longitude': 0,
                                          'mac': 'F0-09-0D-00-00-00',
                                          'model': 'P110M',
                                          'nickname': 'I01BU0tFRF9OQU1FIw==',
                                          'oem_id': 'REDACTED_3446AA6011BFA704442ECBE',
                                          'on_time': 723,
                                          'overcurrent_status': 'normal',
                                          'overheat_status': 'normal',
                                          'power_protection_status': 'normal',
                                          'region': 'Australia/Sydney',
                                          'rssi': -50,
                                          'signal_level': 2,
                                          'specs': '',
                                          'ssid': 'I01BU0tFRF9TU0lEIw=',
                                          'time_diff': 600,
                                          'type': 'SMART.TAPOPLUG'}},
                              {'error_code': 0,
                               'method': 'get_connect_cloud_state',
                               'result': {'status': 1}}]}}
    DEBUG:kasa.smart.smartdevice:Device 10.0.1.2, found required auto_off, adding AutoOff to modules.
    DEBUG:kasa.smart.smartdevice:Device 10.0.1.2, found required cloud_connect, adding Cloud to modules.
    DEBUG:kasa.smart.smartdevice:Device 10.0.1.2, found required device, adding DeviceModule to modules.
    DEBUG:kasa.smart.smartdevice:Device 10.0.1.2, found required energy_monitoring, adding Energy to modules.
    DEBUG:kasa.smart.smartdevice:Device 10.0.1.2, found required firmware, adding Firmware to modules.
    DEBUG:kasa.smart.smartdevice:Device 10.0.1.2, found required led, adding Led to modules.
    DEBUG:kasa.smart.smartdevice:Device 10.0.1.2, found required time, adding Time to modules.
    DEBUG:kasa.smart.smartdevice:Querying 10.0.1.2 for modules: AutoOff, Energy, Firmware, Led, Time
    DEBUG:kasa.smartprotocol:10.0.1.2 multi-request-batch-1-of-2 >> '{"method":"multipleRequest","request_time_milis":1731836979197,"terminal_uuid":"DR/K8KRIbCdJEYmleeeK3A==","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_auto_update_info"},{"method":"get_led_info"}]}}'
    DEBUG:kasa.httpclient:Posting to http://10.0.1.2/app/request
    DEBUG:kasa.klaptransport:Device 10.0.1.2 query posted Host is 10.0.1.2, Sequence is -1490096694, Response status is 200, Request was {"method":"multipleRequest","request_time_milis":1731836979197,"terminal_uuid":"DR/K8KRIbCdJEYmleeeK3A==","params":{"requests":[{"method":"get_auto_off_config","params":{"start_index":0}},{"method":"get_energy_usage"},{"method":"get_current_power"},{"method":"get_auto_update_info"},{"method":"get_led_info"}]}}
    DEBUG:kasa.klaptransport:Device 10.0.1.2 query response received
    DEBUG:kasa.smartprotocol:10.0.1.2 multi-request-batch-1-of-2 << {'error_code': 0,
     'result': {'responses': [{'error_code': 0,
                               'method': 'get_auto_off_config',
                               'result': {'delay_min': 120, 'enable': False}},
                              {'error_code': -1003, 'method': 'get_energy_usage'},
                              {'error_code': 0,
                               'method': 'get_current_power',
                               'result': {'current_power': 0}},
                              {'error_code': 0,
                               'method': 'get_auto_update_info',
                               'result': {'enable': False,
                                          'random_range': 120,
                                          'time': 180}},
                              {'error_code': 0,
                               'method': 'get_led_info',
                               'result': {'bri_config': {'bri_type': 'overall',
                                                         'overall_bri': 50},
                                          'led_rule': 'always',
                                          'led_status': True,
                                          'night_mode': {'end_time': 420,
                                                         'night_mode_type': 'sunrise_sunset',
                                                         'start_time': 1140,
                                                         'sunrise_offset': 0,
                                                         'sunset_offset': 0}}}]}}
    DEBUG:kasa.smartprotocol:10.0.1.2 multi-request-batch-2-of-2 >> '{"method":"multipleRequest","request_time_milis":1731836979217,"terminal_uuid":"DR/K8KRIbCdJEYmleeeK3A==","params":{"requests":[{"method":"get_device_time"}]}}'
    DEBUG:kasa.httpclient:Posting to http://10.0.1.2/app/request
    DEBUG:kasa.klaptransport:Device 10.0.1.2 query posted Host is 10.0.1.2, Sequence is -1490096693, Response status is 200, Request was {"method":"multipleRequest","request_time_milis":1731836979217,"terminal_uuid":"DR/K8KRIbCdJEYmleeeK3A==","params":{"requests":[{"method":"get_device_time"}]}}
    DEBUG:kasa.klaptransport:Device 10.0.1.2 query response received
    DEBUG:kasa.smartprotocol:10.0.1.2 multi-request-batch-2-of-2 << {'error_code': 0,
     'result': {'responses': [{'error_code': 0,
                               'method': 'get_device_time',
                               'result': {'region': 'Australia/Sydney',
                                          'time_diff': 600,
                                          'timestamp': 946771937}}]}}
    WARNING:kasa.smart.smartdevice:Error processing Energy for device 10.0.1.2, module will be unavailable: get_energy_usage for Energy (error_code=JSON_DECODE_FAIL_ERROR)
    DEBUG:kasa.smart.smartdevice:Update completed 10.0.1.2: ['component_nego', 'get_device_info', 'get_connect_cloud_state', 'get_auto_off_config', 'get_energy_usage', 'get_current_power', 'get_auto_update_info', 'get_led_info', 'get_device_time']
    == Primary features ==
    State (state): True
    Unable to read value (current_consumption): ('Module update error', DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
    
    == Information ==
    Signal Level (signal_level): 2
    Auto off at (auto_off_at): None
    Cloud connection (cloud_connection): False
    Unable to read value (consumption_today): ('Module update error', DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
    Unable to read value (consumption_this_month): ('Module update error', DeviceError(<SmartErrorCode.JSON_DECODE_FAIL_ERROR: -1003>))
    Update available (update_available): None
    Check latest firmware (check_latest_firmware): <Action>
    
    == Configuration ==
    Auto off enabled (auto_off_enabled): False
    Auto off in (auto_off_minutes): 120 min (range: 0-65536)
    Auto update enabled (auto_update_enabled): False
    LED (led): True
    
    == Debug ==
    Device ID (device_id): redacted
    RSSI (rssi): -50 dBm
    SSID (ssid): redacted
    On since (on_since): 2000-01-02 11:00:14+11:00
    Reboot (reboot): <Action>
    Current firmware version (current_firmware_version): 1.2.3 Build 240617 Rel.153525
    Available firmware version (available_firmware_version): None
    Device time (device_time): 2000-01-02 11:12:17+11:00
    

    --debug command get_energy_usage:
    uvx --from "python-kasa[speedups] @ git+https://github.com/python-kasa/python-kasa.git@fix/p110m_emeter" kasa --username redacted --password redacted --host 10.0.1.2 --debug command get_energy_usage Updated https://github.com/python-kasa/python-kasa.git (af8e648) Discovering device 10.0.1.2 for 10 seconds DEBUG:kasa.discover:[DISCOVERY] 10.0.1.2 >> {'system': {'get_sysinfo': {}}} DEBUG:kasa.discover:Waiting a total of 10 seconds for responses... DEBUG:kasa.klaptransport:Created KLAP transport for 10.0.1.2 DEBUG:kasa.discover:[DISCOVERY] 10.0.1.2 << {'error_code': 0, 'result': {'device_id': 'REDACTED_b9ba9abfe056e36ab947ec2', 'device_model': 'P110M(AU)', 'device_type': 'SMART.TAPOPLUG', 'factory_default': False, 'ip': '10.0.1.2', 'is_support_iot_cloud': True, 'mac': 'F0-09-0D-00-00-00', 'mgt_encrypt_schm': {'encrypt_type': 'KLAP', 'http_port': 80, 'is_support_https': False, 'lv': 2}, 'obd_src': 'tplink', 'owner': 'REDACTED_14252709E4C2C1AED6D6E5F', 'protocol_version': 1}} DEBUG:kasa.device:Initializing 10.0.1.2 of type <class 'kasa.smart.smartdevice.SmartDevice'> DEBUG:kasa.smartprotocol:10.0.1.2 >> '{"method":"get_energy_usage","request_time_milis":1731837155761,"terminal_uuid":"ZaaxKCqkszeXOW/uFzOpkQ=="}' DEBUG:kasa.klaptransport:Starting handshake with 10.0.1.2 DEBUG:kasa.httpclient:Posting to http://10.0.1.2/app/handshake1 DEBUG:kasa.klaptransport:Handshake1 posted at 2024-11-17 20:52:35.775833. Host is 10.0.1.2, Response status is 200, Request was 4baaf629da01544f235157b69ffe69b7 DEBUG:kasa.klaptransport:Handshake1 success at 2024-11-17 20:52:35.775925. Host is 10.0.1.2, Server remote_seed is: 2ade4c9a27134d986a15cf98ecb3cf99, server hash is: 7b6e3e3ef330de0b98225a3735e726aa3c2e501932e7486bb30ad85c5d709c2a DEBUG:kasa.klaptransport:handshake1 hashes match with expected credentials DEBUG:kasa.httpclient:Posting to http://10.0.1.2/app/handshake2 DEBUG:kasa.klaptransport:Handshake2 posted 2024-11-17 20:52:35.783052. Host is 10.0.1.2, Response status is 200, Request was 5c920e5a40acc57d7df1d530aa996d045b441009497b86fa2d3f43716b69fe8c DEBUG:kasa.klaptransport:Handshake with 10.0.1.2 complete DEBUG:kasa.httpclient:Posting to http://10.0.1.2/app/request DEBUG:kasa.klaptransport:Device 10.0.1.2 query posted Host is 10.0.1.2, Sequence is 1299707163, Response status is 200, Request was {"method":"get_energy_usage","request_time_milis":1731837155761,"terminal_uuid":"ZaaxKCqkszeXOW/uFzOpkQ=="} DEBUG:kasa.klaptransport:Device 10.0.1.2 query response received DEBUG:kasa.smartprotocol:10.0.1.2 << {'error_code': -1003} DEBUG:kasa.smartprotocol:Unable to query the device: 10.0.1.2, not retrying: Error querying device: 10.0.1.2: JSON_DECODE_FAIL_ERROR(-1003) for method: get_energy_usage (error_code=JSON_DECODE_FAIL_ERROR) Raised error: Error querying device: 10.0.1.2: JSON_DECODE_FAIL_ERROR(-1003) for method: get_energy_usage (error_code=JSON_DECODE_FAIL_ERROR) Traceback (most recent call last): File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/bin/kasa", line 10, in <module> sys.exit(cli()) ~~~^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/asyncclick/core.py", line 1205, in __call__ return anyio.run(self._main, main, args, kwargs, **opts) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/anyio/_core/_eventloop.py", line 74, in run return async_backend.run(func, args, {}, backend_options) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/anyio/_backends/_asyncio.py", line 2284, in run return runner.run(wrapper()) ~~~~~~~~~~^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 721, in run_until_complete return future.result() ~~~~~~~~~~~~~^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/anyio/_backends/_asyncio.py", line 2272, in wrapper return await func(*args) ^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/asyncclick/core.py", line 1208, in _main return await main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/asyncclick/core.py", line 1120, in main rv = await self.invoke(ctx) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/kasa/cli/common.py", line 238, in invoke _handle_exception(self._debug, exc) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/kasa/cli/common.py", line 236, in invoke return await super().invoke(ctx) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/asyncclick/core.py", line 1739, in invoke return await _process_result(await sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/asyncclick/core.py", line 1485, in invoke return await ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/asyncclick/core.py", line 824, in invoke rv = await rv ^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/kasa/cli/common.py", line 129, in wrapper return await ctx.invoke(wrapped_function, dev, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/asyncclick/core.py", line 824, in invoke rv = await rv ^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/kasa/cli/main.py", line 446, in cmd_command res = await dev._query_helper(command, parameters) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/kasa/smart/smartdevice.py", line 596, in _query_helper res = await self.protocol.query({method: params}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/kasa/smartprotocol.py", line 89, in query return await self._query(request, retry_count) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/kasa/smartprotocol.py", line 150, in _query raise ex File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/kasa/smartprotocol.py", line 94, in _query return await self._execute_query( ^^^^^^^^^^^^^^^^^^^^^^^^^^ request, retry_count=retry, iterate_list_pages=True ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/kasa/smartprotocol.py", line 281, in _execute_query self._handle_response_error_code(response_data, smart_method) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/redacted/.cache/uv/archive-v0/DivdlyDiamBZjlAKczSBx/lib/python3.13/site-packages/kasa/smartprotocol.py", line 356, in _handle_response_error_code raise DeviceError(msg, error_code=error_code) kasa.exceptions.DeviceError: Error querying device: 10.0.1.2: JSON_DECODE_FAIL_ERROR(-1003) for method: get_energy_usage (error_code=JSON_DECODE_FAIL_ERROR)

  14. a81j commented on Nov 17, 2024

    Author

    uvx --from "python-kasa[speedups] @ git+https://github.com/python-kasa/python-kasa.git@fix/p110m_emeter" kasa --username redacted --password redacted --host 10.0.1.2 --debug command get_current_power
    works just fine

    If the current power reading could get working in Home Assistant, then that is all I need.

  15. 9 remaining items

  16. a81j commented on Nov 28, 2024

    Author

    kasa command get_current_power works perfectly with the time wrong, so it should be possible to get it into home assistant.

  17. sdb9696 commented on Nov 28, 2024

    Contributor

    Can you try again with the latest commit to #1245 please.

  18. a81j commented on Nov 28, 2024

    Author

    kasa feature now gives no error and works perfectly

  19. sdb9696 commented on Nov 28, 2024

    Contributor

    Presumably these numbers are all reporting 0 though?

    Today's consumption (consumption_today): 0.0 kWh
    This month's consumption (consumption_this_month): 0.0 kWh
    
  20. a81j commented on Nov 28, 2024

    Author

    They are reporting 0.0 yes. There is only a 2W load on it so I can't see if it should be something else.

    Reporting today's and monthly consumption doesn't make a difference for my use case. Even if I did need it, Home Assistant can generate and record those values from the current consumption easily.

  21. sdb9696 commented on Nov 28, 2024

    Contributor

    They're only available in the module that is erroring and they get set to 0 in that case. @rytilahti maybe we should return None on these if not available so that it doesn't mess up HA's TOTAL_INCREASING function?

  22. rytilahti commented on Nov 28, 2024

    Member

    So this behavior of returning "0" for unavailable values might have been copied over from the homeassistant integration, so I went down the git blame history and found out that https://github.com/home-assistant/core/pull/53596/files#diff-d1aee68b279979c0c59cf7c893fec0964f0e03f84a2a761937940c541e0d176aL165-L168 was the PR that changed the behavior.

    If my memory serves me correctly, the reason for this hack was that the entities were initialized only during the startup, so if your device reported no information (e.g., if there was no consumption for the day after a midnight restart or so), there would be no entity created until the next HA restart.

    I think we should return None for unavailable information (and maybe suppress creation of such entities?), but we want to avoid reintroducing the issue this hack aimed to solve.

  23. sdb9696 commented on Nov 29, 2024

    Contributor

    If my memory serves me correctly, the reason for this hack was that the entities were initialized only during the startup, so if your device reported no information (e.g., if there was no consumption for the day after a midnight restart or so), there would be no entity created until the next HA restart.

    This is no longer the behaviour since the move to the feature entities. The logic now is that if the feature is there, the entity is created regardless of value.

    I think we should return None for unavailable information (and maybe suppress creation of such entities?), but we want to avoid reintroducing the issue this hack aimed to solve.

    I don't think we should suppress the creation as the error could be (and usually is) intermittent. The latest commit to 1245 will return None for the consumption values on error.

  24. added a commit that references this issue on Nov 29, 2024
  25. a81j commented on Nov 30, 2024

    Author

    Working perfectly in Home Assistant when testing using the following:

    "requirements": ["git+https://github.com/python-kasa/python-kasa.git@fix/p110m_emeter"]

    Thank you

  26. added a commit that references this issue on Aug 31, 2025
  27. added a commit that references this issue on Oct 26, 2025
  28. added a commit that references this issue on Nov 10, 2025
  29. added a commit that references this issue on Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      Footer

      © 2026 GitHub, Inc.

      Back | FazBrowse Home | New Git URL