Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"configured": "1",
"commFailure": "0",
"armedtripped": "1",
"lasttrip": "1561049427",
"tripped": "1",
"armed": "0",
"status": "0",
"state": -1,
"level": 0,
"comment": "",
},
{
"name": "Scene 1",
"altid": "5",
"id": DEVICE_SCENE_CONTROLLER_ID,
"category": CATEGORY_SCENE_CONTROLLER,
"subcategory": 0,
"room": 0,
"parent": 1,
"configured": "1",
"commFailure": "0",
"armedtripped": "1",
# "lasttrip": "1561049427",
"tripped": "1",
"armed": "0",
"status": "0",
"state": -1,
"active": 0,
"comment": "",
},
{
"name": "Alarm sensor 1",
vera_temp_units = (
self.vera_device.vera_controller.temperature_units)
if vera_temp_units == 'F':
self._temperature_units = TEMP_FAHRENHEIT
else:
self._temperature_units = TEMP_CELSIUS
elif self.vera_device.category == veraApi.CATEGORY_LIGHT_SENSOR:
self.current_value = self.vera_device.light
elif self.vera_device.category == veraApi.CATEGORY_UV_SENSOR:
self.current_value = self.vera_device.light
elif self.vera_device.category == veraApi.CATEGORY_HUMIDITY_SENSOR:
self.current_value = self.vera_device.humidity
elif self.vera_device.category == veraApi.CATEGORY_SCENE_CONTROLLER:
value = self.vera_device.get_last_scene_id(True)
time = self.vera_device.get_last_scene_time(True)
if time == self.last_changed_time:
self.current_value = None
else:
self.current_value = value
self.last_changed_time = time
elif self.vera_device.category == veraApi.CATEGORY_POWER_METER:
power = convert(self.vera_device.power, float, 0)
self.current_value = int(round(power, 0))
elif self.vera_device.is_trippable:
tripped = self.vera_device.is_tripped
self.current_value = 'Tripped' if tripped else 'Not Tripped'
else:
self.current_value = 'Unknown'
self.current_value = self.vera_device.temperature
vera_temp_units = self.vera_device.vera_controller.temperature_units
if vera_temp_units == "F":
self._temperature_units = TEMP_FAHRENHEIT
else:
self._temperature_units = TEMP_CELSIUS
elif self.vera_device.category == veraApi.CATEGORY_LIGHT_SENSOR:
self.current_value = self.vera_device.light
elif self.vera_device.category == veraApi.CATEGORY_UV_SENSOR:
self.current_value = self.vera_device.light
elif self.vera_device.category == veraApi.CATEGORY_HUMIDITY_SENSOR:
self.current_value = self.vera_device.humidity
elif self.vera_device.category == veraApi.CATEGORY_SCENE_CONTROLLER:
value = self.vera_device.get_last_scene_id(True)
time = self.vera_device.get_last_scene_time(True)
if time == self.last_changed_time:
self.current_value = None
else:
self.current_value = value
self.last_changed_time = time
elif self.vera_device.category == veraApi.CATEGORY_POWER_METER:
power = convert(self.vera_device.power, float, 0)
self.current_value = int(round(power, 0))
elif self.vera_device.is_trippable:
tripped = self.vera_device.is_tripped
self.current_value = "Tripped" if tripped else "Not Tripped"
else:
self.current_value = "Unknown"