#Trying to run a script in lit but it doesn't match hass.callService(domain, service, data)

1 messages · Page 1 of 1 (latest)

late lance
#

I’m trying to use this syntax:

hass.callService('light', 'turn_on', {
  entity_id: 'light.kitchen'
});

to call a script, and I’m inferring that I need to call the turn_on service on the script domain to execute it.

However, the docs I found:
https://developers.home-assistant.io/docs/frontend/data#hasscallservicedomain-service-data

don’t explicitly mention this, and the Actions panel in Dev Tools makes it look like the script name itself is the “verb”, which threw me off a bit.

  1. Am I correct in assuming that scripts should always be called via:
hass.callService('script', 'turn_on', {
  entity_id: 'script.my_script'
});
  1. Would this be worth clarifying in the frontend/data docs? It wasn’t immediately obvious coming from the UI.

  2. Could I get a quick review of my custom row? I’m more of a React dev and not super familiar with Web Components/Lit.