New Deluge Sensor Config

Just a note that the username / password part of the deluge sensor seems to be required rather than optional, so if it’s a default setup it’s like this:

  - platform: deluge
    host: 192.168.138.58
    username: "deluge"
    password: "deluge"
    monitored_variables:
      - 'current_status'
      - 'download_speed'
      - 'upload_speed'

And some group / customise stuff - as I can’t go 2 minutes without changing icons on anything I try :slight_smile:

Screenshot_20171104_172008

customize.yaml

sensor.deluge_down_speed:
  friendly_name: Deluge Download Speed
  icon: mdi:download-network  
sensor.deluge_up_speed:
  friendly_name: Deluge Upload Speed
  icon: mdi:upload-network
sensor.deluge_status:
  friendly_name: Deluge Status
  icon: mdi:water
switch.deluge:
  friendly_name: Paused / Active
  icon: mdi:play-pause

group.yaml

Deluge:
  view: yes
  entities:
  - group.deluge_sensors

Deluge Sensors:
  view: no
  entities:
  - sensor.deluge_down_speed
  - sensor.deluge_up_speed
  - sensor.deluge_status
  - switch.deluge

I’m not entirely sure the deluge_status is working right, or it’s being very schrodinger’s cat about things.

It hasn’t changed from ‘Up/Down’ since it’s been running, and Deluge is off now.

Thought maybe I could get this working after I found this post but mine still won’t work :confused: Any ideas? I don’t see any options in Deluge for a username… I have set a password though.

  - platform: deluge
    host: 192.168.0.111
    username: "deluge"
    password: "password"
    monitored_variables:
      - 'current_status'
      - 'download_speed'      
      - 'upload_speed'

I get this in the logs:

2017-11-04 16:39:24 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform deluge
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 170, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 352, in wait_for
    return fut.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/sensor/deluge.py", line 58, in setup_platform
    deluge_api.connect()
  File "/usr/lib/python3.6/site-packages/deluge_client/client.py", line 50, in connect
    self._socket.connect((self.host, self.port))
  File "/usr/lib/python3.6/ssl.py", line 1093, in connect
    self._real_connect(addr, False)
  File "/usr/lib/python3.6/ssl.py", line 1080, in _real_connect
    socket.connect(self, addr)
socket.timeout: timed out

Haven’t seen those errors.

Deluge keeps its access details in a file /.config/deluge/auth on mine, if checking there helps.

I appreciate the component & effort it must have taken - as the last time I looked at Deluge’s API it seemed so unfriendly.

Another thing, I had to restart Hass with Deluge running before Hass could see it.

Is this auth file found in the hass directory? Or somewhere else? And yes me too! I’ve been waiting for this one as I couldn’t get a Transmission webserver working on Windows while Deluge works just fine.

The Deluge web UI is running and I have restarted Hass, still nothing though, maybe I’ll try to reset the webui plugin and keep the default password.

I’ve my deluge running on a different machine running a regular ubuntu server.

It’s definetly an ‘auth’ file you’re looking for. I’ve had head-scratches with deluge’s access before, everything looked right but it wouldn’t connect remotely.

On the off-chance, have you tried with “deluge”, “deluge” ?

Okay… turns out maybe Deluge wasn’t even running lol but that doesn’t seem to have helped…

I can connect to “192.168.0.111:8112” on my other computer, so the webserver is running and is accessible from another computer from within my network. I haven’t tried the double deluge credentials but I suppose I may as well try. My password is definitely not deluge though.

Is your switch working? I can pause (Turn off the switch) but the switch stays stuck in the on position even though it pauses deluge. If I manually go in and set the state to off, I can toggle the switch and the downloads resume.

Also, my “deluge status” does update. It changes from “up/down” to “idle” when nothing is downloading or uploading.

I had the same issue. It was because I had an existing automation that was active against all switches. Try commenting out any automation and see if it works.

EDIT: actually maybe not, it’s stopped working again… hmm

I had this same issue and I had to add a user to my deluge auth file.
I added this line (username:password - change if you want):

deluge:deluge:10

This was on Windows and the auth file was located here: C:\Users\Server\AppData\Roaming\deluge

Once I did this I restarted Deluge then restarted HA - worked a treat.

Hope this helps.

1 Like

hi Bit-River

Could you please provide the complete code of the group as you did to Deluge - I also want it to be displayed as nicely as you have

Hi,

They’ll work as shown, just copy & paste each section into customize.yaml, and group.yaml respectively :slight_smile:

The deluge_status sensor is still not worth bothering with, and it looks like some of the optional settings are really mandatory, anyway here’s a working sensors.yaml example that will work with the customize & group settings:

  - platform: deluge
    host: 192.168.1.100
    port: 58846
    username: "deluge"
    password: "deluge"
    monitored_variables:
      - 'current_status'
      - 'download_speed'
      - 'upload_speed'

Change the host, username & password as needed, the port value is standard as are the monitored variables.

The deluge switch is here:

I’ve been thinking of volunteering to update the documentation, so I think I’ll start with this component. And double-check which parts are really mandatory and optional.

Cheers for the reminder :slight_smile:

Thanks for the answer - sorry it took me a long time to answer.

I tried what you said and have a problem - you can see in the attached code

2018-05-16 09:23:42 WARNING (MainThread) [homeassistant.components.switch] Setup of platform deluge is taking over 10 seconds.

