def test_get_rooms_lights_empty(self, mock_request_get): mock_request_get.return_value = self.false_response({}) skill = SnipsHue("192.168.1.1", "username", [1, 2, 3, 4, 5]) result = skill._get_rooms_lights() self.assertTrue(mock_request_get.called)
def test_color_map(self, mock_get_rooms_lights): skill = SnipsHue("192.168.1.1", "username", ['1', '2', '3']) self.assertEqual(skill._get_hue_saturation('red'), {'hue': 2869, 'sat': 255}) self.assertEqual(skill._get_hue_saturation('blue'), {'hue': 44161, 'sat': 255}) self.assertEqual(skill._get_hue_saturation('green'), {'hue': 21845, 'sat': 255})
snipsorange.light_on_set("blue", 254, "chambre") if ((channel == 'france 2') or (channel == 'deux') or (channel == 'fr2') or (channel == 'chaine2')): snipsorange.light_on_set("red", 254, "chambre") if ((channel == 'france 3') or (channel == 'trois') or (channel == 'fr3') or (channel == 'chaine3')): snipsorange.light_on_set("green", 254, "chambre") if ((channel == 'canal') or (channel == 'c+') or (channel == 'canal plus') or (channel == 'quatre') or (channel == 'chaine4')): snipsorange.light_on_set("black", 254, "chambre") if ((channel == 'arte') or (channel == 'cinq') or (channel == 'chaine5')): snipsorange.light_on_set("yellow", 254, "chambre") if ((channel == 'm6') or (channel == 'six') or (channel == 'chaine6')): snipsorange.light_on_set("pink", 254, "chambre") else: snipsorange.light_on_set("white", 254, "chambre") current_session_id = intentMessage.session_id hermes.publish_end_session(current_session_id, result_sentence) if __name__ == "__main__": snipsorange = SnipsHue("192.168.1.84", "YFuLloeVWUTdSO8IJKZi2OYXZJKsEFPAfatS0Fq2") with Hermes("localhost:1883") as h: h.subscribe_intent("lightsTurnDown", subscribe_intent_callback) \ .start()