-
Notifications
You must be signed in to change notification settings - Fork 11
/
PyRaumfeldSample.py
54 lines (41 loc) · 1.89 KB
/
PyRaumfeldSample.py
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
43
44
45
46
47
48
49
50
51
52
53
# -*- coding: utf-8 -*-
'''
Sample application for the Python library for controlling the Teufel Raumfeld system
@author: Patrick Maier
@contact: [email protected]
Webpage: https://github.com/maierp/pyraumfeld
Based on python-raumfeld by Thomas Feldmann:
https://github.com/tfeldmann/python-raumfeld
'''
import raumfeld
from time import gmtime, strftime
import logging
def dataHasBeenUpdated():
print(("########## " + strftime("%Y-%m-%d %H:%M:%S", gmtime()) + " ##########"))
print("Zones:")
for zone in raumfeld.getZones():
print(("UDN: " + zone.UDN + " Name: " + zone.Name + " Location: " + zone.Location))
for room in zone.getRooms():
print(("\tUDN: " + room.UDN + " Name: " + room.Name))
for renderer in room.getRenderers():
print(("\t\tUDN: " + renderer.UDN + " Name: " + renderer.Name + " Location: " + renderer.Location + " Volume: " + str(renderer.volume)))
print("Unassigned Rooms:")
for room in raumfeld.getUnassignedRooms():
print(("Name: " + room.Name + " UDN: " + room.UDN))
for renderer in room.getRenderers():
print(("\tUDN: " + renderer.UDN + " Name: " + renderer.Name + " Location: " + renderer.Location))
print("########## This gets updated when the config changes. To QUIT press any key... ##########")
#kueche = raumfeld.getRoomsByName(u'Küche')[0]
#kuecheZone = raumfeld.getZoneWithRoomName(u'Wohnzimmer')[0]
#status = kuecheZone.mute
#print("Mute: {0}".format(status))
#kueche.mute = not status
#kuecheZone.play()
#print("Volume: {0}".format(kuecheZone.volume))
#raumfeld.connectRoomToZone(kueche.UDN)
raumfeld.setLogging(logging.WARN);
raumfeld.registerChangeCallback(dataHasBeenUpdated)
raumfeld.init() # or with the host IP: raumfeld.init("192.168.0.10")
print(("Host URL: " +raumfeld.hostBaseURL))
# To QUIT press any key...
input()