Fix json encode bug

This commit is contained in:
pvizeli 2017-03-29 16:27:16 +02:00
parent efd1de2fc2
commit 32cb00258b
2 changed files with 5 additions and 2 deletions

View File

@ -53,7 +53,10 @@ class HostControll(object):
elif response == "ERROR": elif response == "ERROR":
return False return False
else: else:
try:
return json.loads(response) return json.loads(response)
except ValueError:
_LOGGER.warning("Json parse error from HostControll.")
except asyncio.TimeoutError: except asyncio.TimeoutError:
_LOGGER.error("Timeout from HostControll!") _LOGGER.error("Timeout from HostControll!")

View File

@ -17,7 +17,7 @@ do
IFS=" " read -r -a parse <<< $cmd IFS=" " read -r -a parse <<< $cmd
if [ ${parse[0]} == "info" ]; then if [ ${parse[0]} == "info" ]; then
echo "{'host': 'resinos', 'version': '$RESINOS_HASSIO_VERSION'}" echo "{ \"host\": \"resinos\", \"version\": \"$RESINOS_HASSIO_VERSION\" }"
continue continue
fi fi
if [ ${parse[0]} == "reboot" ]; then if [ ${parse[0]} == "reboot" ]; then