Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
RESPONSE_SDATA = {
"scenes": [{"id": SCENE1_ID, "name": "scene1", "active": 0, "root": 0}],
"temperature": 23,
"categories": [
{"name": "Dimmable Switch", "id": CATEGORY_DIMMER},
{"name": "On/Off Switch", "id": CATEGORY_SWITCH},
{"name": "Sensor", "id": CATEGORY_ARMABLE},
{"name": "Generic IO", "id": CATEGORY_GENERIC},
{"name": "Temperature Sensor", "id": CATEGORY_TEMPERATURE_SENSOR},
{"name": "Lock", "id": CATEGORY_LOCK},
{"name": "Thermostat", "id": CATEGORY_THERMOSTAT},
{"name": "Light sensor", "id": CATEGORY_LIGHT_SENSOR},
{"name": "UV sensor", "id": CATEGORY_UV_SENSOR},
{"name": "Humidity sensor", "id": CATEGORY_HUMIDITY_SENSOR},
{"name": "Power meter", "id": CATEGORY_POWER_METER},
],
"devices": [
{
"name": "Ignore 1",
"altid": "6",
"id": DEVICE_IGNORE,
"category": CATEGORY_SWITCH,
"subcategory": 1,
"room": 0,
"parent": 1,
"armed": "0",
"armedtripped": "0",
"configured": "1",
"batterylevel": "100",
"commFailure": "0",
"lasttrip": "1571790666",
def unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
if self.vera_device.category == veraApi.CATEGORY_TEMPERATURE_SENSOR:
return self._temperature_units
if self.vera_device.category == veraApi.CATEGORY_LIGHT_SENSOR:
return "lx"
if self.vera_device.category == veraApi.CATEGORY_UV_SENSOR:
return "level"
if self.vera_device.category == veraApi.CATEGORY_HUMIDITY_SENSOR:
return "%"
if self.vera_device.category == veraApi.CATEGORY_POWER_METER:
return "watts"
def unit_of_measurement(self):
"""Return the unit of measurement of this entity, if any."""
import pyvera as veraApi
if self.vera_device.category == veraApi.CATEGORY_TEMPERATURE_SENSOR:
return self._temperature_units
if self.vera_device.category == veraApi.CATEGORY_LIGHT_SENSOR:
return 'lx'
if self.vera_device.category == veraApi.CATEGORY_UV_SENSOR:
return 'level'
if self.vera_device.category == veraApi.CATEGORY_HUMIDITY_SENSOR:
return '%'
if self.vera_device.category == veraApi.CATEGORY_POWER_METER:
return 'watts'