Adding Queue count sensor (#10723)
Adding another sensor to output the numeber of items in the SABnabd queue. This is an alternative to displaying filesize, just a preference thing, as it is more meaningfull for me the way I use SABnzdb. Note this is my first time coding on github and I have no idea if I am doing things right, I assume that all I needed to do is add a couple of lines to the sensors available and also another line as to what to extract from the SABnzdb API, in this case I have called the sensor "queue_count" and it gets the value from the noofslots_total which as I understand - each slot is a separate download item. hope I did this correctly - also I don't have a separate instance of home assistant running for testing so I have no way to test this code (and I don't know how I would switch to the dev channel either). As I said I am a newb!
This commit is contained in:
parent
d0296561f6
commit
5dbd554a10
1 changed files with 3 additions and 0 deletions
|
@ -40,6 +40,7 @@ SENSOR_TYPES = {
|
|||
'queue_remaining': ['Left', 'MB'],
|
||||
'disk_size': ['Disk', 'GB'],
|
||||
'disk_free': ['Disk Free', 'GB'],
|
||||
'queue_count': ['Queue Count', None],
|
||||
}
|
||||
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
|
||||
|
@ -211,5 +212,7 @@ class SabnzbdSensor(Entity):
|
|||
self._state = self.sabnzb_client.queue.get('diskspacetotal1')
|
||||
elif self.type == 'disk_free':
|
||||
self._state = self.sabnzb_client.queue.get('diskspace1')
|
||||
elif self.type == 'queue_count':
|
||||
self._state = self.sabnzb_client.queue.get('noofslots_total')
|
||||
else:
|
||||
self._state = 'Unknown'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue