can you post the code you have? hard to tell what’s wrong w/o seeing the code.
but w/o seeing the code, if i had to guess, perhaps you’re hitting an issue that you have switches and lights, and you’re using switch.turn_on/turn_off/toggle.
if that’s the issue, instead of that, use homeassistant.turn_on/turn_off/toggle, then list all 4 entities
Yep at the top.of the page is a link.to.the docs page. There you will.find all.the info you need to create an automation, and anything you need to know about helpers.