TP LINK HS110 sensors

I’ve read through the previous threads similar to this and modififed the script here

I’m getting this error ona configuration check

invalid config for [sensor.template]: [Skack_power_watts] is an invalid option for [sensor.template]. Check: sensor.template->sensors->Skack_power_watts. (See ?, line ?). Please check the docs at

I have read the sensor template section and no further forward, apart from requiring a sensor map ??

Should the switch section go before or after the sensor section ?
I can turn the HS110 switch on/off , but I cant see any sensor info on the kasa app
my configuration.yaml is here:-

  - platform: moon
  - platform: mqtt
    state_topic: "/iot4/IOT4SH01DS_A03625/temperature"
    name: "Hot Water Temp"
    unit_of_measurement: "C"

  - platform: darksky
    api_key: !secret darksky_api_key
    units:  auto
    update_interval: '00:15'
      - summary
      - precip_type
      - precip_probability
      - temperature
      - humidity
      - precip_intensity
      - wind_speed
      - pressure
      - wind_bearing
      - cloud_cover
# Shack power TP Link HS110
  - platform: template
        value_template: '{{ states.switch.Shack_power.attributes["current_power_w"] | replace(" W", "") | float }}'    

#    state_topic: "/iot4/IOT4SH01DS_A03625/temperature"
# Switches
  - platform: tplink
    name: LR Lamp
  - platform: tplink
    name: Shack_power
  - platform: mqtt
    name: Hot Water Boiler
    state_topic: "/iot4/IOT4SH01RELAY_D341DE/relay/0"
    command_topic: "/iot4/IOT4SH01RELAY_D341DE/relay/0/set"
    payload_on: "1"
    payload_off: "0"
  - platform: mqtt
    name: Evilbox1
    state_topic: "stat/evilbox1/POWER"
    command_topic: "cmnd/evilbox1/POWER"
    payload_on: "ON"
    payload_off: "OFF"
  - platform: mqtt
    name: Evilbox2
    state_topic: "stat/evilbox2/POWER"
    command_topic: "cmnd/evilbox2/POWER"
    payload_on: "ON"
    payload_off: "OFF"

I 've tried moving the sensor section for the HS110 to immediately after thye HS110 switch (

There 's more to come I hit the save topic too early …sorry

It didn’t like a uppercase name in the sensor, please ignore

# Shack power TP Link HS110
    sensor: # <- remove this line
  - platform: template


I was typing while trying something which didn’t help

Hi, does it work locallly i.e. wihtout the need of internet?