Hello
I want to use SiriApi8 with Homegenie.
I dont write Pyton.. can any one help me?
This is a Example from the developer for his Homeautomation.
from SiriAPI8.SiriAPI8.SiriAPI import *
2
3 ###############################################################################################
4 # This is the configuration I use with my self build home automation system #
5 # It uses a HTTP API to switch the light. The HTTP request is defined in the request function #
6 # Lamps are loaded using a json request and compared with the detected input #
7 ###############################################################################################
8
9 import urllib.request
10 import json
11
12 def request (url): #HTTP request
13 f = urllib.request.urlopen(url)
14 return(f.read().decode('utf-8'))
15
16 def licht_toggle(q, wildcards):
17 #Prozessverarbeitung
18 receivers = json.loads(request("
http://zimmer:2525/remote/list")) #JSON request
19 found = False
20 for id, val in enumerate(receivers):
21 if (receivers[val]['title'].lower() == wildcards[0]):
22 found = True
23 request("
http://zimmer:2525/remote/switch?id=" + str(val))
24
25
26 if (found == False):
27 print("Diese Lampe kenne ich nicht")
28 else:
29 print("Ich habe die gewuenschte Lampe umgeschaltet")
30
31
32 SiriAPI = SiriAPI("
[email protected]", "MyPassword")
33
34 SiriAPI.action.add([['schalte das', '*'], ['schalte die', '*'], ['schalte den', '*'], ['schalte das', '*'], ['schalte die', '*'], ['schalte den', '*'], ['schalte', '*'], ['schalte', '*']], licht_toggle)
35
36 print ("Version: " + SiriAPI.get_version())
37 SiriAPI.connect()
38 input("Press any key...\n")
39 SiriAPI.disconnect()
This is the link to siriapi8
https://github.com/HcDevel/SiriAPI8/wiki/Installation
Thx for Help