Referenced entities light.table_light_switch are missing or not currently available

How is it possible that I can access an entity via script but get an error when sending a command remotely? I’m trying to control my LightwaveRF custom driver remotely.

This command fails:
curl -X POST -H “Authorization: Bearer xxxx” -H “Content-Type: application/json” -d “{ "entity_id": "light.table_light_switch" }” http://homeassistant.local:8123/api/services/switch/turn_on

This script works just fine:
table_light_on:
alias: Table_Light_On
sequence:

  • action: light.turn_on
    metadata: {}
    data: {}
    target:
    entity_id: light.table_light_switch
    description: ‘’
    table_light_off:
    alias: Table_Light_Off
    sequence:
  • action: light.turn_off
    metadata: {}
    data: {}
    target:
    entity_id: light.table_light_switch
    description: ‘’

Any pointers would be very much appreciated.

Should perhaps be http://homeassistant.local:8123/api/services/light/turn_on

Thank you so much. I have been driving myself crazy with this.

Chris