Changing Switches to Outlets in Homekit

Hi there!
I’ve set up LocalTuya and Homekit, and want to change a switch’s type to Outlet.
My valid configuration looks like this.

homekit:
  entity_config:
    switch.DeskLamp:
      type: outlet

I’ve tried restarting HA and resetting the switch with Homekit.Reset_Accessory via the Services Developer Menu tab.

Any ideas where I went wrong?

Thank you!

2 Likes

Did you end up finding a solution mate? I’ve just run into the same issue!

I don’t think I did, considering I ended up continuing using Homebridge.
It’s worth trying again using this.

homekit:
      switch.bedroom_outlet:
        type: outlet

Copied from the HA HomeKit Integration Page

You can choose the switch’s type as shown in HomeKit by using this.

You’ll also have to reset the device when changing the type, so ensure you follow this: Resetting Accesories

You might also be able to use globs (like binary_sensor.*_occupancy) to change a lot of switches types at once. But I’m not sure, I’ve never tried.

I’m not able to try any of this right now, but it should work, considering it’s copied straight from the docs.
If you need any help with it, I can have a go, but you can always open a fresh topic or ask in Discord.

1 Like

Thanks for your reply mate.

I ended up figuring it out.

I needed to have the correct type selected in my yaml file and then I disabled the homekit integration. I needed to setup everything into the correct rooms again but they worked as outlets correclty.

Thanks again!

hi when you say correct in your yaml file what did you add to change from switch to outlet, thanks
see part of my config
homekit:
filter:
include_entities:
- light.living_room_side_lights_both
- switch.haa_living_room_glass_light
- light.wled_fire_ip37_4
- light.wled_2
- sensor.living_room_temperature
- binary_sensor.living_room_smoke
- binary_sensor.pir_living_room

Hi Smeg,
This works for me.


homekit:
  - filter:
      include_entities:
        - switch.office
    entity_config:
      switch.office:
        type: outlet
1 Like

Thanks will try later think I have tried something like that and had errors but will try again thanks

Yes exactly as @LewisSpring has it.

Although keep in mind only changing your yaml doesn’t change anything in homekit. I had to disable the integration, restart HA, turn the integration back on and then restart HA. It means going through and moving everything around room etc but it works. :slight_smile:

1 Like

hi I still get config error in config see below if it makes sense to you thanks
bad indentation of a mapping entry at line 119, column 7:
- binary_sensor.pir_office

homekit:
filter:
include_entities:

  - light.wled
  - light.sonoff_1000af090a
  - switch.wave
  - sensor.office_temperature_z
  - sensor.office_humidity_z
  - binary_sensor.office_smoke
  - switch.haa_31_3d_printer

entity_config:
switch.haa_31_3d_printer:
type: outlet
- binary_sensor.pir_office
- light.wled_4
- light.wled_terminator_ip6_5
- light.aromatherapy_office
- humidifier.aromatherapy_office
- switch.haa_5
- light.aqara_hub_m1s_4b87

I didn’t see your reply - sorry about that!
If you’re still having this issue it might be because of your indentation of entity_config for switch.haa_31_3d_printer and type: outlet.

Your post formatting messed up so it’s hard to tell.
Try using the Preformatted Text button again, or use gist.github.com instead.

Hoping someone here that might have gotten this working can assist.
I am trying to achieve:

  • Two entities added to HomeKit
  • Both as accessories (not bridges)
  • Both have their type set to outlet.

Here’s my config which on reboot, only seems to show the first defined device (towel rail).

homekit:
  - filter:
      include_entities:
        - switch.towel_rail
        # - switch.solder_station
    mode: accessory
    entity_config:
      switch.towel_rail:
        type: outlet
    #   switch.solder_station:
    #     type: outlet
  - name: Solder Station HomeKit
    port: 21065
    filter:
      include_entities:
        - switch.solder_station
    mode: accessory
    entity_config:
      switch.solder_station:
        type: outlet

Hi @gid204
It might be worth re-writing it from scratch just as a sanity check.
Your configuration is complex, but I can’t immediately see anything wrong.