Automation for any state change of lights or switches to send a rest_command

I want to create an automation that would be trigger by any light or switch state change. If I turn on, off or toggle my Living Room switch, the automation will run and send a rest_command. I have the rest_command working and tested under Developer Tools. I just need to figure out the automation part.

I am thinking I can use a value template but I a don’t know how to apply that to all lights and swtiches. Maybe using a domain?

I found my solution. Actually pretty easy one to implement.

I added 2 triggers in my automation: one for ligfht and one for switch

platform: event
event_type: call_service
event_data:
  domain: light