Trying to expand tellduslive support

OK I figured this out! I hope I have done this the right way… Does seem to work? :slight_smile:

@keithh666 here is some instructions. It is mainly pulled from the ‘Getting Started’ and ‘Developers’ section on the hass website.

Pre-Requisite

  • Backup and verify! I hope I won’t trash your HASS install, but to be safe make a backup of your environment! I have my HASS install running on an Ubuntu VM, so I just simply snapshot the machine to be safe and quickly revert if need be.
  • Ensure you have your original / working install upgraded to the latest version, as your configuration files will get updated otherwise and might break your production version.
  • SSH into your machine running HASS.
  • stop your existing hass environment (if running as service: sudo systemctl stop [email protected])

Upgrade Components

sudo apt-get update
sudo apt-get upgrade

Install GIT

sudo apt-get install git

NOTE: If you have not got a hass user - below might not work. (see Virtualenv Installation)

Prepare for build

sudo mkdir /srv/hatdb
sudo chown hass /srv/hatdb

Become the user

sudo su -s /bin/bash hass

Configure virtual environment:

virtualenv -p python3 /srv/hatdb
source /srv/hatdb/bin/activate

Prompt should say (hatdb)

Download and Build

cd /srv/hatdb
git clone -b 'tellduslive2' https://github.com/molobrakos/home-assistant.git

Check PIP modules are up to date:

pip3 install --upgrade pip
pip3 install --upgrade setuptools

Build home-assistant:

cd home-assistant
script/setup

Go grab a cup of tea :slight_smile:
If all is well - you should see Finished processing dependencies for homeassistant

Run Home-Assistant!

hass

Mine works pretty well!

@molobrakos - My initial testing of dimmable lights works great!

Thanks so much for sorting this.

There is just 1 wish which would be great if possible. When switching on a light if it can return to the previous dim level. At present it turns on to 255.

Thanks for testing! And glad you managed to setup your system for testing.
Regarding the dim level: does it work this way when using a standard physical switch, i.e. does it remember the dim level after turning it off? Also, I noticed that the HTML UI at http://live.telldus.com only presents the dim level, without any separate switch for turn on/off. Does it work this way for other dimmable lights in Home Assistant?

So the Telldus Live iOS App does not return to the previous dim level, however in other automations in the past I have simply been able to provide the dim level from off and it will go straight to that.

that said, if you use a 433Mhz remote - the switch itself does remember the last dim level! So it’s just the switching on in Telldus which puts it to full.

So - yes it would be nice if the last dim level was remembered. Particularly as the web interface for dimmable devices is strange. It does not show the slider when the device is ‘off’ which is a shame!

OK, I’ve failed at the first command :stuck_out_tongue:

The update command fails as PiLight won’t update…
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://apt.pilight.org stable InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY CC28DD82EF4C718C

W: Failed to fetch http://apt.pilight.org/dists/stable/InRelease

W: Some index files failed to download. They have been ignored, or old ones used instead.

Assuming I can ignore it, I carried on. Everything worked fine until I tried to start hass and although hass starts just about everything causes errors, here’s a quick sample…

16-12-03 16:13:17 ERROR (MainThread) [homeassistant.loader] Error loading homeassistant.components.emulated_hue. Make sure all dependencies are installed

16-12-03 16:13:17 ERROR (MainThread) [homeassistant.loader] Error loading homeassistant.components.automation. Make sure all dependencies are installed

Logbook, frontend, media_player, http, history and z wave all fail to load due to missing dependencies, so currently HA is not usable :frowning:

Is something missing in the build file? Or did the failed update cause a problem?

I’m not that familiar with installing HA as a package globally, but usually it is convenient to test experimental versions as an normal user in the home directory without changing anything globally as root. You just have to make sure that the global running version of HA does not run at the same time (or you have to use a different port).

Something like this:

sudo systemctl stop [email protected]
mkdir -p $HOME/hass-dev
cd $HOME/hass-dev
git clone -b 'tellduslive2' https://github.com/molobrakos/home-assistant.git
cd home-assistant
virtualenv -p python3 .
source bin/activate
script/setup
hass

You will also need to a copy of the configuration file in $HOME/.home-assistant/configuration.yaml

Then after testing you can just restart the global version.

Ok, I’ll give it a try, many thanks :slight_smile:

I still get the same errors but I notice quite a few failures in the compilation…

No package ‘libffi’ found
c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^

arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-sec urity -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.4m -I/home/pi/hass-dev/home-as sistant/include/python3.4m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.4/c/_cffi_backend.o
c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^
compilation terminated.
error: command ‘arm-linux-gnueabihf-gcc’ failed with exit status 1

arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-s                                                                            ecurity -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.4m -I/home/pi/hass-dev/home-                                                                            assistant/include/python3.4m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.4/c/_cffi_backend.o
c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
 #include <ffi.h>
                 ^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

----------------------------------------

Command “/home/pi/hass-dev/home-assistant/bin/python3 -u -c “import setuptools, tokenize;file=’/tmp/pip-build-req8v0cx/cffi/setup.py’;f= getattr(tokenize, ‘open’, open)(file);code=f.read().replace(’\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --rec ord /tmp/pip-a2q3js20-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/pi/hass-dev/home-assis tant/include/site/python3.4/cffi” failed with error code 1 in /tmp/pip-build-req8v0cx/cffi/

@keithh666, sudo apt-get install libffi-dev might help you out (without knowing much else about your setup).

@mitsumaui, would you mind testing again and see if the dimming works as expected?

Also, it would be nice if somebody with access to shades/cover/blinds could verify the cover implementation.

OK, it compiles correctly, at least as far as I can tell. However, I still get lots of errors when running HA …

16-12-04 00:33:29 ERROR (MainThread) [homeassistant.loader] Error loading homeassistant.components.logbook. Make sure all dependencies are installed
Traceback (most recent call last):
File “/home/pi/hass-dev/home-assistant/homeassistant/loader.py”, line 139, in get_component
module = importlib.import_module(path)
File “/home/pi/hass-dev/home-assistant/lib/python3.4/importlib/init.py”, line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 2254, in _gcd_import
File “”, line 2237, in _find_and_load
File “”, line 2226, in _find_and_load_unlocked
File “”, line 1200, in _load_unlocked
File “”, line 1129, in _exec
File “”, line 1471, in exec_module
File “”, line 321, in _call_with_frames_removed
File “/home/pi/hass-dev/home-assistant/homeassistant/components/logbook.py”, line 18, in
from homeassistant.components.frontend import register_built_in_panel
File “/home/pi/hass-dev/home-assistant/homeassistant/components/frontend/init.py”, line 8, in
from aiohttp import web
File “/home/pi/hass-dev/home-assistant/lib/python3.4/site-packages/aiohttp/web.py”, line 10, in
from . import hdrs, web_exceptions, web_reqrep, web_urldispatcher, web_ws
File “/home/pi/hass-dev/home-assistant/lib/python3.4/site-packages/aiohttp/web_urldispatcher.py”, line 14, in
from yarl import URL, quote, unquote
ImportError: cannot import name ‘quote’
16-12-04 00:33:29 ERROR (MainThread) [homeassistant.loader] Unable to find component logbook

I get the above error for logbook, http, frontend, media_player, and history components, so although HA runs I can’t get to the frontend web site or get any other info from it :frowning:

@keithh666 - It’s hard to say, as I am still fairly new to this! Hopefully someone else can help you out. I’ve been able to repro my steps several times now without incident.

@molobrakos - Tested again, yes works great with remembering the previous dim level! Sorry do not have any covers / blinds to test with :frowning:

I actually just pulled your .py files into the latest 0.34 master branch as there is other components in this release I want to test :slight_smile: Thanks again for your help - let me know if there is anything else you need to help have this merged into the master code branch.

Hello! Long time no see :slight_smile: Have been moving and not using Hass for a while. I am now running the latest version and covers seems to be working fine as well :slight_smile:

1 Like

Hi.
I want to thank you @molobrakos for the light support.
It works good.
Do you know If there have been many changes to the telldus component recently?
My switches and sensors often become unavailable after last update.
Strange thing is that it often happens like 09.00 or 16.00 at a whole hour. But not always.
Earlier it have been rock solid.

@xydix, thanks for the feedback. I don’t think there have been any changes relating to the connectivity that should make components unavailable more often than before. (Maybe there are server side issues - especially if it happens at specific times during the day?)

However, there are changes made related to the way the client caches the server status, and it might result in devices being reported as unavailable more than before.

Also, the device name obviously should be cached client side (on the todo-list), since, in your example/screenshot above - the device name should remain even if/when a device becomes unavailable, instead of changing to “Unnamed device”

I guess I will have to wait to see.
This problem came after 0,37 or 0,38.
I have seen it for a while now.
It happened 14 times today.

Have you changed the update interval from the default? What happens if you increase it?

No my interval is unchanged at the moment.
Where is that done?
Hass global interval settings?
I checked my error log this morning and discovered problems with connection to verisure as well.
Not as often as telldus and not the same time so i guess my internet connection is okay.
I am not at home so can check it but when connect to my VPN in my router it seems fine.

17-02-21 02:00:29 WARNING (Thread-9) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 02:25:37 WARNING (Thread-4) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 02:26:39 WARNING (Thread-11) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 02:26:44 WARNING (Thread-11) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 03:35:16 WARNING (Thread-7) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 03:35:21 WARNING (Thread-7) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 05:10:06 WARNING (Thread-11) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 06:00:31 WARNING (Thread-7) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 07:38:17 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
17-02-21 09:00:10 WARNING (Thread-12) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 09:00:15 WARNING (Thread-12) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 09:10:20 WARNING (Thread-5) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 11:00:20 WARNING (Thread-7) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 11:10:22 WARNING (Thread-3) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 11:10:27 WARNING (Thread-3) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 12:30:08 WARNING (Thread-5) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 13:48:56 WARNING (Thread-6) [urllib3.connectionpool] Connection pool is full, discarding connection: api.telegram.org
17-02-21 14:30:09 WARNING (Thread-3) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 14:30:14 WARNING (Thread-3) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 15:00:25 WARNING (Thread-9) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 15:00:30 WARNING (Thread-9) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 16:30:20 WARNING (Thread-9) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 16:40:19 WARNING (Thread-3) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 16:40:25 WARNING (Thread-3) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 17:00:29 WARNING (Thread-3) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 17:05:02 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
17-02-21 17:40:57 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
17-02-21 18:10:07 WARNING (Thread-5) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 18:10:13 WARNING (Thread-5) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 18:15:09 WARNING (Thread-1) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 20:00:11 WARNING (Thread-9) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 20:30:24 WARNING (Thread-12) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 22:00:13 WARNING (Thread-3) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 22:00:19 WARNING (Thread-3) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 22:12:36 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
17-02-21 23:07:49 ERROR (Thread-3) [braviarc.braviarc] JSON request error:{
    "error": [
        40005,
        "Display Is Turned off"
    ],
    "id": 1
}
17-02-21 23:30:11 WARNING (Thread-6) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-21 23:53:38 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
17-02-22 01:00:19 WARNING (Thread-13) [pychromecast.socket_client] Heartbeat timeout, resetting connection
17-02-22 01:00:49 ERROR (Thread-13) [pychromecast.socket_client] Failed to connect, retrying in 5.000000s
Traceback (most recent call last):
  File "/home/homeassistant/.homeassistant/deps/pychromecast/socket_client.py", line 246, in initialize_connection
    self.socket.connect((self.host, self.port))
  File "/usr/lib/python3.4/ssl.py", line 840, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.4/ssl.py", line 827, in _real_connect
    socket.connect(self, addr)
socket.timeout: timed out
17-02-22 01:30:08 WARNING (Thread-3) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-22 02:00:27 WARNING (Thread-8) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-22 02:32:22 ERROR (Thread-11) [homeassistant.components.verisure] Could not login to Verisure MyPages, HTTPSConnectionPool(host='mypages.verisure.com', port=443): Read timed out. (read timeout=10)
17-02-22 05:30:18 WARNING (Thread-6) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)
17-02-22 05:56:16 ERROR (Thread-4) [homeassistant.components.verisure] Could not login to Verisure MyPages, Not logged in
17-02-22 07:10:17 WARNING (Thread-5) [tellduslive] Failed request: HTTPSConnectionPool(host='api.telldus.com', port=443): Read timed out. (read timeout=5)

I see this in my logs as well (but I assumed this was because of my mobile 4G connection).
The update interval can be changed in configuration.yaml (but then you will get less frequent sensos updates):

tellduslive:
    update_interval: 300 # seconds

Also, maybe the default timeout could be increased. Please see related discussion here: BLE and Telldus Live Errors on new HASS 0.35.3 install on RPI3 AIO

I missed that thread.
Thanks.
I prefer not to increase my update interval as i have some dummy switches that i use to turn on / off some mysensors nodes from the tellstick app.
I will try to change the time out limit.
But if you see the same thing, maybe it is the telldus server. But for me, this issue is new.

I understand, switches updated from the server does not work very well with the current server polling approach.
The timeout will be changed in the next released version.

I believe one problem might be that we increased the polling interval to 1/minute for both sensors and swictches, from previously 1/5 min for sensors and 1/min for switches. The server won’t accept two queries (i.e. both sensor and switch states) in the same request, resulting in two requests (i.e. server reconnect) including oath authentication every minute.