Pushover action: Syntax

I’m just testing pushover (OH2) and it works fine:

	pushover("Waschmaschine ist gerade fertig geworden!")

But I’d like to change the title, priority, devices and sound individually per rule/action I use pushover. It seems, that if I’m adding more arguments, pushover-action expects me to put in my UserKey and TokenKey in each and every command? is that right? I didn’t find a Wikipage except this one:

I’m in utter confusion! There seems to be a logic in place, I don’t get.
e.g.: I’m using four Arguments, which one is it then:

  • pushover(String message, int priority, String url, String urlTitle) or
  • pushover(String apiToken, String userKey, String message, String device)

If I use more than one Argument, I get this Errors in my openhab.log:

2017-02-17 16:00:48.479 [WARN ] [org.openhab.io.net.http.HttpUtil    ] - Method failed: HTTP/1.1 400 Bad Request
2017-02-17 16:00:48.491 [ERROR] [ab.action.pushover.internal.Pushover] - Received error message from Pushover: application token is invalid

How do I configure my pushover.cfg AND how do I call pushover() in a rule to have:

  • specific title
  • specific message
  • specific priority
  • specific sound

on each action/rule I set up. I’m lost.

For reference my config and my rule.

rule "Waschmaschine voll TEST"
when
	Item Binder_WaMa_Full changed to ON
then
	pushover("Waschmaschine ist gerade fertig geworden!", "ThomasPhone", 1)
end

addons.cfg:

...
# A comma-separated list of actions to install (e.g. "mail,pushover")
action = mail, pushover
...

pushover.cfg

# The timeout for the communication with the Pushover service (optional, defaults
# to 10000 milliseconds)
#defaultTimeout=

# You need to provide a Pushover API token to send to devices. If not here, than during
# the action call itself.
defaultToken=myTokenKey

# You need to provide a Pushover User Key to send to devices. If not here, than during
# the action call itself.
defaultUser=myUserKey

# Name of the sending application (optional). Defaults to 'openHAB'.
defaultTitle=openHAB2

# The priority to use for messages if not specified otherwise. Can range from
# -2 (lowest) to 2 (highest)
#defaultPriority=

# Url to attach to the message if not specified in the command (optional). Can be left empty.
#defaultUrl=

# Url Title to attach to the message if not specified in the command (optional). Can be left empty.
#defaultUrlTitle=

# When priority is high priority (2), how often in seconds should messages be resent. Defaults to 300 seconds.
#defaultRetry=

# When priority is high priority (2), how long to continue resending messages until acknowledged. Defaults to 3600 seconds.
#defaultExpire=

I submitted a code change that will handle your use case (https://github.com/openhab/openhab1-addons/pull/5123).

The change will use any default values in the pushover.cfg file when an empty value (null or “”) is passed into the primary pushover call. Except for priority because int’s cannot be null.

An update to the latest code once it’s accepted and built will work like this for your specific case:

pushover(null, null, "Waschmaschine ist gerade fertig geworden!", null, "Waschmaschine voll TEST", null, null, 1, "magic")
2 Likes