Turning off a switch in HomeAssistant

I have recently installed Klipper on my Ender3v2. I am new to coding and are trying to piece together what I can to be able to figure out how to turn off a switch managed via HomeAssistant. I know Moonraker has Home Assistant Configuration (HTTP) and have already integrated it to moonraker.conf like this:

# HomeAssistant Integration
[power homeassistant_switch]
type: homeassistant
address: 192.168.1.xxx
port: 8123
device: switch.ender3v2
token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
domain: switch
status_delay: 1.0

and also added a macro in my macros.cfg file like this:

[gcode_macro POWER_OFF_LIGHT]
gcode:
  {action_call_remote_method("set_device_power", device="homeassistant_switch", state="off")}

It is not working and I know it is because I am missing something. I have gotten this far by reading the Moonraker documentation here:

Home Assistant Configuration (HTTP)

Any information that points me in the right direction would be greatly appreciated.