plasticrake / homebridge-tplink-smarthome

TP-Link Smarthome Plugin for Homebridge
MIT License
468 stars 69 forks source link

KL430 does not turn on if last state was a Color Painting #259

Open reidrichardson opened 2 years ago

reidrichardson commented 2 years ago

Is there an existing issue for this?

What happened?

When setting the light strip to use a "color painting" and setting it to set to last state for power on, the light strip does not turn on if I do it through homekit. If it is set to a static color, it works as expected. Additionally, it seems to work fine using the official connectors for Alexa/Google Home, but obviously TP-Link supports these.

Same thing happens with the tplink-smarthome-api. It returns true, but the light is Not sure if this is really a 'bug' so much as a feature request for an unexpected lighting effect.

the logs are laid out in the following order 1) How tplink-smarthome-api sees the light strip when it has been set through the kasa app 2) The output returns true if I turn it on through the api command 3) The light info after the command has been ran, but the light isn't actually on

What, if anything, has recently changed?

Nothing other than setting it to use the color painting instead of a day light as far as I am aware

Version

7.0.1

Node Version

16.14.2

Homebridge Version

1.4.0

Which OS/Platform?

Linux

Relevant log output

tplink-smarthome-api getInfo 192.168.1.81
Sending getInfo command to 192.168.1.81:  via tcp...
response:
{
  sysInfo: {
    sw_ver: '1.0.9 Build 210915 Rel.170534',
    hw_ver: '2.0',
    model: 'KL430(US)',
    deviceId: '8012FA10716AD1CB48132A7A51DE1A471DCB2ACA',
    oemId: '0D8D030103F88173CD7D202D63137DF3',
    hwId: '5F8CB8CB51F43A1C335C4D97FB33532B',
    rssi: -53,
    latitude_i: 286039,
    longitude_i: -811787,
    alias: 'office',
    status: 'new',
    description: 'Kasa Smart Light Strip, Multicolor',
    mic_type: 'IOT.SMARTBULB',
    mic_mac: 'C0:C9:E3:4B:70:BE',
    dev_state: 'normal',
    is_factory: false,
    disco_ver: '1.0',
    ctrl_protocols: { name: 'Linkie', version: '1.0' },
    active_mode: 'none',
    is_dimmable: 1,
    is_color: 1,
    is_variable_color_temp: 1,
    LEF: 1,
    length: 16,
    light_state: {
      on_off: 1,
      mode: 'normal',
      hue: 120,
      saturation: 75,
      color_temp: 0,
      brightness: 90
    },
    lighting_effect_state: {
      enable: 1,
      name: 'Painting 1',
      custom: 1,
      id: 'HARkBmmePNlhuTgqiPiIqvdPReOHegOB'
    },
    preferred_state: [
      {
        mode: 1,
        index: 0,
        hue: 294,
        saturation: 77,
        color_temp: 0,
        brightness: 64
      },
      {
        mode: 1,
        index: 1,
        hue: 164,
        saturation: 34,
        color_temp: 0,
        brightness: 64
      },
      {
        mode: 1,
        index: 2,
        hue: 40,
        saturation: 80,
        color_temp: 0,
        brightness: 64
      },
      {
        mode: 1,
        index: 3,
        hue: 233,
        saturation: 84,
        color_temp: 0,
        brightness: 64
      },
      {
        mode: 1,
        index: 4,
        hue: 79,
        saturation: 82,
        color_temp: 0,
        brightness: 64
      }
    ],
    err_code: 0
  },
  cloud: {
    info: {
      username: '',
      server: 'n-devs.tplinkcloud.com',
      binded: 1,
      cld_connection: 1,
      illegalType: 0,
      stopConnect: 0,
      tcspStatus: 1,
      fwDlPage: '',
      tcspInfo: '',
      fwNotifyType: -1,
      err_code: 0
    }
  },
  emeter: {
    realtime: {
      power_mw: 8785,
      total_wh: 401,
      err_code: 0,
      power: 8.785,
      total: 0.401
    }
  },
  schedule: { nextAction: { type: -1, err_code: 0 } },
  lighting: {
    lightState: {
      on_off: 1,
      mode: 'normal',
      groups: [ [ 0, 15, 120, 75, 90, 0 ] ],
      length: 16,
      transition: 500,
      err_code: 0
    }
  }
}

