core: TPLink light.turn_on with brightness does not turn on light

The problem

Calling service light.turn_on with a TPLink HS220 using either brightness_pct or brightness values will set the turn-on brightness level but will not actually turn on the light. light.turn_on without a brightness value has to be called a second time to actually turn on the light. This only happens when the light is previously in an off state. If the light is on and light.turn_on is called with a brightness state, the light will change immediately to the new brightness variable.

service: light.turn_on
target:
  entity_id: light.office_overheads
data:
  brightness_pct: 85
Status Behavior
Light is off Brightness set but light remains off
Light is on Light is changed to 85% brightness

The same behavior occurs with light.toggle making the following automation work incorrectly

- id: Office light toggle with office remote A
  alias: Office light on with remote

  trigger:
    platform: event
    event_type: isy994_control
    event_data:
      entity_id: sensor.office_remote_a
      control: 'DON'
  action:
    service: light.toggle
    data:
      entity_id: light.office_overheads
      brightness_pct: 100

What is version of Home Assistant Core has the issue?

core-2021.10.0

What was the last working version of Home Assistant Core?

core-2021.9.0

What type of installation are you running?

Home Assistant Container

Integration causing the issue

tpllink

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tplink/

Example YAML snippet

service: light.turn_on
target:
  entity_id: light.office_overheads
data:
  brightness_pct: 85

Anything in the logs that might be useful for us?

No errors, just unexpected behavior.

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (12 by maintainers)

Most upvoted comments

Tested against my hs220 and yes that turns it on and set to 80% brightness.

Please re-test with the .1 release when it gets released. That release will also improve the behavior for automatically discovered devices as the discovery will automatically be retried every 15 minutes (see #57221), so please let it run some time. If it’s still not working, please feel free to re-open the issue you linked with logs more details about your setup. If the improvements in .1 don’t fix it, the cause is unknown but might be related to https://github.com/python-kasa/python-kasa/issues/229 which needs more input & investigation.

Also confirmed that it works against my HS220. I turned the light off, then executed the following command. The light turned on to 80% brightness (brightness: 204).

bash-5.1# kasa --host 10.1.12.220 raw-command smartlife.iot.dimmer set_dimmer_transition '{"brightness": 80, "duration": 1}'
No --strip nor --bulb nor --plug given, discovering..
{}

Just for posterity’s sake, the hardware is TPLink HS220 Firmware: 1.5.11 Build 200214 Rel.152651