2018-05-16 09:23:52 ERROR (MainThread) [homeassistant.components.switch] Error while setting up platform deluge
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py”, line 129, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File “/usr/lib/python3.6/asyncio/tasks.py”, line 358, in wait_for
return fut.result()
File “/usr/lib/python3.6/concurrent/futures/thread.py”, line 56, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/switch/deluge.py”, line 48, in setup_platform
deluge_api.connect()
File “/srv/homeassistant/lib/python3.6/site-packages/deluge_client/client.py”, line 63, in connect
self._connect()
File “/srv/homeassistant/lib/python3.6/site-packages/deluge_client/client.py”, line 77, in _connect
self._socket.connect((self.host, self.port))
File “/usr/lib/python3.6/ssl.py”, line 1100, in connect
self._real_connect(addr, False)
File “/usr/lib/python3.6/ssl.py”, line 1091, in _real_connect
self.do_handshake()
File “/usr/lib/python3.6/ssl.py”, line 1068, in do_handshake
self._sslobj.do_handshake()
File “/usr/lib/python3.6/ssl.py”, line 689, in do_handshake
self._sslobj.do_handshake()

Hi all,

Got it working once I modified the auth file.
deluge%20sensor

Was looking into this myself and found on the deluge support page all about authentication.

on linux based system (Im using a PI as a torrent box).

sudo nano .config/deluge/auth

add new line and add the following

deluge:deluge:10

or whatever user pass u choose.

save the file with CTRL+x , y ENTER.

deluge%20auth

reboot system and check the pi sensor on home assistant (reboot HA as well)

Check out my torrent server box tutorial.

GitHub
MY TORRENT MEDIA SERVER TUTORIAL

From Deluge Support

Authentication

The daemon looks at the file ​<config folder>/auth for doing authentication.

The format of this file is straightforward, each line contains a username:password:level tuple in plaintext.

There should always be a ‘localclient’ entry for use by the UIs running locally by your user.

Note: If you do not have an auth file in your config folder, first run the daemon to have it created for you.

Deluge 1.2.0 introduces different levels of authentication:

Level Name Level Value
None 0
Read Only 1
Normal 5
Admin 10

Note: In Deluge 1.3.3 authentication levels don’t do anything. In the future they will. In git master there is a multiuser option that makes use of authentication levels.

Example of an auth file:

localclient:a7bef72a890:10
andrew:password:10
user3:anotherpass:5

Example of adding a new user under Linux:

echo "username:password:level" &gt;&gt; ~/.config/deluge/auth

Info sourced from https://dev.deluge-torrent.org/wiki/UserGuide/Authentication

1 Like

I tried getting this to work however as I added a new user under the auth file however I am still getting errors. I am using unraid docker for home assistant and deluge. Any advice?

Tue Feb 26 2019 17:42:26 GMT-0500 (Eastern Standard Time)
Error while setting up platform deluge
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/sensor/deluge.py", line 57, in setup_platform
    deluge_api.connect()
  File "/usr/local/lib/python3.7/site-packages/deluge_client/client.py", line 63, in connect
    self._connect()
  File "/usr/local/lib/python3.7/site-packages/deluge_client/client.py", line 77, in _connect
    self._socket.connect((self.host, self.port))
  File "/usr/local/lib/python3.7/ssl.py", line 1150, in connect
    self._real_connect(addr, False)
  File "/usr/local/lib/python3.7/ssl.py", line 1141, in _real_connect
    self.do_handshake()
  File "/usr/local/lib/python3.7/ssl.py", line 1117, in do_handshake
    self._sslobj.do_handshake()
socket.timeout: _ssl.c:1039: The handshake operation timed out
1 Like

Any updates on that? I’m currently facing the same issue as grangemd - I set up a new user in deluge, I’m running it on port 8112.

Error while setting up platform deluge
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/deluge/sensor.py", line 50, in setup_platform
    deluge_api.connect()
  File "/usr/local/lib/python3.7/site-packages/deluge_client/client.py", line 78, in connect
    self._connect()
  File "/usr/local/lib/python3.7/site-packages/deluge_client/client.py", line 92, in _connect
    self._socket.connect((self.host, self.port))
  File "/usr/local/lib/python3.7/ssl.py", line 1172, in connect
    self._real_connect(addr, False)
  File "/usr/local/lib/python3.7/ssl.py", line 1163, in _real_connect
    self.do_handshake()
  File "/usr/local/lib/python3.7/ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
socket.timeout: _ssl.c:1059: The handshake operation timed out
sensor:
  - platform: deluge
    host: 192.168.178.xx
    port: 8112
    username: "deluge"
    password: "deluge"
    monitored_variables:
      - 'current_status'
      - 'download_speed'
      - 'upload_speed'

Did you ever get this working? I had it working a while ago, but decided to reformat my computer and after reinstalling Windows (and Deluge) I’m getting the same errors that you were.

Someone ever figured this out? i am facing the same issue. I try connecting to the deamon… remote is enabled in webinterface … I run deluge with vpn as docker image and port are exposed… my deamon config looks like this:

image

Wish I could say I’ve had some luck, but I haven’t. I’ve given up on it for now until I have time to figure it out, or find an alternative.

Thanks for your response… maybe the dev could throw an eye on it and explain exactly how to set this up as it seems docs are outdated/ wrong?

i think my problem was that my firewall was blocking the connection. try disabling firewall and restarting home assistant. maybe PC too.