tplink-smarthome-api setPowerState 192.168.1.81 on
Sending setPowerState command to 192.168.1.81:  via tcp...
response:
true

Sending getInfo command to 192.168.1.81:  via tcp...
response:
{
  sysInfo: {
    sw_ver: '1.0.9 Build 210915 Rel.170534',
    hw_ver: '2.0',
    model: 'KL430(US)',
    deviceId: '8012FA10716AD1CB48132A7A51DE1A471DCB2ACA',
    oemId: '0D8D030103F88173CD7D202D63137DF3',
    hwId: '5F8CB8CB51F43A1C335C4D97FB33532B',
    rssi: -50,
    latitude_i: 286039,
    longitude_i: -811787,
    alias: 'office',
    status: 'new',
    description: 'Kasa Smart Light Strip, Multicolor',
    mic_type: 'IOT.SMARTBULB',
    mic_mac: 'C0:C9:E3:4B:70:BE',
    dev_state: 'normal',
    is_factory: false,
    disco_ver: '1.0',
    ctrl_protocols: { name: 'Linkie', version: '1.0' },
    active_mode: 'none',
    is_dimmable: 1,
    is_color: 1,
    is_variable_color_temp: 1,
    LEF: 1,
    length: 16,
    light_state: {
      on_off: 0,
      dft_on_state: {
        mode: 'normal',
        hue: 120,
        saturation: 75,
        color_temp: 0,
        brightness: 90
      }
    },
    lighting_effect_state: {
      enable: 0,
      name: 'Painting 1',
      custom: 1,
      id: 'HARkBmmePNlhuTgqiPiIqvdPReOHegOB'
    },
    preferred_state: [
      {
        mode: 1,
        index: 0,
        hue: 294,
        saturation: 77,
        color_temp: 0,
        brightness: 64
      },
      {
        mode: 1,
        index: 1,
        hue: 164,
        saturation: 34,
        color_temp: 0,
        brightness: 64
      },
      {
        mode: 1,
        index: 2,
        hue: 40,
        saturation: 80,
        color_temp: 0,
        brightness: 64
      },
      {
        mode: 1,
        index: 3,
        hue: 233,
        saturation: 84,
        color_temp: 0,
        brightness: 64
      },
      {
        mode: 1,
        index: 4,
        hue: 79,
        saturation: 82,
        color_temp: 0,
        brightness: 64
      }
    ],
    err_code: 0
  },
  cloud: {
    info: {
      username: '',
      server: 'n-devs.tplinkcloud.com',
      binded: 1,
      cld_connection: 1,
      illegalType: 0,
      stopConnect: 0,
      tcspStatus: 1,
      fwDlPage: '',
      tcspInfo: '',
      fwNotifyType: -1,
      err_code: 0
    }
  },
  emeter: {
    realtime: {
      power_mw: 600,
      total_wh: 401,
      err_code: 0,
      power: 0.6,
      total: 0.401
    }
  },
  schedule: { nextAction: { type: -1, err_code: 0 } },
  lighting: {
    lightState: {
      on_off: 0,
      dft_on_state: { mode: 'normal', groups: [ [ 0, 15, 120, 75, 90, 0 ] ] },
      length: 16,
      transition: 500,
      err_code: 0
    }
  }
}

Configuration

{
            "platform": "TplinkSmarthome",
            "deviceTypes": [
                "plug",
                "bulb"
            ],
            "name": "TplinkSmarthome",
            "addCustomCharacteristics": true
        }
plasticrake commented 9 months ago

Thanks for all that troubleshooting output, however your command actually was turning off the device. Can you provide the same when turning it on?

tplink-smarthome-api setPowerState 192.168.1.81 true

you had "on" instead of "true"