Merge pull request #11 from adafruit/tylerdcooper-patch-7

docs: data matching trigger block
This commit is contained in:
Loren Norman 2025-08-11 15:54:28 -04:00 committed by GitHub
commit 62869113ab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,22 +5,18 @@ export default {
name: "Data Matching",
colour: 30,
inputsInline: true,
description: "Run this Action when the specified Feed receives data that matches the specified condition.",
description: "The most common trigger type - runs your Action immediately whenever new data arrives at a feed that meets your specified condition. Perfect for real-time responses like 'send alert when temperature exceeds 85°F', 'turn on lights when motion detected', or 'notify me when battery drops below 20%'. This trigger fires every single time the condition is met.",
connections: {
mode: "statement",
output: "trigger",
next: "trigger"
},
mixins: ['replaceDropdownOptions'],
extensions: [ "populateFeedDropdown" ],
template: "When %FEED_KEY gets data matching: %MATCHER",
inputs: {
MATCHER: {
description: "Attach a Matcher block to compare against new Feed values",
description: "Define the condition that incoming data must meet to trigger this Action. Examples: 'equals 1' (for button presses), 'greater than 80' (for temperature alerts), 'contains \"motion\"' (for text matching), or 'any value' (triggers on every data point regardless of value).",
check: 'matcher',
shadow: {
type: 'matcher_compare',
@ -30,16 +26,14 @@ export default {
}
}
},
fields: {
FEED_KEY: {
description: "Select the Feed to watch for new data.",
description: "Choose which feed to monitor for new incoming data. Every time fresh data arrives at this feed, it will be tested against your matcher condition.",
options: [
[ "Loading Feeds...", ""]
]
}
},
generators: {
json: (block, generator) => {
const
@ -50,15 +44,12 @@ export default {
feed, matcher
}
})
return payload
}
},
regenerators: {
json: (blockObject, helpers) => {
const payload = blockObject.whenDataMatching
return {
type: "when_data_matching",
fields: {