HA Noob trouble with Telegram

Hi,
I am completly new to HA. It looks awesome so far, but I am having trouble with the syntax. As a first test to see If I like HA I tried to make a Telegram notification when someone logs into the Wifi. I watched a lot of Youtube Videos, I read every bit of documentration on the HA website for two days, and now I am ready to throw my Keyboard out of the window because I can´t get it to work. The logfile states an error in a specific line, but I am too blind to find it. I am missing something small, possibly a syntax error I guess. Please help my poor keyboard to survive the day :grin:

here is a snippet from my configuration.yaml:

device_tracker:
    platform: nmap_tracker
  - hosts: 192.168.42.1/24
    home_interval: 5
    exclude:
    - 192.168.42.1
    - 192.168.42.35
notify:
  - name: Tracker
    platform: telegram
    chat_id: XXX     
telegram_bot:
    platform: polling
    api_key: xxxx
    allowed_chat_ids:
    - xxxx 
group: !include groups.yaml
automation: !include automations.yaml
config:

My automations.yaml:

automation:
  trigger:
    platform: state
    entity_id: device_tracker.Sebi
    from: 'not_home'
    to: 'home'
  action:
    service: notify.Telegram
    data:
      message: 'Person is now home'

And here is the logfile output:

2017-05-24 08:27:12 ERROR (Thread-1) [homeassistant.util.yaml] while parsing a block mapping
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 1, column 1
expected , but found ‘’
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 61, column 3

2017-05-24 08:27:12 ERROR (MainThread) [homeassistant.bootstrap] Error loading /home/homeassistant/.homeassistant/configuration.yaml: while parsing a block mapping
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 1, column 1
expected , but found ‘’
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 61, column 3

My first guess is the error in device_tracker…

device_tracker:
 - platform: nmap_tracker
   hosts: 192.168.42.1/24
   home_interval: 5
   exclude:
     - 192.168.42.1
     - 192.168.42.35

then maybe notify.telegram not notify.Telegram

Also, you ask nmap to scan for ip between 1 and 24… then ask it to reject the 1 and 35… You could directly put
hosts: 192.168.2/24
and then remove your exclude part

First of all: Don’t post your chat ID. It’s a very sensitive information.

Secondly: could you either tell which lines of your configuration.yaml you’ve posted? As the log says - the mistake is in line 61.

expected , but found ‘’
in “/home/homeassistant/.homeassistant/configuration.yaml”, line 61, column 3

line 61 is this:

  • hosts: 192.168.42.1/24

a “/24” should tell Nmap to scan for all 254 IP´s. Looks right for me…

P.S.: thanks for pointing out the Chat ID was not “X” copy and paste mistake :smile:

What does your config say if you include @lambtho’s fix (putting the “-” in front of platform and not in front of hosts)?

1 Like

Ok… well… it kind of worked. It was indeed the “-” which was in the wrong place. The error I posted above is gone, but now the logfile shows a new one, and I don´t have a clue whats going on.

###############################################################################

2017-05-25 14:27:52 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=50 from 2017-05-25 14:25:12.648247)
2017-05-25 14:28:04 WARNING (MainThread) [homeassistant.setup] Setup of device_tracker is taking over 10 seconds.
2017-05-25 14:28:05 WARNING (MainThread) [homeassistant.setup] Setup of tts is taking over 10 seconds.
2017-05-25 15:51:01 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal read error on socket transport
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/selector_events.py", line 582, in _read_ready
    data = self._sock.recv(self.max_size)
OSError: [Errno 113] No route to host
2017-05-25 19:37:03 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal read error on socket transport
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/selector_events.py", line 582, in _read_ready
    data = self._sock.recv(self.max_size)
OSError: [Errno 113] No route to host
2017-05-25 23:49:00 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal read error on socket transport
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/selector_events.py", line 582, in _read_ready
    data = self._sock.recv(self.max_size)
OSError: [Errno 113] No route to host
2017-05-26 01:21:18 ERROR (MainThread) [homeassistant.components.telegram_bot.polling] Client connection error
2017-05-26 08:05:05 ERROR (MainThread) [homeassistant.core] Timer got out of sync. Resetting
2017-05-26 08:05:59 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal read error on socket transport
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/selector_events.py", line 582, in _read_ready
    data = self._sock.recv(self.max_size)
OSError: [Errno 113] No route to host
2017-05-26 10:22:54 WARNING (Thread-1) [netdisco.ssdp] Found malformed XML at http://192.168.42.28:9080: status=ok
2017-05-26 14:16:00 ERROR (MainThread) [homeassistant.core] Error doing job: Fatal read error on socket transport
Traceback (most recent call last):
  File "/usr/lib/python3.4/asyncio/selector_events.py", line 582, in _read_ready
    data = self._sock.recv(self.max_size)
OSError: [Errno 113] No route to host
2017-05-26 15:20:21 WARNING (MainThread) [homeassistant.core] Unable to find service notify/telegram

I think I will do a clean install, I am pretty frustrated

How did you configure your telegram bot? You have to do two things:

  1. Configure a telegram_bot
    https://home-assistant.io/components/telegram_bot/

  2. Tell your telegram_bot where to contact you.

Have a look at my config. Maybe this helps you to take the right steps (I commented something for you after the “#”)

notify:
  - name: Telegram # this is your notify.service you are calling. In this case notify.telegram
    platform: telegram
    chat_id: 123456789
  - name: Telegram_Haushalt #And in this case notify.telegram_haushalt (I have two chats)
    platform: telegram
    chat_id: 987654321

telegram_bot:
  platform: polling
  api_key: 12346ABCDEF
  allowed_chat_ids:
    - 123456789 #use the chat IDs from above
    - 987654321

I hope this helps.

Hey HeavyMettAal,

how did you solve the issue? Erperiencing the same here…

mny

@mny @HeavyMettAal
Somehow home-assistant is losing internet connection (?) and throwing

Fatal read error on socket transport error.

I don’t think this is Telegram bot related. However the polling component immediately tries to reconnect but can’t flooding the log as a result. The component now has added a timeout to the reconnect. This prevents flooding the log but not the Fatal read error.
I guess a little part of the solution. Is this helping you too ?

Sander.

Sander,

thanks for the details.

I had to reboot my RPi/HA every other day so I meanwhile installed Hass.io (which runs stable but brings new issues as you may see in my postings).

Thanks again
mny