[REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Moderator: leecollings
-
- Posts: 2
- Joined: Monday 25 December 2017 14:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Thanks, that worked.
I have the lights working in Domoticz now.
I have the lights working in Domoticz now.
-
- Posts: 21
- Joined: Sunday 10 January 2016 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.2
- Location: Netherlands
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
I was trying to install using the latest Domoticz beta (3.8153) and with this version the plugin does not work:
017-12-28 23:41:43.376 (Ikea Tradfri Hub) Connected successfully to: 192.168.2.108
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) Received 61 bytes of data:
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) 7b 22 73 74 61 74 75 73 22 3a 20 22 4f 6b 22 2c 20 22 61 63 {"status":."Ok",."ac
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) 74 69 6f 6e 22 3a 20 22 63 6c 69 65 6e 74 43 6f 6e 6e 65 63 tion":."clientConnec
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) 74 22 2c 20 22 76 65 72 73 69 6f 6e 22 3a 20 22 30 2e 35 22 t",."version":."0.5"
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. }
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) Calling message handler 'onMessage'.
2017-12-28 23:41:43.377 Error: (Ikea Tradfri Hub) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
with every message it complains about status and extra. After (a lot of) trial and error I tried it using the latest Domoticz stable and it then worked fine. Any tip on how to get it to run with the current beta?
017-12-28 23:41:43.376 (Ikea Tradfri Hub) Connected successfully to: 192.168.2.108
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) Received 61 bytes of data:
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) 7b 22 73 74 61 74 75 73 22 3a 20 22 4f 6b 22 2c 20 22 61 63 {"status":."Ok",."ac
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) 74 69 6f 6e 22 3a 20 22 63 6c 69 65 6e 74 43 6f 6e 6e 65 63 tion":."clientConnec
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) 74 22 2c 20 22 76 65 72 73 69 6f 6e 22 3a 20 22 30 2e 35 22 t",."version":."0.5"
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. }
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) Calling message handler 'onMessage'.
2017-12-28 23:41:43.377 Error: (Ikea Tradfri Hub) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
with every message it complains about status and extra. After (a lot of) trial and error I tried it using the latest Domoticz stable and it then worked fine. Any tip on how to get it to run with the current beta?
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
You have to match the branch of the plugin to the version of domoticz you're using. To use the latest beta, you need to use the development-branch of the plugin, while the master branch of the plugin works with the latest stable!rasper wrote: ↑Thursday 28 December 2017 23:43 I was trying to install using the latest Domoticz beta (3.8153) and with this version the plugin does not work:
017-12-28 23:41:43.376 (Ikea Tradfri Hub) Connected successfully to: 192.168.2.108
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) Received 61 bytes of data:
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) 7b 22 73 74 61 74 75 73 22 3a 20 22 4f 6b 22 2c 20 22 61 63 {"status":."Ok",."ac
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) 74 69 6f 6e 22 3a 20 22 63 6c 69 65 6e 74 43 6f 6e 6e 65 63 tion":."clientConnec
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) 74 22 2c 20 22 76 65 72 73 69 6f 6e 22 3a 20 22 30 2e 35 22 t",."version":."0.5"
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) 7d .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. }
2017-12-28 23:41:43.376 (Ikea Tradfri Hub) Calling message handler 'onMessage'.
2017-12-28 23:41:43.377 Error: (Ikea Tradfri Hub) 'onMessage' failed 'TypeError':'onMessage() missing 2 required positional arguments: 'Status' and 'Extra''.
with every message it complains about status and extra. After (a lot of) trial and error I tried it using the latest Domoticz stable and it then worked fine. Any tip on how to get it to run with the current beta?
Regards,
M
-
- Posts: 21
- Joined: Sunday 10 January 2016 22:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.2
- Location: Netherlands
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Thanks, my fault! This works fine. I had some issues with domoticz crashing at reboot with the plugin enabled. Now with the beta it seems resolved.
Keep up the good work, nice plugin!
Keep up the good work, nice plugin!
-
- Posts: 3
- Joined: Wednesday 22 June 2016 12:12
- Target OS: -
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Hi,
-- fixed --
User=pi
Group=pi
changed to
User=root
Group=root
-----
I've got a problem with switching the lights via Domoticz. I found out that when I enter the command "sudo twistd -n -y tradfri.tac" via the folder "/home/pi/domoticz/plugins/IKEA-Tradfri" in PuttY the lights respond in Domoticz (without sudo it doesnt work). When I close PuttY it stopped working. Might there be something wrong with my ikea-tradfri.service file?
This is how it looks like:
Thanks for any reply
Regards
Konijn
-- fixed --
User=pi
Group=pi
changed to
User=root
Group=root
-----
I've got a problem with switching the lights via Domoticz. I found out that when I enter the command "sudo twistd -n -y tradfri.tac" via the folder "/home/pi/domoticz/plugins/IKEA-Tradfri" in PuttY the lights respond in Domoticz (without sudo it doesnt work). When I close PuttY it stopped working. Might there be something wrong with my ikea-tradfri.service file?
This is how it looks like:
Code: Select all
[Unit]
Description=IKEA Tradfri COAP-adapter
[Service]
Type=simple
Environment=IKEA_HOME=/home/pi/domoticz/plugins/IKEA-Tradfri
ExecStart=/usr/local/bin/twistd --nodaemon \
--rundir=${IKEA_HOME} \
--pidfile=${IKEA_HOME}/twistd.pid \
--python=${IKEA_HOME}/tradfri.tac
User=pi
Group=pi
Restart=always
[Install]
WantedBy=multi-user.target
Regards
Konijn
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
If the adapter works while using root, there is something wrong with the permissions. Either make sure that "twistd -n -y tradfri.tac" works as the pi-user or change the User and Group in the services-file to root. I really would recommend the first approach, as running the adapter as root is not recommended.konijnenbips wrote: ↑Saturday 06 January 2018 16:00 Hi,
-- fixed --
User=pi
Group=pi
changed to
User=root
Group=root
-----
I've got a problem with switching the lights via Domoticz. I found out that when I enter the command "sudo twistd -n -y tradfri.tac" via the folder "/home/pi/domoticz/plugins/IKEA-Tradfri" in PuttY the lights respond in Domoticz (without sudo it doesnt work). When I close PuttY it stopped working. Might there be something wrong with my ikea-tradfri.service file?
This is how it looks like:
Thanks for any replyCode: Select all
[Unit] Description=IKEA Tradfri COAP-adapter [Service] Type=simple Environment=IKEA_HOME=/home/pi/domoticz/plugins/IKEA-Tradfri ExecStart=/usr/local/bin/twistd --nodaemon \ --rundir=${IKEA_HOME} \ --pidfile=${IKEA_HOME}/twistd.pid \ --python=${IKEA_HOME}/tradfri.tac User=pi Group=pi Restart=always [Install] WantedBy=multi-user.target
Regards
Konijn
If you could please try to run:
Code: Select all
$ twistd -n -y tradfri.tac
Regards,
M
-
- Posts: 3
- Joined: Wednesday 22 June 2016 12:12
- Target OS: -
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
moroen wrote: ↑Saturday 06 January 2018 20:24If the adapter works while using root, there is something wrong with the permissions. Either make sure that "twistd -n -y tradfri.tac" works as the pi-user or change the User and Group in the services-file to root. I really would recommend the first approach, as running the adapter as root is not recommended.konijnenbips wrote: ↑Saturday 06 January 2018 16:00 Hi,
-- fixed --
User=pi
Group=pi
changed to
User=root
Group=root
-----
I've got a problem with switching the lights via Domoticz. I found out that when I enter the command "sudo twistd -n -y tradfri.tac" via the folder "/home/pi/domoticz/plugins/IKEA-Tradfri" in PuttY the lights respond in Domoticz (without sudo it doesnt work). When I close PuttY it stopped working. Might there be something wrong with my ikea-tradfri.service file?
This is how it looks like:
Thanks for any replyCode: Select all
[Unit] Description=IKEA Tradfri COAP-adapter [Service] Type=simple Environment=IKEA_HOME=/home/pi/domoticz/plugins/IKEA-Tradfri ExecStart=/usr/local/bin/twistd --nodaemon \ --rundir=${IKEA_HOME} \ --pidfile=${IKEA_HOME}/twistd.pid \ --python=${IKEA_HOME}/tradfri.tac User=pi Group=pi Restart=always [Install] WantedBy=multi-user.target
Regards
Konijn
If you could please try to run:as the pi-user and post any messages or errors, and I'll see what I can do to help!Code: Select all
$ twistd -n -y tradfri.tac
Regards,
M
Thanks, appreciate the help.
This is what I get
Code: Select all
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ twistd -n -y tradfri.tac
2018-01-06T20:41:53+0100 [-] Loading tradfri.tac...
2018-01-06T20:42:01+0100 [-] Loaded.
2018-01-06T20:42:01+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 17.9.0 (/usr/bin/python3 3.5.3) starting up.
2018-01-06T20:42:01+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
2018-01-06T20:42:01+0100 [-] Failed to unlink PID file:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/twisted/scripts/twistd.py", line 25, in runApp
_SomeApplicationRunner(config).run()
File "/usr/local/lib/python3.5/dist-packages/twisted/application/app.py", line 384, in run
self.postApplication()
File "/usr/local/lib/python3.5/dist-packages/twisted/scripts/_twistd_unix.py", line 255, in postApplication
self.removePID(self.config['pidfile'])
File "/usr/local/lib/python3.5/dist-packages/twisted/scripts/_twistd_unix.py", line 282, in removePID
log.err(e, "Failed to unlink PID file:")
--- <exception caught here> ---
File "/usr/local/lib/python3.5/dist-packages/twisted/scripts/_twistd_unix.py", line 277, in removePID
os.unlink(pidfile)
builtins.FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid'
2018-01-06T20:42:01+0100 [stderr#error] Traceback (most recent call last):
2018-01-06T20:42:01+0100 [stderr#error] File "/usr/local/bin/twistd", line 11,in <module>
2018-01-06T20:42:01+0100 [stderr#error] sys.exit(run())
2018-01-06T20:42:01+0100 [stderr#error] File "/usr/local/lib/python3.5/dist-packages/twisted/scripts/twistd.py", line 29, in run
2018-01-06T20:42:01+0100 [stderr#error] app.run(runApp, ServerOptions)
2018-01-06T20:42:01+0100 [stderr#error] File "/usr/local/lib/python3.5/dist-packages/twisted/application/app.py", line 662, in run
2018-01-06T20:42:01+0100 [stderr#error] runApp(config)
2018-01-06T20:42:01+0100 [stderr#error] File "/usr/local/lib/python3.5/dist-packages/twisted/scripts/twistd.py", line 25, in runApp
2018-01-06T20:42:01+0100 [stderr#error] _SomeApplicationRunner(config).run()
2018-01-06T20:42:01+0100 [stderr#error] File "/usr/local/lib/python3.5/dist-packages/twisted/application/app.py", line 384, in run
2018-01-06T20:42:01+0100 [stderr#error] self.postApplication()
2018-01-06T20:42:01+0100 [stderr#error] File "/usr/local/lib/python3.5/dist-packages/twisted/scripts/_twistd_unix.py", line 248, in postApplication
2018-01-06T20:42:01+0100 [stderr#error] self.startApplication(self.application)
2018-01-06T20:42:01+0100 [stderr#error] File "/usr/local/lib/python3.5/dist-packages/twisted/scripts/_twistd_unix.py", line 433, in startApplication
2018-01-06T20:42:01+0100 [stderr#error] self.config['pidfile'])
2018-01-06T20:42:01+0100 [stderr#error] File "/usr/local/lib/python3.5/dist-packages/twisted/scripts/_twistd_unix.py", line 324, in setupEnvironment
2018-01-06T20:42:01+0100 [stderr#error] with open(pidfile, 'wb') as f:
2018-01-06T20:42:01+0100 [stderr#error] PermissionError: [Errno 13] Permission denied: '/home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid'
-
- Posts: 23
- Joined: Monday 04 July 2016 23:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.8805
- Location: Netherlands
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Great plugin, but I've got one problem and don't know where to begin with debugging.
I run Domoticz version 3.8153 on a Raspberry Pi 3 running Raspbian Jessie 8.0
Installed the plugin according to the Readme.md and got everything running.
After some time (sometimes minutes, sometimes hours) Domoticz is Offline.
The only way to get it back up again is renaming the plugin directory /home/pi/domoticz/plugins/IKEA-Tradfri and rebooting the Pi.
Then Domoticz is running again (whithout Tradfri of course).
I can get Tradfri running again but it will set Domoticz offline again.
Without the Tradfri plugin Domoticz will stay online without a problem.
Does anybody have an idea how to debug this problem?
Thanks in advance.
I run Domoticz version 3.8153 on a Raspberry Pi 3 running Raspbian Jessie 8.0
Installed the plugin according to the Readme.md and got everything running.
After some time (sometimes minutes, sometimes hours) Domoticz is Offline.
The only way to get it back up again is renaming the plugin directory /home/pi/domoticz/plugins/IKEA-Tradfri and rebooting the Pi.
Then Domoticz is running again (whithout Tradfri of course).
I can get Tradfri running again but it will set Domoticz offline again.
Without the Tradfri plugin Domoticz will stay online without a problem.
Does anybody have an idea how to debug this problem?
Thanks in advance.
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Are you using the latest stable or a later beta? The latest stable has a few stability problems when using python, including segmentations faults that kills domoticz, the later betas works much better in this regard, but betas after 18. december 2017 have a problem with timers not triggering, and I don't think this has been fixed yet. I'm currently running 3.8793, triggers working and domoticz running without problems...Toolman wrote: ↑Saturday 06 January 2018 22:04 Great plugin, but I've got one problem and don't know where to begin with debugging.
I run Domoticz version 3.8153 on a Raspberry Pi 3 running Raspbian Jessie 8.0
Installed the plugin according to the Readme.md and got everything running.
After some time (sometimes minutes, sometimes hours) Domoticz is Offline.
The only way to get it back up again is renaming the plugin directory /home/pi/domoticz/plugins/IKEA-Tradfri and rebooting the Pi.
Then Domoticz is running again (whithout Tradfri of course).
I can get Tradfri running again but it will set Domoticz offline again.
Without the Tradfri plugin Domoticz will stay online without a problem.
Does anybody have an idea how to debug this problem?
Thanks in advance.
Regards,
M
Last edited by moroen on Saturday 06 January 2018 23:23, edited 1 time in total.
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Ok, so it's probably a stale pid-file being owned by root.konijnenbips wrote: ↑Saturday 06 January 2018 20:42moroen wrote: ↑Saturday 06 January 2018 20:24 If you could please try to run:as the pi-user and post any messages or errors, and I'll see what I can do to help!Code: Select all
$ twistd -n -y tradfri.tac
Regards,
M
Thanks, appreciate the help.
This is what I get
Code: Select all
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ twistd -n -y tradfri.tac ... 2018-01-06T20:42:01+0100 [stderr#error] PermissionError: [Errno 13] Permission denied: '/home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid'
First, you need to delete the pid-file:
Code: Select all
$ sudo rm /home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid
Code: Select all
$ sudo chown -R pi.pi /home/pi/domoticz/plugins/IKEA-Tradfri/
Regards,
M
-
- Posts: 3
- Joined: Wednesday 22 June 2016 12:12
- Target OS: -
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Thanks, that did the trick. The twistd.pid file didn't exist, but I did the chown part and now it works like a charm. Thanks!moroen wrote: ↑Saturday 06 January 2018 23:18Ok, so it's probably a stale pid-file being owned by root.konijnenbips wrote: ↑Saturday 06 January 2018 20:42moroen wrote: ↑Saturday 06 January 2018 20:24 If you could please try to run:as the pi-user and post any messages or errors, and I'll see what I can do to help!Code: Select all
$ twistd -n -y tradfri.tac
Regards,
M
Thanks, appreciate the help.
This is what I get
Code: Select all
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri $ twistd -n -y tradfri.tac ... 2018-01-06T20:42:01+0100 [stderr#error] PermissionError: [Errno 13] Permission denied: '/home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid'
First, you need to delete the pid-file:and then you need to make sure that the /home/pi/domoticz/plugins/IKEA-Tradfri directory is writable by the pi-user (it already might be, since it's part of your home-directory, but just to make sure):Code: Select all
$ sudo rm /home/pi/domoticz/plugins/IKEA-Tradfri/twistd.pid
Then try running the adapter as the pi-user again, and let me know how it turns out!Code: Select all
$ sudo chown -R pi.pi /home/pi/domoticz/plugins/IKEA-Tradfri/
Regards,
M
-
- Posts: 40
- Joined: Sunday 07 January 2018 15:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Hello
I tried to install the IKEA Trafri plugin but I am facing some problems.
Everything seems to be up to date (fresh install).
Its running on a RPI Raspbian lite 4.9.59-v7+
Domoticz Version 3.8153
Python 2.7.13
I followed everything explained on GitHub and sudo'ed almost every commands.
give me nothing more than this
When I use
I have this messages, I understand that it is not connecting to the gateway but I can't understand why.
I tried to install the IKEA Trafri plugin but I am facing some problems.
Everything seems to be up to date (fresh install).
Its running on a RPI Raspbian lite 4.9.59-v7+
Domoticz Version 3.8153
Python 2.7.13
I followed everything explained on GitHub and sudo'ed almost every commands.
Code: Select all
sudo coap-client -m post -u "Client_identity" -k "XXXXXXXXXXXX" -e '{"9090":"IKEA01"}' "coaps://192.168.1.250:5684/15011/9063"
Code: Select all
v:1 t:CON c:POST i:cf08 {} [ ]
Code: Select all
sudo python3 tradfri.tac
Code: Select all
IKEA-tradfri COAP-adaptor version 0.5 started (command line)!
Connected from IPv4Address(TCP, '127.0.0.1', 55888)
Data received: b'{"groups": "False", "action": "setConfig", "observe": "True", "psk": "XXXXXXXXXXXX", "pollinterval": "30", "identity": "IKEA01", "gateway": "192.168.1.250"}'
Initializing gateway
Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/twisted/python/log.py", line 103, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/log.py", line 86, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/context.py", line 122, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python3.5/dist-packages/twisted/python/context.py", line 85, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/tcp.py", line 205, in doRead
return self._dataReceived(data)
File "/usr/local/lib/python3.5/dist-packages/twisted/internet/tcp.py", line 211, in _dataReceived
rval = self.protocol.dataReceived(data)
File "tradfri.tac", line 76, in dataReceived
self.factory.initGateway(self, command)
File "tradfri.tac", line 275, in initGateway
self.devices = self.api(self.api(self.gateway.get_devices()))
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 92, in request
return self._execute(api_commands)
File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 81, in _execute
raise RequestTimeout() from None
pytradfri.error.RequestTimeout:
Disconnected
Version: 2024.1
Build Hash: 5279c8261
Compile Date: 2024-01-01 12:59:22
dzVents Version: 3.1.8
Python Version: 3.9.2
Raspbian Bullseye
Raspberry3B+
RFLINK R48.4
Build Hash: 5279c8261
Compile Date: 2024-01-01 12:59:22
dzVents Version: 3.1.8
Python Version: 3.9.2
Raspbian Bullseye
Raspberry3B+
RFLINK R48.4
-
- Posts: 23
- Joined: Monday 04 July 2016 23:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.8805
- Location: Netherlands
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Thanks for the quick reply Moroen.moroen wrote: ↑Saturday 06 January 2018 23:09Are you using the latest stable or a later beta? The latest stable has a few stability problems when using python, including segmentations faults that kills domoticz, the later betas works much better in this regard, but betas after 18. december 2017 have a problem with timers not triggering, and I don't think this has been fixed yet. I'm currently running 3.8793, triggers working and domoticz running without problems...Toolman wrote: ↑Saturday 06 January 2018 22:04 Great plugin, but I've got one problem and don't know where to begin with debugging.
I run Domoticz version 3.8153 on a Raspberry Pi 3 running Raspbian Jessie 8.0
Installed the plugin according to the Readme.md and got everything running.
After some time (sometimes minutes, sometimes hours) Domoticz is Offline.
The only way to get it back up again is renaming the plugin directory /home/pi/domoticz/plugins/IKEA-Tradfri and rebooting the Pi.
Then Domoticz is running again (whithout Tradfri of course).
I can get Tradfri running again but it will set Domoticz offline again.
Without the Tradfri plugin Domoticz will stay online without a problem.
Does anybody have an idea how to debug this problem?
Thanks in advance.
Regards,
M
I was using the stable release 3.8153.
Now I've upgraded to the latest beta-release 3.8799
This gives me another chalenge: The Tradfri harware has disappeared and it isn't in the install dropdown anymore.
I'll have to figure out how to get it back. I'll keep you updated.
By the way: You were right about the timers not triggering.
Still a no show on the Hardware page
Last edited by Toolman on Tuesday 09 January 2018 23:46, edited 2 times in total.
-
- Posts: 40
- Joined: Sunday 07 January 2018 15:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
So it looks that I have a DHCP issue with the Tradfri gateway.redfirebrooks wrote: ↑Sunday 07 January 2018 15:47 Hello
I tried to install the IKEA Trafri plugin but I am facing some problems.
Everything seems to be up to date (fresh install).
Its running on a RPI Raspbian lite 4.9.59-v7+
Domoticz Version 3.8153
Python 2.7.13
I followed everything explained on GitHub and sudo'ed almost every commands.
give me nothing more than thisCode: Select all
sudo coap-client -m post -u "Client_identity" -k "XXXXXXXXXXXX" -e '{"9090":"IKEA01"}' "coaps://192.168.1.250:5684/15011/9063"
When I useCode: Select all
v:1 t:CON c:POST i:cf08 {} [ ]
I have this messages, I understand that it is not connecting to the gateway but I can't understand why.Code: Select all
sudo python3 tradfri.tac
Code: Select all
IKEA-tradfri COAP-adaptor version 0.5 started (command line)! Connected from IPv4Address(TCP, '127.0.0.1', 55888) Data received: b'{"groups": "False", "action": "setConfig", "observe": "True", "psk": "XXXXXXXXXXXX", "pollinterval": "30", "identity": "IKEA01", "gateway": "192.168.1.250"}' Initializing gateway Unhandled Error Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/twisted/python/log.py", line 103, in callWithLogger return callWithContext({"system": lp}, func, *args, **kw) File "/usr/local/lib/python3.5/dist-packages/twisted/python/log.py", line 86, in callWithContext return context.call({ILogContext: newCtx}, func, *args, **kw) File "/usr/local/lib/python3.5/dist-packages/twisted/python/context.py", line 122, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/usr/local/lib/python3.5/dist-packages/twisted/python/context.py", line 85, in callWithContext return func(*args,**kw) --- <exception caught here> --- File "/usr/local/lib/python3.5/dist-packages/twisted/internet/posixbase.py", line 614, in _doReadOrWrite why = selectable.doRead() File "/usr/local/lib/python3.5/dist-packages/twisted/internet/tcp.py", line 205, in doRead return self._dataReceived(data) File "/usr/local/lib/python3.5/dist-packages/twisted/internet/tcp.py", line 211, in _dataReceived rval = self.protocol.dataReceived(data) File "tradfri.tac", line 76, in dataReceived self.factory.initGateway(self, command) File "tradfri.tac", line 275, in initGateway self.devices = self.api(self.api(self.gateway.get_devices())) File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 92, in request return self._execute(api_commands) File "/usr/local/lib/python3.5/dist-packages/pytradfri/api/libcoap_api.py", line 81, in _execute raise RequestTimeout() from None pytradfri.error.RequestTimeout: Disconnected
My routeur is a livebox 4. I have fixed the IP address of the Tradfri gateway but for an unknown reason the gateway does not take it and stay on 169.254.xxx.xxx. I found a lot of similar issues.
Version: 2024.1
Build Hash: 5279c8261
Compile Date: 2024-01-01 12:59:22
dzVents Version: 3.1.8
Python Version: 3.9.2
Raspbian Bullseye
Raspberry3B+
RFLINK R48.4
Build Hash: 5279c8261
Compile Date: 2024-01-01 12:59:22
dzVents Version: 3.1.8
Python Version: 3.9.2
Raspbian Bullseye
Raspberry3B+
RFLINK R48.4
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
At the moment, a fixed IP is necessary, but your problem has prompted me to start looking into something I have been postponing for to long, automatic discovery using zeroconf. I'm doing initial testing now. No promises as to an ETA, but I'm on it...redfirebrooks wrote: ↑Sunday 07 January 2018 23:52 So it looks that I have a DHCP issue with the Tradfri gateway.
My routeur is a livebox 4. I have fixed the IP address of the Tradfri gateway but for an unknown reason the gateway does not take it and stay on 169.254.xxx.xxx. I found a lot of similar issues.
Regards,
M
-
- Posts: 23
- Joined: Monday 04 July 2016 23:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.8805
- Location: Netherlands
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
The problem lies in the fact that the service won't start anymore:Toolman wrote: ↑Sunday 07 January 2018 21:20 Thanks for the quick reply Moroen.
I was using the stable release 3.8153.
Now I've upgraded to the latest beta-release 3.8799
This gives me another chalenge: The Tradfri harware has disappeared and it isn't in the install dropdown anymore.
I'll have to figure out how to get it back. I'll keep you updated.
By the way: You were right about the timers not triggering.
Still a no show on the Hardware page
Code: Select all
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ sudo systemctl status -l ikea-tradfri.service
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/lib/systemd/system/ikea-tradfri.service; enabled)
Active: failed (Result: start-limit) since Wed 2018-01-10 00:23:53 CET; 2s ago
Process: 2509 ExecStart=/usr/local/bin/twistd --nodaemon --rundir=${IKEA_HOME} --pidfile=${IKEA_HOME}/twistd.pid --python=${IKEA_HOME}/tradfri.tac (code=exited, status=1/FAILURE)
Main PID: 2509 (code=exited, status=1/FAILURE)
Jan 10 00:23:52 raspberrypi systemd[1]: Unit ikea-tradfri.service entered failed state.
Jan 10 00:23:53 raspberrypi systemd[1]: ikea-tradfri.service holdoff time over, scheduling restart.
Jan 10 00:23:53 raspberrypi systemd[1]: Stopping IKEA Tradfri COAP-adapter...
Jan 10 00:23:53 raspberrypi systemd[1]: Starting IKEA Tradfri COAP-adapter...
Jan 10 00:23:53 raspberrypi systemd[1]: ikea-tradfri.service start request repeated too quickly, refusing to start.
Jan 10 00:23:53 raspberrypi systemd[1]: Failed to start IKEA Tradfri COAP-adapter.
Jan 10 00:23:53 raspberrypi systemd[1]: Unit ikea-tradfri.service entered failed state.
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
First check if there is a stale twistd.pid file in the plugin directory, if there is remove it. Also make sure that the plugin directory is writable by the user running the service. If this doesn't help, let me know!Toolman wrote: ↑Wednesday 10 January 2018 0:30The problem lies in the fact that the service won't start anymore:Toolman wrote: ↑Sunday 07 January 2018 21:20 Thanks for the quick reply Moroen.
I was using the stable release 3.8153.
Now I've upgraded to the latest beta-release 3.8799
This gives me another chalenge: The Tradfri harware has disappeared and it isn't in the install dropdown anymore.
I'll have to figure out how to get it back. I'll keep you updated.
By the way: You were right about the timers not triggering.
Still a no show on the Hardware pageNow I've got to find out why?Code: Select all
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ sudo systemctl status -l ikea-tradfri.service ● ikea-tradfri.service - IKEA Tradfri COAP-adapter Loaded: loaded (/lib/systemd/system/ikea-tradfri.service; enabled) Active: failed (Result: start-limit) since Wed 2018-01-10 00:23:53 CET; 2s ago Process: 2509 ExecStart=/usr/local/bin/twistd --nodaemon --rundir=${IKEA_HOME} --pidfile=${IKEA_HOME}/twistd.pid --python=${IKEA_HOME}/tradfri.tac (code=exited, status=1/FAILURE) Main PID: 2509 (code=exited, status=1/FAILURE) Jan 10 00:23:52 raspberrypi systemd[1]: Unit ikea-tradfri.service entered failed state. Jan 10 00:23:53 raspberrypi systemd[1]: ikea-tradfri.service holdoff time over, scheduling restart. Jan 10 00:23:53 raspberrypi systemd[1]: Stopping IKEA Tradfri COAP-adapter... Jan 10 00:23:53 raspberrypi systemd[1]: Starting IKEA Tradfri COAP-adapter... Jan 10 00:23:53 raspberrypi systemd[1]: ikea-tradfri.service start request repeated too quickly, refusing to start. Jan 10 00:23:53 raspberrypi systemd[1]: Failed to start IKEA Tradfri COAP-adapter. Jan 10 00:23:53 raspberrypi systemd[1]: Unit ikea-tradfri.service entered failed state.
Regards,
M
-
- Posts: 23
- Joined: Monday 04 July 2016 23:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.8805
- Location: Netherlands
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
To bad: This doesn't help. I had already removed the twistd.pid file and the user has enough rights to access/write the directory.
Strange thing is that it has worked before (before the update of the Domoticz version)
I must have knocked over something, somewhere but my knowledge of Linux is little.
After some googling I've found the logging
Code: Select all
-- Logs begin at Wed 2018-01-10 18:59:27 CET, end at Wed 2018-01-10 19:02:26 CET. --
Jan 10 18:59:35 raspberrypi twistd[643]: Unhandled Error
Jan 10 18:59:35 raspberrypi twistd[643]: Traceback (most recent call last):
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 662, in run
Jan 10 18:59:35 raspberrypi twistd[643]: runApp(config)
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/scripts/twistd.py", line 25, in runApp
Jan 10 18:59:35 raspberrypi twistd[643]: _SomeApplicationRunner(config).run()
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 380, in run
Jan 10 18:59:35 raspberrypi twistd[643]: self.application = self.createOrGetApplication()
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 445, in createOrGetApplica
Jan 10 18:59:35 raspberrypi twistd[643]: application = getApplication(self.config, passphrase)
Jan 10 18:59:35 raspberrypi twistd[643]: --- <exception caught here> ---
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/application/app.py", line 456, in getApplication
Jan 10 18:59:35 raspberrypi twistd[643]: application = service.loadApplication(filename, style, passphrase)
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/application/service.py", line 412, in loadApplicatio
Jan 10 18:59:35 raspberrypi twistd[643]: application = sob.loadValueFromFile(filename, 'application')
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/persisted/sob.py", line 177, in loadValueFromFile
Jan 10 18:59:35 raspberrypi twistd[643]: eval(codeObj, d, d)
Jan 10 18:59:35 raspberrypi twistd[643]: File "/home/pi/domoticz/plugins/IKEA-Tradfri/tradfri.tac", line 2, in <module>
Jan 10 18:59:35 raspberrypi twistd[643]: from twisted.internet import protocol, task, reactor, endpoints
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/internet/reactor.py", line 38, in <module>
Jan 10 18:59:35 raspberrypi twistd[643]: from twisted.internet import default
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/internet/default.py", line 56, in <module>
Jan 10 18:59:35 raspberrypi twistd[643]: install = _getInstallFunction(platform)
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/internet/default.py", line 44, in _getInstallFunctio
Jan 10 18:59:35 raspberrypi twistd[643]: from twisted.internet.epollreactor import install
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/internet/epollreactor.py", line 24, in <module>
Jan 10 18:59:35 raspberrypi twistd[643]: from twisted.internet import posixbase
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/internet/posixbase.py", line 18, in <module>
Jan 10 18:59:35 raspberrypi twistd[643]: from twisted.internet import error, udp, tcp
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/internet/tcp.py", line 28, in <module>
Jan 10 18:59:35 raspberrypi twistd[643]: from twisted.internet._newtls import (
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/internet/_newtls.py", line 21, in <module>
Jan 10 18:59:35 raspberrypi twistd[643]: from twisted.protocols.tls import TLSMemoryBIOFactory, TLSMemoryBIOProtocol
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/protocols/tls.py", line 63, in <module>
Jan 10 18:59:35 raspberrypi twistd[643]: from twisted.internet._sslverify import _setAcceptableProtocols
Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/internet/_sslverify.py", line 38, in <module>
Jan 10 18:59:35 raspberrypi twistd[643]: TLSVersion.TLSv1_1: SSL.OP_NO_TLSv1_1,
Jan 10 18:59:35 raspberrypi twistd[643]: exceptions.AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'
Jan 10 18:59:35 raspberrypi twistd[643]: Failed to load application: 'module' object has no attribute 'OP_NO_TLSv1_1'
-
- Posts: 408
- Joined: Sunday 15 January 2017 11:06
- Target OS: Linux
- Domoticz version: beta
- Location: Norway
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
You need to run the python3 version of twistd, from your log it appears you're running it with python2.7, and the tac-file uses python3 syntax...Toolman wrote: ↑Wednesday 10 January 2018 18:41To bad: This doesn't help. I had already removed the twistd.pid file and the user has enough rights to access/write the directory.
Strange thing is that it has worked before (before the update of the Domoticz version)
I must have knocked over something, somewhere but my knowledge of Linux is little.
After some googling I've found the loggingFirst I'll try to update twistedCode: Select all
--- Jan 10 18:59:35 raspberrypi twistd[643]: File "/usr/local/lib/python2.7/dist-packages/twisted/internet/_newtls.py", line 21, in <module>
Code: Select all
$ which twistd
/usr/local/bin/twistd
$ cat /usr/local/bin/twistd
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
...
This might do the trick:
Code: Select all
$ pip uninstall twisted
$ pip3 install twisted
Regards,
M
-
- Posts: 23
- Joined: Monday 04 July 2016 23:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.8805
- Location: Netherlands
- Contact:
Re: [REQUEST] Ikea Trådfri Gateway (smart lights hub controller) plugin?
Thanks M for the quick response. While you were typing this I already uninstalled twisted and re-installed it for python3moroen wrote: ↑Wednesday 10 January 2018 19:34 You need to make sure that the script runs python3
This might do the trick:Let me know how it works out!Code: Select all
$ pip uninstall twisted $ pip3 install twisted
Regards,
M
The service runs again !!
Code: Select all
pi@raspberrypi:~$ sudo systemctl status ikea-tradfri.service
● ikea-tradfri.service - IKEA Tradfri COAP-adapter
Loaded: loaded (/lib/systemd/system/ikea-tradfri.service; enabled)
Active: active (running) since Wed 2018-01-10 20:43:21 CET; 6min ago
Main PID: 376 (twistd)
CGroup: /system.slice/ikea-tradfri.service
└─376 /usr/bin/python3 /usr/local/bin/twistd --nodaemon --rundir=/...
Jan 10 20:43:21 raspberrypi systemd[1]: Started IKEA Tradfri COAP-adapter.
Jan 10 20:43:24 raspberrypi twistd[376]: 2018-01-10T20:43:24+0100 [-] Loadin....
Jan 10 20:43:24 raspberrypi twistd[376]: 2018-01-10T20:43:24+0100 [-] Loaded.
Jan 10 20:43:24 raspberrypi twistd[376]: 2018-01-10T20:43:24+0100 [twisted.s....
Jan 10 20:43:24 raspberrypi twistd[376]: 2018-01-10T20:43:24+0100 [twisted.s....
Jan 10 20:43:24 raspberrypi twistd[376]: 2018-01-10T20:43:24+0100 [-] Adapto...4
Jan 10 20:43:24 raspberrypi twistd[376]: 2018-01-10T20:43:24+0100 [builtins....>
Hint: Some lines were ellipsized, use -l to show in full.
Testing gives the following:
Code: Select all
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ python3 tradfri.tac
IKEA-tradfri COAP-adaptor version 0.5 started (command line)!
Couldn't listen on any:1234: [Errno 98] Address already in use.
Code: Select all
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ sudo systemctl stop ikea-tradfri
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ python3 tradfri.tac
IKEA-tradfri COAP-adaptor version 0.5 started (command line)!
Code: Select all
pi@raspberrypi:~/domoticz/plugins/IKEA-Tradfri$ /usr/local/bin/twistd -n -y tradfri.tac
2018-01-10T21:36:38+0100 [-] Loading tradfri.tac...
2018-01-10T21:36:39+0100 [-] Loaded.
2018-01-10T21:36:39+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] twistd 17.9.0 (/usr/bin/python3 3.4.2) starting up.
2018-01-10T21:36:39+0100 [twisted.scripts._twistd_unix.UnixAppLogger#info] reactor class: twisted.internet.epollreactor.EPollReactor.
2018-01-10T21:36:39+0100 [-] AdaptorFactory starting on 1234
2018-01-10T21:36:39+0100 [builtins.AdaptorFactory#info] Starting factory <AdaptorFactory object at 0x7602ba30>
Code: Select all
pi 390 1.2 2.2 25200 20956 ? Ss 21:50 0:02 /usr/bin/python3 /usr/local/bin/twistd --nodaemon --rundir=/home/pi/domoticz/plugins/IKEA-Tradfri --pidfile=/home/p
Who is online
Users browsing this forum: Bing [Bot] and 1 guest