Configure Harmony to control TP Link Switch

Hello. I am a newcomer to Home Assistant. Here is a summary of my situation:

What do I want to do?
Use Home Assistant to allow my Harmony remote control to control my TP Link wifi power switch.

What do I have?
TP Link power wifi switch; Harmony Elite Remote; QNAP TS-451+ NAS; Hue Hub

What have I done?
Installed HA docker container onto QNAP NAS. Started it. Added configuration for TP Link switch. Successfully turned switch on and off via HA GUI. Added emulated_hue configuration for switch. Successfully viewed emulated hub XML and ‘light’ JSON via default HA:8300 port.

What is the problem?
When scanning for devices in the Harmony, the switch is not found.

Given all the above, what am I missing to complete the project?

Thanks!

Not sure what you mean when scanning for devices in harmony switch is not found?

I have set up a template sensor which allows me to use an automation to control other devices connected through home assistant based on the activity selected on harmony. Eg when select power off the tp link plug will turn off after 30s.

Hopefully that’s what you meant

Just re read your post and think I understand. Didn’t know they did emulated hue for tplink. But mine are quite old perhaps that’s a new feature

Thanks - do you happen to have a link for how to set something like this up? My ideal end-state is that when someone runs an activity in Harmony like ‘turn on tv’, the first thing that happens is the tp-link turns on.

The activity sensor:

sensor:
  - platform: template
    sensors:
     harmony_activity:
       friendly_name: 'Harmony Activity'
       value_template: '{{ states.remote.cinema_room.attributes.current_activity }}'

This an automation that I have. Its not TP link related but gives you an idea

- alias: "Switch lights to movie mode"
  trigger:
    - platform: state
      entity_id: sensor.harmony_activity
      to: 'Watch a Movie'
  
  action:  
    - service: script.cinema_room_scene_3
    - delay: 00:00:30
    - service: script.open_bluray_drawer

I tend to have scripts for my cinema room stuff. These are the scripts triggered by the above automation:

cinema_room_scene_3:
  alias: movie mode
  sequence:
    - service: hue.hue_activate_scene
      data:
        group_name: "Cinema room"
        scene_name: "6500k bright"
    - delay: 00:03:00
    - service: hue.hue_activate_scene
      data:
        group_name: "Cinema room"
        scene_name: "Movie down"
    - service: light.turn_on
      data:
        entity_id: light.hue_lightstrip_plus_1
        effect: colorloop
        transition: 5

open_bluray_drawer:
  alias: Open bluray drawer
  sequence:  
    - service: remote.send_command
      data: 
        entity_id: remote.cinema_room
        device: '44537867' 
        command:
          - Open/Close

I do the lights this way rather than through harmony directly as I find it much more flexible and has more functionality.

Here is a script I run to turn off my cinema room which includes turning off my tp link plug at the end. The reason I have delys is I have some usb fans to cool my AV amp and I would like the fans to continue running for a while to help cool things down before I switch everything off

cinema_room_off:
  alias: Cinema room off
  sequence:
    - service: script.power_off
    - delay: 00:03:00
    - service: light.turn_off
      entity_id: light.cinema_room
    - delay: 00:01:00
    - service: switch.turn_off
      entity_id: switch.cinemaroom_ceiling_broadlink
    - delay: 00:03:00  
    - service: switch.turn_off
      entity_id: switch.tv_too

At the moment I trigger the script manually from the front end, but I have been toying with the idea of creating an automation that is triggered by the poweroff activity.

Hope this gives you a few ideas

That’s great - thanks a lot for this - it seems very similar to what I am trying to achieve - will give it a go.

You can also achieve this with the Roku emulator component.