@@ -70,6 +70,7 @@ def testSensors(self):
70
70
71
71
def testSensorInfo (self ):
72
72
sensors = {'actuator' : {'description' : 'Digital Output' , 'device' : 'DigitalActuator' , 'args' : {'gpio' : 'GPIO' , 'invert' : False , 'channel' : 16 }, 'name' : 'test_actuator' },
73
+ 'light_switch' : {'description' : 'Light Switch' , 'device' : 'LightSwitch' , 'args' : {'gpio' : 'GPIO' , 'invert' : True , 'channel' : 15 }, 'name' : 'test_light_switch' },
73
74
'MCP3004' : {'description' : 'MCP3004' , 'device' : 'MCP3004' , 'args' : {'chip' : '0' }, 'name' : 'test_MCP3004' },
74
75
'distance' : {'description' : 'Analog Distance Sensor' , 'device' : 'DistanceSensor' , 'args' : {'adc' : 'test_MCP3004' , 'channel' : 0 }, 'name' : 'test_distance' }}
75
76
for sensor in sensors .values ():
@@ -78,6 +79,8 @@ def testSensorInfo(self):
78
79
#Test setting sensor values
79
80
self .setSensorValue (sensors ['actuator' ], 1 )
80
81
self .setSensorValue (sensors ['actuator' ], 0 )
82
+ self .setSensorValue (sensors ['light_switch' ], 1 )
83
+ self .setSensorValue (sensors ['light_switch' ], 0 )
81
84
#Test getting analog value
82
85
retrievedSensorInfo = next (obj for obj in SensorsClientTest .client .SensorsInfo () if obj ['name' ] == sensors ['distance' ]['name' ])
83
86
self .assertEqual (retrievedSensorInfo ['float' ], 0.0 )
0 commit comments