-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[udf] Unlock Lua for user-defined functions
- Loading branch information
Showing
9 changed files
with
162 additions
and
6 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
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
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
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
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,28 @@ | ||
--[[ | ||
Forward OwnTracks low-battery warnings to ntfy. | ||
https://mqttwarn.readthedocs.io/en/latest/examples/owntracks-battery/readme.html | ||
--]] | ||
|
||
-- mqttwarn filter function, returning true if the message should be ignored. | ||
-- In this case, ignore all battery level telemetry values above a certain threshold. | ||
function owntracks_batteryfilter(topic, message) | ||
local ignore = true | ||
|
||
-- Decode inbound message. | ||
local data = json.decode(message) | ||
|
||
-- Evaluate filtering rule. | ||
if data ~= nil and data.batt ~= nil then | ||
ignore = tonumber(data.batt) > 20 | ||
end | ||
|
||
return ignore | ||
end | ||
|
||
-- Status message. | ||
print("Loaded Lua module.") | ||
|
||
-- Export symbols. | ||
return { | ||
owntracks_batteryfilter = owntracks_batteryfilter, | ||
} |
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
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
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
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