Telegram bot: error in parsing message

I have an error using Telegram bot to send message with device_tracker status.
If all device_tracker’s status are “home” then it’s ok without error and I see the telegram message, but when one device is “not_home” then I see this error:

[homeassistant.components.telegram_bot] Error sending message: Can’t parse entities: can’t find end of the entity starting at byte offset 131. Args: (335267109, ‘System is online!\n\nLast system reboot was on 2018-07-05.\n\nLocations are showing as -\nAlex - home\nBob - home\nRox - home\nSilvia - not_home\n\n\nLights are -\nSonoff power - off’), kwargs: {‘disable_notification’: False, ‘reply_markup’: <telegram.replykeyboardmarkup.ReplyKeyboardMarkup object at 0xaff11ff0>, ‘reply_to_message_id’: None, ‘timeout’: None, ‘parse_mode’: ‘Markdown’, ‘disable_web_page_preview’: None}

The action of automation triggered is

action:
  service: telegram_bot.send_message
  data_template:
    target: "{{ trigger.event.data.user_id }}"
    message: "System is online!


      Last system reboot was on {{ states('sensor.last_boot') }}.


      Locations are showing as -
      
      {% for state in states.device_tracker %}          
        {{- state.name }} - {{ state.state_with_unit }}
       
      {% endfor %}


      Lights are -
      
      {% for state in states.switch %}          
        {{- state.name }} - {{ state.state_with_unit }}
      
      {% endfor %}"

Since I copy this automation from
https://github.com/mf-social/Home-Assistant/blob/master/packages/interactive/telegram_info.yaml
probably @anon43302295 could help me.
Thank you

Hi,

You need to set parse_mode to html on your telegram bot…

telegram_bot:
  platform: polling
  api_key: !secret telegram_bot_api_key
  parse_mode: html
  allowed_chat_ids:
    - 1111111111
    - 2222222222 
    - 3333333333

Hope this helps :+1:

8 Likes

Thank you @anon43302295
This configuration solved my issue.

1 Like

same here…
thanks for posting, it solved my problem as well
ChrisV

1 Like