GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — SiriAPI8/my-personal-example.py at master · RobinMeis/SiriAPI8

Expand file tree

/

my-personal-example.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
42 lines (31 loc) · 1.54 KB
/

my-personal-example.py

Copy path

File metadata and controls

42 lines (31 loc) · 1.54 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from SiriAPI8.SiriAPI8.SiriAPI import *
###############################################################################################
# This is the configuration I use with my self build home automation system #
# It uses a HTTP API to switch the light. The HTTP request is defined in the request function #
# Lamps are loaded using a json request and compared with the detected input #
###############################################################################################
import urllib.request
import json
def request (url): #HTTP request
f = urllib.request.urlopen(url)
return(f.read().decode('utf-8'))
def licht_toggle(q, wildcards):
#Prozessverarbeitung
receivers = json.loads(request("http://zimmer:2525/remote/list")) #JSON request
found = False
for id, val in enumerate(receivers):
if (receivers[val]['title'].lower() == wildcards[0]):
found = True
request("http://zimmer:2525/remote/switch?id=" + str(val))
if (found == False):
print("Diese Lampe kenne ich nicht")
else:
print("Ich habe die gewuenschte Lampe umgeschaltet")
SiriAPI = SiriAPI("[email protected]", "MyPassword")
SiriAPI.action.add([['schalte das', '*'], ['schalte die', '*'], ['schalte den', '*'], ['schalte das', '*'], ['schalte die', '*'], ['schalte den', '*'], ['schalte', '*'], ['schalte', '*']], licht_toggle)
print ("Version: " + SiriAPI.get_version())
SiriAPI.connect()
input("Press any key...\n")
SiriAPI.disconnect()
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.