How to create automation with Raspi GPIO integration?

Is there a way to create unique IDs from the Raspi GPIO integration? More info below.

I have a relay connected to a Raspi4 on pin 5. I also have the GPIO integration working so a switch on Lovelace can toggle the relay. I hear the click, everything’s great.

However, I notice that a unique ID is not created with the GPIO integration. I think this prevents the use of these entities in automations, which is why I use HASS!

Here is my current config:

  - platform: rpi_gpio
      5: "HAT Relay 1"

How can a raspi gpio pin be automated? Thanks for reading,

alias: Outdoor Lights
  - event: sunset
    platform: sun
  - entity_id: switch.outdoor_lights
    service: switch.turn_on
mode: single

This works for me, my switch is an RPI GPIO controlling a relay. Don’t need unique ID AFIK, please explain why you think it doesn’t work.

I didn’t consider calling a service. Will use that, thanks