apatsufas / homebridge-tapo-p100

Homebridge TP-LINK Tapo P100 Platform Plugin
Apache License 2.0
64 stars 14 forks source link

Power reading on P110 is 1000 times too large #15

Closed malcsmith closed 2 years ago

malcsmith commented 2 years ago

Describe The Bug: When viewing the power consumed by the device in Eve app exposed via home bridge the value is 1000 times larger than that displayed in the native app.

To Reproduce: Use P110 plug, view in Eve

Expected behavior: Reduce value by 1000

Plugin Config:

 "devices": [
            {
                "name": "TapoPlug1",
                "host": "192.168.1.110",
                "type": "Plug"
            },
            {
                "name": "Tapo_P110",
                "host": "192.168.1.149",
                "type": "PowerPlug"
            }
        ],
        "platform": "TapoP100"
mgondium commented 2 years ago

This is probably related: when using a P110 plug I'm getting this on Homebrige's log, for a power draw of 1182W:

This plugin generated a warning from the characteristic 'Current Consumption': characteristic was supplied illegal value: number 1182231 exceeded maximum of 65535.

apatsufas commented 2 years ago

@mgondium @malcsmith thank you for your feedback. As I don't own an P110 I based the implementation on the L530E. Would it be possible for you to provide me the readings from the Tapo app, the readings from the Eve app and also could you enable debug mode on homebridge and provided me the log for the device_info call?

mgondium commented 2 years ago

I redacted some identifying data.

The Tapo App reads 1190W, I'm not using Eve.

[16/11/2021, 16:47:07] [homebridge-tapo] This plugin generated a warning from the characteristic 'Current Consumption': characteristic was supplied illegal value: number 1119024 exceeded maximum of 65535. See https://git.io/JtMGR for more info.
[16/11/2021, 16:47:07] [homebridge-tapo] Error: 
    at Characteristic.characteristicWarning (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2074:105)
    at Characteristic.validateUserInput (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1986:16)
    at /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1569:24
    at /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:9:18
    at P110Accessory.getCurrentConsumption (/usr/lib/node_modules/homebridge-tapo/src/platformP110Accessory.ts:132:5)
    at Characteristic.emit (node:events:390:28)
    at /usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1544:14
    at new Promise (<anonymous>)
    at Characteristic.<anonymous> (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1542:12)
    at step (/usr/lib/node_modules/homebridge/node_modules/tslib/tslib.js:143:27)

[16/11/2021, 16:47:07 [Tapo Smart Platform] Device Info:  {
  device_id: '8022E5AAE0141E81D4B425C124B9D9FA1EED31E2',
  fw_ver: '1.0.7 Build 210629 Rel.174901',
  hw_ver: '1.0',
  type: 'SMART.TAPOPLUG',
  model: 'P110',
  mac: 'XX-XX-XX-XX-XX-XX',
  hw_id: '2FB30EF5BF920C44099401D396C6B55B',
  fw_id: '00000000000000000000000000000000',
  oem_id: '18BDC6C734AF8407B3EF871EACFCECF5',
  overheated: false,
  ip: 'XXX.XXX.X.XXX',
  time_diff: 0,
  ssid: 'XXXX',
  rssi: -45,
  signal_level: 3,
  latitude: XXXXXX,
  longitude: XXXXXX,
  lang: 'XX_XX',
  avatar: 'plug',
  region: 'XXXXXXXXXXXXX',
  specs: '',
  nickname: 'XXXXXXXXXXXXXXXX',
  has_set_location_info: true,
  device_on: true,
  on_time: 1442,
  default_states: { type: 'custom', state: { on: false } },
  last_update: 1637080994810
}
apatsufas commented 2 years ago

@mgondium is the consumption returned by the Tapo app the total consumption since start use ? Or is it the current consumption?

mgondium commented 2 years ago

@mgondium is the consumption returned by the Tapo app the total consumption since start use ? Or is it the current consumption?

It is the current load.

When the Tapo App measures a 650W load, this shows in the Homebridge log:

[16/11/2021, 19:29:02] [Tapo Smart Platform] Get Characteristic Power consumption -> 650151

apatsufas commented 2 years ago

I just released a beta Version 1.4.11-beta1. Please give it a try and let me know.

apatsufas commented 2 years ago

Should be fixed with v1.4.11

firewhank commented 2 years ago

Hi @apatsufas Not sure if it's the same, but I have one p110 and just configured the device and have about 60W consuming in 2h and in the eve app says 112kWh used... In the tapo app says 0,2kWh

apatsufas commented 2 years ago

@firewhank please try again with Version 1.4.16-beta2

firewhank commented 2 years ago

It’s still showing a similar behavior. Every hour it’s consuming about 110w, but the consumption on eve app is 1,5kwh every hour

apatsufas commented 2 years ago

@firewhank could you do me a favor and try 1.4.16-beta4 and set homebridge in Debug mode? Please let me know the log values for "Current consumption" and "Total consumption"

firewhank commented 2 years ago

I think this is it:

Tapo Smart Platform] { result: { today_runtime: 1243, month_runtime: 5747, today_energy: 716, month_energy: 6974, local_time: '2022-01-03 20:50:04', past24h: [ 119, 2, 356, 686, 1, 2, 1, 2, 2, 1, 2, 1, 1, 2, 1, 2, 2, 1, 2, 1, 2, 1, 2, 1 ], past30d: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 116, 663, 516, 763, 4200, 716 ], past1y: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1295, 5679 ], past7d: [ [Array], [Array], [Array], [Array], [Array], [Array], [Array] ], current_power: 1515 }, error_code: 0 }

apatsufas commented 2 years ago

@firewhank thank you for your help. I'm not really sure though what current_power and today_energy are. Would it be possible to provide the same response in conjunction with the corresponding TAPO app screen, maybe this way I could tell what each value means.

firewhank commented 2 years ago

device_id: '8022C3DF85981442E4475A1774FDF9F71EF01BFA', fw_ver: '1.0.7 Build 210629 Rel.174901', hw_ver: '1.0', type: 'SMART.TAPOPLUG', model: 'P110', mac: 'B0-A7-B9-0F-7F-E1', hw_id: '2FB30EF5BF920C44099401D396C6B55B', fw_id: '00000000000000000000000000000000', oem_id: '18BDC6C734AF8407B3EF871EACFCECF5', overheated: false, ip: '192.168.2.109', time_diff: 0, ssid: 'UGFyZGFs', rssi: -79, signal_level: 1, latitude: 390087, longitude: -90764, lang: 'en_US', avatar: 'plug', region: 'Europe/Lisbon', specs: '', nickname: 'QXF1ZWNlZG9y', has_set_location_info: true, device_on: true, IMG_0465

on_time: 65817, default_states: { type: 'last_states', state: {} }, last_update: 1641387949740

firewhank commented 2 years ago

Hope it helps