diff --git a/README.md b/README.md index b21c4e12..24a959e3 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,20 @@ from simplipy.api import SimpliSafeApiInterface simplisafe = SimpliSafeApiInterface("USERNAME", "PASSWORD") - for system in simplisafe.get_systems(): - print(system.state) - print(str(simplisafe.sensors)) + print("Location ID: " + str(system.location_id)) + print("System version: " + str(system.version)) + print("System state: " + str(system.state)) + print("Alarming: " + str(system.alarm_active)) + print("Temperature: " + str(system.temperature)) + print("Sensors:") for sensor in system.get_sensors(): - print(sensor.name) - print("\t" + str(sensor.status)) + print("\t" + sensor.name()) + print("\t\tType: " + str(sensor.type)) + print("\t\tSerial: " + str(sensor.serial())) + print("\t\tData: " + str(sensor.data())) + print("\t\tStatus: " + str(sensor.status())) + print("\t\tBattery Ok: " + str(sensor.battery())) + print("\t\tOffline: " + str(sensor.offline())) + print("\t\tError: " + str(sensor.error())) ``` diff --git a/src/simplipy/sensor.py b/src/simplipy/sensor.py index 176e3405..df51fc11 100644 --- a/src/simplipy/sensor.py +++ b/src/simplipy/sensor.py @@ -48,7 +48,7 @@ def status(self): def battery(self): """Return the battery status of the sensor.""" if self.version != 3: - return self.sensor_dict["battery"] + return self.sensor_dict.get("battery") == "ok" return self._get_dict_values(["flags", "lowBattery"], False) def data(self): diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..6deafc26 --- /dev/null +++ b/tox.ini @@ -0,0 +1,2 @@ +[flake8] +max-line-length = 120