Hi @ploto22, you need to post a little more code than that as we don’t know the context here. Also you need to format the code. You will get better help.
Home Assistant service calls
ESPHome devices can make service calls to any Home Assistant service. This functionality is not enabled by default for newly configured device, but can be turned on the options flow on a per device basis