Follow up #225 since it did not resolve the tellstick support. It's halfway there.
The libraries are now compiled in to homeassistant docker since 0.57.
The telldusd daemon/service is also compiled along with the libs.
However tellstick support is not possible until tellstick.py can communicate with telldusd service.
Possible scenarios?
a) Create an add-on that is running the telldus daemon and make it possible for tellstick.py to connect to unix socket published via network from the add-on.
b) Check if tellstick: is in configuration.yaml and then trigger to start the (existing) telldus daemon inside homeassistant docker. (Starting telldus daemon in homeassistant docker has been proven to work and enabling tellstick support in hassio., but is it wanted to have the daemon inside hassio docker?)
c) .. other suggestions?
The fast and easy way is variant a. I try do make a add-on they expose the service. I'm actual a bit busy while I move next days into a new home.
@pvizeli sounds like the right priorities and I wish you the best of luck with your move.. =)
I have put in some effort on trying to make the compilation work without using forked source of the telldus. Suggested in https://github.com/home-assistant/hassio-build/pull/46
I have a base for an addon that compiles and installs the telldus files here based on the above approach:
https://github.com/endor-force/hassio-addons/tree/telldus-core/telldus_core
Tested and verified to communicate with the hardware within the docker.
I have not experimented with any socat stuff in this myself yet.
Thanks.
Can you make a PR? After that I can fix the add-on with the part that you need to make it working :+1:
Great, PR done.
Status:
Addon created and available to install.
Addon is downloading official code from telldus github repo, patching and compiling that when installing. When the add on runs it is parsing the configuarion in the add-on and publishing the sockets for TellstickClient & TellstickEvents on port 50800 and 50801 respectively.
Pvizeli is working on the tellstick-net component to interact with the daemon/service that the add-on provides.
I have installed the addon that was added (tellstick), and I have this in my configuration:
`tellstick:
signal_repetitions: 3
switch:
The log for the tellstick addon looks like this:
starting version 3.2.2
[Info] Initialize the tellstick configuration
[Info] Run telldusd & socat
telldusd daemon starting up
Connecting to TellStick (1781/C31) with serial XYXYXYXY
But I still get the following error in home assistant gui:
`The following components and platforms could not be set up:
The indents are correct in the configuration file.
Good so far, it is as expected.
There is still work remaining with some steps before it is fully supported and ready to use.
Okay, thanks for the answeer @endor-force .
I'l patiently wait! ;) Good work by the way! :)
I work on it now. I ping you @endor-force for tests. Is that okay for you?
@pvizeli yes, absolutely :)
Is it ready to test or wip?
After quick test i do not get very good results with these edits yet.
Can you retry it?
Can you also lock into hass container to see if the unix socket will be created like inside add-on?
I can't test it, so It's a WIP on a way to stable :)
Tested again.
Should the sockets be in /tmp in hass container? The files/sockets are not there.
Is it intentional to change sensor/tellstick.py this way?
-REQUIREMENTS = ['tellcore-py==1.1.2']
+DEPENDENCIES = ['tellstick']
I do not get the sensor up in hass, and when adding switch in configuration.yaml hass will not load at all.
(had to add brackets for port to be parsed as array)
tellstick:
host: core-tellstick
port: [50800, 50801]
sensor:
- platform: yr
- platform: tellstick
# switch:
# - platform: tellstick
Log:
2017-11-30 11:02:00 WARNING (MainThread) [homeassistant.setup] Setup of sensor is taking over 10 seconds.
2017-11-30 11:02:22 ERROR (MainThread) [homeassistant.setup] Error during setup of component tellstick
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 193, in _async_setup_component component.setup, hass, processed_config)
File "/usr/lib/python3.6/asyncio/futures.py", line 331, in __iter__ yield self # This tells Task to wait for completion.
File "/usr/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup future.result()
File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.6/site-packages/homeassistant/components/tellstick.py", line 82, in setup host=net_host, port_client=net_ports[0], port_events=net_ports[1]) TypeError: __init__() got an unexpected keyword argument 'port_client'
2017-11-30 11:02:22 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of sensor.tellstick.
Setup failed for dependencies: tellstick 2017-11-30 11:02:22 ERROR (MainThread) [homeassistant.setup]
Unable to prepare setup for platform sensor.tellstick: Could not setup all dependencies.
Update:
Secured that i have the correct tellcore-net in use.
Socket /tmp/TelldusEvents is created in hassio container but not the TelldusClient.
Changed in sensor/tellstick.py in my test back to original:
REQUIREMENTS = ['tellcore-py==1.1.2']
Log:
tellcore.library.TelldusError: Could not connect to the Telldus Service (-6)
Most likely due to missing socket for TelldusClient
Added logging in tellcore net these args are parsed:
2017-11-30 15:42:13 INFO (SyncWorker_4) [tellcorenet] Tellcorenet: ['socat', 'TCP:core-tellstick:50800', 'UNIX-LISTEN:/tmp/TelldusClient']
2017-11-30 15:42:13 INFO (SyncWorker_4) [tellcorenet] Tellcorenet: ['socat', 'TCP:core-tellstick:50801', 'UNIX-LISTEN:/tmp/TelldusEvents']
I don't get it why TelldusEvents works but not TelldusClient does not.. is it different type of sockets?
Can you execute the command manual on homeassistant docker? Maybe socat give us a better message. No, this should be the same. It could be that he can't connect to core-tellstick:50800 maybe need a add-on restart?
Yes,
Executing socat for TelldusClient works
docker exec homeassistant socat TCP:core-tellstick:50800 UNIX-LISTEN:/tmp/TelldusClient
File TelldusClient is created in /tmp
ps -a
PID USER TIME COMMAND
1 root 0:00 /dev/init -- /usr/bin/entry.sh python3 -m homeassistant --config /config
9 root 0:58 /usr/bin/python3 -m homeassistant --config /config
10 root 0:00 udevd
59 root 0:00 socat TCP:core-tellstick:50801 UNIX-LISTEN:/tmp/TelldusEvents
60 root 0:00 [socat]
198 root 0:00 socat TCP:core-tellstick:50800 UNIX-LISTEN:/tmp/TelldusClient
236 root 0:00 ps -a
The [socat] is strange, and probably the socat created by tellcorenet..
I tried to switch order on the execution of the socats in the for loop in the tellcore net without any difference.
I found the bug, I make a new version
@pvizeli Yes, now it works!
Don't know if it's just in my tests now but i have the following in ps (duplicates of socat for TelldusEvents)
PID USER TIME COMMAND
1 root 0:00 /dev/init -- /usr/bin/entry.sh python3 -m homeassistant --config /config
9 root 0:49 /usr/bin/python3 -m homeassistant --config /config
10 root 0:00 udevd
83 root 0:00 socat UNIX-LISTEN:/tmp/TelldusClient,fork TCP:core-tellstick:50800
84 root 0:00 socat UNIX-LISTEN:/tmp/TelldusEvents,fork TCP:core-tellstick:50801
86 root 0:00 socat UNIX-LISTEN:/tmp/TelldusEvents,fork TCP:core-tellstick:50801
150 root 0:00 ps -a
Note. You must fix sensor/tellstick.py from the fork.. it is wrong.
It must be
REQUIREMENTS = ['tellcore-py==1.1.2']
_Extract from configuration.yaml used in tests_
tellstick:
host: core-tellstick
port: [50800, 50801]
# Weather prediction
sensor:
- platform: yr
- platform: tellstick
#temperature_scale: "°C"
switch:
- platform: tellstick
Thanks for testing, It will go into next version :+1:
What is the error with DEPENDENCIES = ['tellstick']?
Strange, i got errors in my initial tests but now it's working with that code.
As long as it does not uphuck anything for regular tellstick/non hass-io users? =)
DEPENDENCIES = ['tellstick'] is the correct way for platforms. At the moment it is wrong. Maybe a other bug have made that he had not work correct 👍
https://twitter.com/pvizeli/status/936327994938986497
Do you have time to add a small add-on page to website? I can merge it later
Thank you very much for your support and patience! =)
I have added add-on page (non featured) in new PR in nextbranch here
I just started with hass.io today and I got hit by this issue (what are the odds that the issue is fixed the same day I start using hass.io??). Great work fixing this!
When is 0.59 going to be released?
Thanks!
In next 2 days
@pvizeli
What do you think about adding a listener for hassio addon_stdin commands in to run.sh?
Is it wise or is there some better practice to use for the purpose of calling tdtool?
User could issue the following service call for example: {"addon":"core_tellstick","input":"learn 1"}
This will result in tdtool --learn 1 being executed in the Tellstick docker.
My suggestion, tested and works:
# Clip from run.sh
# Expose the unix socket to internal network
socat TCP-LISTEN:50800,reuseaddr,fork UNIX-CONNECT:/tmp/TelldusClient &
socat TCP-LISTEN:50801,reuseaddr,fork UNIX-CONNECT:/tmp/TelldusEvents &
# Run telldus-core daemon in the background
exec /usr/local/sbin/telldusd --nodaemon < /dev/null &
# Listen for input to tdtool
echo "[Info] Run event listener"
while read -r input; do
# removing JSON stuff
input="$(echo "$input" | jq --raw-output '.')"
echo "[Info] Read alias: $input"
if ! msg="$(tdtool --$input)"; then
echo "[Error] TellStick Command failed -> $msg"
fi
done
Is the addon available as a Dockerfile somewhere? I'm not running hassio, but would like to move telldusd out of my main HA container, via tellcore-net. Thanks!
@torarnv yes all hassio add-ons are available at github
Tellstick addon is here if you wish to experiment on other setups: https://github.com/home-assistant/hassio-addons/tree/master/tellstick
@endor-force Thanks! What's the base image used for hassio addions?
@torarnv Alpine Linux
@endor-force yeah nice idea. You can make a PR :+1:
Thanks guys!
On Mon, Dec 4, 2017 at 12:30 PM, Pascal Vizeli notifications@github.com
wrote:
@endor-force https://github.com/endor-force yeah nice idea. You can
make a PR 👍—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/home-assistant/hassio/issues/247#issuecomment-348936009,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAAdcLor1n3l_ihFrXK8T3hrt7xP6F0_ks5s89fygaJpZM4QYNAi
.
@endor-force @pvizeli Are you running the addon container with privileged: true? I haven't found any other way to let telldusd find the tellstick device. Since it's using libftdi it seems to not have a way to just use a specific device mapped from /dev via --device
Updated tellstick add-on with addon_stdin support and some...
https://github.com/home-assistant/hassio-addons/pull/206
I do not get 0.59 when running update. It says 0.58.1 is the last version available. Is there something I do wrong or 0.59 was not released for hass.io?
Thanks
0.59.1 is currently only in dev branch for hass.io.
The live/master version.json still has 0.58.1 (https://github.com/home-assistant/hassio/blob/master/version.json)
I'm patiently waiting for the release as well =)
Thanks guys, successfully running tellcore-net in a separate container now on 0.60dev0
What's the process when changing tellstick.conf? In the past I've restarted telldusd to pick the changes up. Does telldusd have a way hot-reload changes to the configuration file? SIGHUP?
SIGUSR1/2? If so would be nice if tellcore-net was able to detect changes to tellstick.conf and do the hot-reload.
Otherwise, what's the right process? restart the container? Will tellcore-net handle that gracefully on the HA side?
I am closing this issue with reference to the implementation and support of TellStick in Hass.io via add-on and adjustment in the tellstick component in Home Assistant.
Add-on information:
https://home-assistant.io/addons/tellstick/
Big thanks to @pvizeli
It was a pleasure
Nice, thanks @pvizeli !
Especially cool that you can interact with tdtool via service commands!
One small feature request would be to have a service command (or way) to show raw events (nicely formatted if possible), so that you can sniff the house codes of existing switches. I know tdtool doesn't have that feature natively, but should be possible already with the existing tellstick component since its getting the events? Perhaps this is even possible now? 😄
tellcore_events --raw (part of telldus core) can be used to sniff the rf events
@torarnv I would like to run tellcore-net in a separate container too. Can you please explain how you did? :)
@patrikron Just combined the pieces from hass.io:
https://gist.github.com/torarnv/325ab844e6df069c328d965a371ed253
@torarnv Nice, thank you! Can you share your docker run command too?
When I'm trying to run I got:
telldusd daemon starting up
Connecting to TellStick (1781/C31) with serial A703AKFD
Disconnected TellStick (1781/C31) with serial A703AKFD
This is the relevant part of my docker-compose.yaml:
version: '3'
services:
tellstick:
build: tellstick
image: torarnv/tellstick:dev
container_name: tellstick
volumes:
- ./tellstick/tellstick.conf:/etc/tellstick.conf
- /etc/localtime:/etc/localtime:ro
privileged: true
@torarnv thank you, got it to work now.
I noticed the connection to tellstick component fails after I run hassio homeassistant restart. I need to do a hassio host reboot to recover it.
This is super annoying as it means I need a host reboot to apply changes in config which takes long time.
I guess this is a bug, right? Let me know if I should open a new issue for it.
This has been fixed, see https://github.com/pvizeli/tellcore-net/issues/2
I'm on version 0.60.0 and have this problem:
2017-12-31 15:36:52 ERROR (MainThread) [homeassistant.setup] Error during setup of component tellstick
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 193, in _async_setup_component
component.setup, hass, processed_config)
File "/usr/lib/python3.6/asyncio/futures.py", line 332, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
future.result()
File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.6/site-packages/homeassistant/components/tellstick.py", line 99, in setup
tellcore_devices = tellcore_lib.devices()
File "/usr/lib/python3.6/site-packages/tellcore/telldus.py", line 173, in devices
count = self.lib.tdGetNumberOfDevices()
File "/usr/lib/python3.6/site-packages/tellcore/library.py", line 257, in check_int_result
raise TelldusError(result)
tellcore.library.TelldusError: Could not connect to the Telldus Service (-6)
Anyone else with the same problem as me?
A lot of users report that it works on 0.60.0 but some have the same issue.
Discussed here: https://community.home-assistant.io/t/tellstick-addon-broken-after-0-60/36390/9
Oki, I cant get it to work, it's the same problem after reinstallation of everything. vanilla hass.io 0.60.0 still gives tellcore.library.TelldusError: Could not connect to the Telldus Service (-6)
I guess I will have to wait until this is solved in a coming release.
@Stuve20 what hardware are you running? Pi 2 or 3?
I'm on Pi 3.
Just tried to install hasbian, everything works with tellstick. Back to Hass.io and get the error =/
The exact same problem as:
https://community.home-assistant.io/t/tellstick-installation-on-hassio/23208/100
Add-on works and connects? and you have port and host set up in configuration.yaml?
yeah this in conf:
tellstick:
host: core-tellstick
port: [50800, 50801]
signal_repetitions: 3
switch:
and this I can see in add-on:
starting version 3.2.4
[Info] Initialize the tellstick configuration
[Info] Exposing sockets and loading service
[Info] Starting event listener
telldusd daemon starting up
Connecting to TellStick (1781/C31) with serial A70XXXX
I get invalid config and:
tellcore.library.TelldusError: Could not connect to the Telldus Service (-6)
I had to change the entry in configuration.yaml from
host: core-tellstick
to
host: 172.30.33.0
core-tellstick obviously isn't a hostname recognized from within the homeassistant docker container...
bash-4.4# ping core-tellstick
PING core-tellstick (83.233.56.217): 56 data bytes
Better solution should be to add an entry to the hosts file in homeassistant docker, pointing to the tellstick container, when installing the tellstick component.
THANKS! you are on to something! That DID work for me!!
The Tellstick errors related to internal DNS lookup that you've seen is resolved in hass.io 0.81, update your supervisor if it has not yet auto updated.. reboot and you can use core-tellstick again.
For anyone driving by 🚗:
I was seeing the same Could not connect to the Telldus Service (-6) error, both with HA and with tdtool --list-devices (after installing apt-get install telldus-core).
Turns out the DNS lookup inside the docker container was busted. Doing a nc tellstick-host 50800 resulted in tellstick-host: forward host lookup failed: Unknown server error : Resource temporarily unavailable, while the same using the IP worked fine (confirmed by the i-99s reply).
The name resolution issue was confirmed by running getent hosts tellstick-host, which returned nothing.
Once I instructed Docker for macOS to use the DNS server on my network that could resolve tellstick-host, everything works fine. I don't know why Docker for macOS doesn't take care of this automatically, it's the same nameserver defined in /etc/resolv.conf on the macOS host.
If changing the nameserver is not an option for you, try specifying the tellstick by IP instead.
Most helpful comment
I work on it now. I ping you @endor-force for tests. Is that okay for you?