jheling / freeathome

Free@Home component for Home Assistant
103 stars 37 forks source link

Stuck on "waiting for connection" #34

Closed SifuDaigo closed 4 years ago

SifuDaigo commented 4 years ago

Whenever I enable the configuration for freeathome in my config-file HA gets stuck in an everlasting waiting for connection and the frontend won't load up. I already tried multiple times and even installed a fresh installation of homeassistant, but I can't get it to work.

Thanks for the effort!!!

dbrouwer1979 commented 4 years ago

Just try to reboot several times. Eventually it will load.

SifuDaigo commented 4 years ago

Thank you for the quick response. I already rebooted about ~15 times - sadly always the same result.

dbrouwer1979 commented 4 years ago

Maybe try this: disable freeathome. Then reboot. Then enable freeathome in config and reboot only home assistant from frontend (settings - server management - server management - reboot)

SifuDaigo commented 4 years ago

I did that just now - same probleme still.

bartdorlandt commented 4 years ago

This is my lazy script to work around it for now...

Dependency: 'nc' I'm using HA with docker. Feel free to change it to your liking.

#!/usr/bin/env bash

HOST=server
PORT=8123
SUCCESS=1
SLP=10
HARESTART='/usr/bin/docker restart home-assistant'

while [ $SUCCESS -ne 0 ]; do
    echo "Testing connectivity."
    /usr/bin/nc -z $HOST $PORT
    SUCCESS=$?

    if [[ $SUCCESS == 0 ]] ; then
        echo "Success!!"
        echo "    HA + Free@home are reachable"
    else
        echo "Restarting home-assistant"
        $HARESTART
        echo "waiting $SLP seconds and will test again."
        sleep $SLP
    fi
done
jheling commented 4 years ago

In the issue 'TypeError: 'NoneType' object is not an iterator #27' I posted a solution that work for me. The 'waiting for connection' is a result of the same bug. If it works for you, can you send a reply?

apfelmaennchen commented 4 years ago

For me a UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1231: ordinal not in range(128) error caused the "waiting for connection" loop.

As a solution I changed in freeathome/freeathome/fah/crypto.py line 138 from: result_ascii = result.decode('ascii') to: result_ascii = result.decode('utf-8')

I don't know whether this has side effects or not. At the moment it solved the problem for me.

miezie commented 4 years ago

Makes sense... how are the different encoding settings? On both FAH and a given HA instance?

jheling commented 4 years ago

The encoding should be utf-8. I have corrected crypto.py. The issue 'TypeError: 'NoneType' object is not an iterator is resolved in #27. So i am closing this issue.