Telegram bot switch status

Hello there…
So I’m trying to have a Telegram Bot that tells me states of lights and switches… so I am using a template like this for lights

      message: >-
        *Luce Angolo*: {{ states.light.luceangolo.state }}

and it works, it correctly tells me the light status… so I wanted to do the same with a switch, and tried with a Sonoff with tasmota on it:

      message: >-
        *Scaldabagno*: {{ states.switch.interruttorenatale.state }} 

This works too…
So now I want to know the state of a switch (Houzetek brand, used with Tuya platform) and I’ve tried this:

      message: >-
        *Scaldabagno*: {{ states.switch.80027536bcddc28a7f83.state }}   

As a result, HA tells me

Invalid config for [automation]: invalid template (TemplateSyntaxError: expected token 'end of print statement', got 'bcddc28a7f83') for dictionary value @ data['action'][1]['data_template']['message']. Got None. (See ?, line ?). Please check the docs at

So I really don’t know what is the error…
Can you please help me?

Thanks in advance…


If your template uses an entity_id that begins with a number (example: states.device_tracker.2008_gmc ) you must use a bracket syntax to avoid errors caused by rendering the entity_id improperly. In the example given, the correct syntax for the device tracker would be: states.device_tracker['2008_gmc']

Also read the yellow warning on that page about using states.domain.object_id.state format:

Avoid using states.sensor.temperature.state , instead use states('sensor.temperature') . It is strongly advised to use the states() , is_state() , state_attr() and is_state_attr() as much as possible, to avoid errors and error message when the entity isn’t ready yet (e.g., during Home Assistant startup).