forked from smarthomeNG/smarthome
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#?#trigger_id:cycle = 60 | ||
""" | ||
Hallo Welt Beispiel | ||
""" | ||
if (logic.name == 'blockly_runner_trigger_id') and True: | ||
print('hallo Welt') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="sh_trigger_cycle" id="3zT_BRpIUrP{{LeKPosF" x="63" y="38"><field name="TRIG_CYCLE">60</field><field name="ACTIVE">TRUE</field><field name="COMMENT">Hallo Welt Beispiel</field><field name="NAME">trigger_id</field><statement name="DO"><block type="text_print" id="af!2:xRQuVIu(:oSOu?1"><value name="TEXT"><block type="text" id="?w(?_wHb-`l.WjS|])xw"><field name="TEXT">hallo Welt</field></block></value></block></statement></block></xml> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env python3 | ||
# logics/example_logging.py | ||
|
||
# Beispiel-Logik welche zeigt, wie Logeinträge verschiedener Levels in die Logdateien eingetragen werden. | ||
# | ||
# Dazu: | ||
# - Diese Logik triggern | ||
# - die Einträge in ../var/log/smarthome-warnings.log und ../var/log/smarthome-details.log prüfen | ||
|
||
logger.warning(f"Logik '{logic.name}' (filename '{logic.filename}') wurde getriggert (WARNING)") | ||
logger.notice(f"Logik '{logic.name}' (filename '{logic.filename}') wurde getriggert (NOTICE)") | ||
logger.info(f"Logik '{logic.name}' (filename '{logic.filename}') wurde getriggert (INFO)") | ||
logger.debug(f"Logik '{logic.name}' (filename '{logic.filename}') wurde getriggert (DEBUG)") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
# logics/example_persistance.py | ||
|
||
# Diese Beispiel-Logik zeigt, Variablen definiert werden müssen, um den Lauf einer Logik zu überdauern | ||
# | ||
# Dazu: | ||
# - Diese Logik triggern | ||
# - die Einträge in ../var/log/smarthome-details.log prüfen | ||
# | ||
# - Diese Logik erneut triggern | ||
# - die Einträge in ../var/log/smarthome-details.log prüfen | ||
|
||
if not hasattr(logic, 'mycounter'): | ||
logic.mycounter = 0 | ||
|
||
logic.mycounter += 1 | ||
|
||
logger.info("Logik '{}' (filename '{}'): mycounter = {}".format(logic.name, logic.filename, logic.mycounter)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# This file contains a logic for use with SmartHomeNG | ||
# | ||
# Name of the logic: example_logic.py | ||
# | ||
|
||
# This logic performs the following function(s): | ||
# | ||
# ... | ||
# | ||
|
||
# The following triggers should be defined in ../etc/logic.yaml: | ||
# | ||
# watch_item = <item1> | <item2> | ... | ||
# crontab = init = Init | ||
# cycle = 600 | ||
# | ||
|