diff --git a/configs.py b/configs.py
index 60b75ef..9e89770 100644
--- a/configs.py
+++ b/configs.py
@@ -1,20 +1,21 @@
-configs = {
- 'country': 'AT',
- 'ntp_host': 'pool.ntp.org',
- 'gmt_offset': 1,
- 'auto_summertime': True,
- 'disable_wifi_powersavingmode': True,
- 'api_port': 80,
- 'hostname': 'tcs2fhem',
- 'displayoff': 5,
- 'log_incoming_bus_messages': True,
- 'log_housekeeping_days': 7,
- 'frontdoor_ringing_message': [1, 2, 2, 0, 0, 1],
- 'door_ringing_message': [1, 2, 2, 0, 0, 2],
- 'door_trigger_message': [1, 2, 2, 0],
- 'light_trigger_message': [1, 2, 2, 1],
- 'tcs_message': [1, 2, 2, 0, 1],
- 'api_client_ip': '10.0.3.5',
- 'fhem_door_ringed': 'http://fhem-server:8086/fhem?cmd=set%20TCS_Door%20ringed&XHR=1',
- 'fhem_frontdoor_ringed': 'http://fhem-server:8086/fhem?cmd=set%20TCS_FrontDoor%20ringed&XHR=1',
+configs = {
+ 'country': 'AT',
+ 'ntp_host': 'pool.ntp.org',
+ 'gmt_offset': 1,
+ 'auto_summertime': True,
+ 'disable_wifi_powersavingmode': True,
+ 'api_port': 80,
+ 'hostname': 'tcs2fhem',
+ 'displayoff': 5,
+ 'log_incoming_bus_messages': True,
+ 'log_housekeeping_days': 7,
+ 'frontdoor_ringing_message': [1, 2, 2, 0, 0, 1],
+ 'door_ringing_message': [1, 2, 2, 0, 0, 2],
+ 'door_trigger_message': [1, 2, 2, 0],
+ 'light_trigger_message': [1, 2, 2, 1],
+ 'tcs_message': [1, 2, 2, 0, 1],
+ 'api_client_ip': '10.0.3.5',
+ 'fhem_door_ringed': 'http://fhem-server:8086/fhem?cmd=set%20TCS_Door%20ringed&XHR=1',
+ 'fhem_frontdoor_ringed': 'http://fhem-server:8086/fhem?cmd=set%20TCS_FrontDoor%20ringed&XHR=1',
+ 'fhem_special_command': 'http://fhem-server:8086/fhem?cmd=set%20VZ_Tuerschloss%20unlock&XHR=1',
}
\ No newline at end of file
diff --git a/main.py b/main.py
index 91ace34..8fbb2e5 100644
--- a/main.py
+++ b/main.py
@@ -255,34 +255,37 @@ async def APIHandling(reader, writer):
if (req[2] == "triggerdoor"):
Logger.LogMessage("Triggering Door")
await TCSBusWriter(configs['door_trigger_message'])
- stateis = "Triggered front door opener"
+ stateis = "Triggered: front door opener"
elif (req[2] == "triggerlight"):
Logger.LogMessage("Triggering Licht")
await TCSBusWriter(configs['light_trigger_message'])
- stateis = "Triggered light"
+ stateis = "Triggered: light"
elif (req[2] == "togglepartymode"):
TogglePartyMode()
- stateis = "Toggled Party-Mode"
+ stateis = "Toggled: Party-Mode"
elif (req[2] == "partymodeon"):
SetPartyMode(True)
- stateis = "Enabled Party-Mode"
+ stateis = "Enabled: Party-Mode"
elif (req[2] == "partymodeoff"):
SetPartyMode(False)
- stateis = "Disabled Party-Mode"
+ stateis = "Disabled: Party-Mode"
elif (req[2] == "partymodestate"):
stateis = "Party-Mode is " + PartyModeState()
elif (req[2] == "ping"):
- stateis = "OK"
+ stateis = "Ping: OK"
+ elif (req[2] == "specialcommand"):
+ ExternalAPI("special")
+ stateis = "Special command: executed"
elif (req[2] == "stats"):
stateis = "IP address: " + Networking.GetIPAddress() + "
MAC address: " + Networking.GetMACAddress() + "
Hostname: " + configs['hostname'] + "
API Port: " + str(configs['api_port']) + "
Uptime (h:m): " + Uptime() + "
Date/Time: " + TimeUtils.DateTimeNow() + "
Version: " + version + "
GMT Timezone Offset (hours): " + str(configs['gmt_offset']) + "
Auto summertime: " + str(configs['auto_summertime']) + "
Display off time (mins): " + str(configs['displayoff']) + "
Log incoming bus messages: " + str(configs['log_incoming_bus_messages']) + "
Housekeep logfiles after days: " + str(configs['log_housekeeping_days']) + "
Message 'Front door ringing': " + str(configs['frontdoor_ringing_message']) + "
Message 'Door ringing': " + str(configs['door_ringing_message']) + "
Message 'Door opener triggered': " + str(configs['door_trigger_message']) + "
Message 'Light triggered': " + str(configs['light_trigger_message']) + "
CPU frequency (MHz): " + str(machine.freq()/1000000) + "
Party-Mode is: " + PartyModeState()
elif (req[2] == "reboot"):
- stateis = "Rebooting device now..."
+ stateis = "Rebooting device: now..."
Reboot()
elif (req[2] == "ringdoor"):
- stateis = "Ringing doorbell"
+ stateis = "Ringing: doorbell"
await TCSBusWriter(configs['door_ringing_message'])
elif (req[2] == "ringfrontdoor"):
- stateis = "Ringing front doorbell"
+ stateis = "Ringing: front doorbell"
await TCSBusWriter(configs['frontdoor_ringing_message'])
elif (req[2] == "logs"):
if (len(req) >= 4 and req[3] != "json"):
@@ -431,6 +434,12 @@ async def ExternalAPI(action):
response.close()
else:
Logger.LogMessage("Warning: No fhem_frontdoor_ringed setting!")
+ elif (action == "special"):
+ if (configs['fhem_special_command'] is not ""):
+ response = requests.get(configs['fhem_special_command'])
+ response.close()
+ else:
+ Logger.LogMessage("Warning: No fhem_special_command setting!")
else:
Logger.LogMessage("Error: Unknown ExternalAPI action!")
pass