I'm currently trying to use the new matcher but having some problems. For every activ rule I get:
< error: Could not parse rule "if Push Test is pressed then push title:"push" message:"test" priority:0": Error executing a action handler: predicate is not defined, Could not find an action handler for: push title:"push" message:"test" priority:0
< debug: Error: Error executing a action handler: predicate is not defined, Could not find an action handler for: push title:"push" message:"test" priority:0
< at RuleManager.addRuleByString.parseRuleString.then.rule (/Users/thex/dev-pimatic/node_modules/pimatic/lib/rules.coffee:340:5)
< at _fulfilled (/Users/thex/dev-pimatic/node_modules/pimatic/node_modules/q/q.js:798:54)
< at Promise.then.self.promiseDispatch.done (/Users/thex/dev-pimatic/node_modules/pimatic/node_modules/q/q.js:827:30)
< at Promise.promise.promiseDispatch (/Users/thex/dev-pimatic/node_modules/pimatic/node_modules/q/q.js:760:13)
< at messages (/Users/thex/dev-pimatic/node_modules/pimatic/node_modules/q/q.js:574:44)
< at flush (/Users/thex/dev-pimatic/node_modules/pimatic/node_modules/q/q.js:108:17)
< at process._tickCallback (node.js:415:13)
< at [object Object].Module.runMain [as _onTimeout] (module.js:499:11)
< at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
matchCount = 0
title_content = null
message_content = null
priority_content = null
setTitle = (m, t) => title_content = t
setMessage = (m, mc) => message_content = mc
setPriority = (m, p) => priority_content = p
M(predicate, context)
.match('send ', optional: yes)
.match(['push ','pushover ','notification '])
.match('tile:', optional: yes)
.matchString(optional: yes, setTitle)
.match('message:')
.matchString(setMessage)
.match('priority:', optional: yes)
.matchNumber(optional: yes, setPriority)
.onEnd( => matchCount++)
if matchCount is 1
env.logger.debug "executeAction: we have matches, simulate:#{simulate}"
if simulate
return Q.fcall ->
env.logger.debug "executeAction: we simulate the action"
else
if !message_content
message_content = @config.title
if !title_content
title_content = @config.message
default_url_title = @configurl_title
default_url = @config.url
default_priority = @config.priority
default_sound = @config.sound
default_device = @config.device
return Q.fcall ->
msg =
message: message_content
title: title_content
sound: default_sound
priority: priority_content
env.logger.debug "executeAction: we send the message"
return Q.ninvoke(pushover_instance, "send", msg).then(->
Q.fcall env.logger.info "pusover message sent successfully")
else if matchCount > 1
context.addError(""""#{actionString.trim()}" is ambiguous.""")