Bump pysyncthru to 0.7.0 (#38832)

* Bump pysyncthru version to 0.7.0

This change includes a heavier refactoring, using a more reliable source for the device status and parsing display strings only for additional details

* Fix test flow to ensure a status is set
This commit is contained in:
Niels Mündler 2020-08-14 03:48:26 +02:00 committed by GitHub
parent 72472cd11f
commit fceba0bb88
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 6 deletions

View file

@ -2,7 +2,7 @@
import logging
from pysyncthru import SyncThru
from pysyncthru import SYNCTHRU_STATE_HUMAN, SyncThru
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
@ -101,7 +101,7 @@ class SyncThruSensor(Entity):
def __init__(self, syncthru, name):
"""Initialize the sensor."""
self.syncthru = syncthru
self.syncthru: SyncThru = syncthru
self._attributes = {}
self._state = None
self._name = name
@ -164,7 +164,8 @@ class SyncThruMainSensor(SyncThruSensor):
self.syncthru.url,
)
self._active = False
self._state = self.syncthru.device_status()
self._state = SYNCTHRU_STATE_HUMAN[self.syncthru.device_status()]
self._attributes = {"display_text": self.syncthru.device_status_details()}
class SyncThruTonerSensor(SyncThruSensor):