openHAB 3 - Syntax for sending

Pushsafer make it easy and safe to get push-notifications in real time on your Android or Windows mobile device, iPhone, iPad and Desktop!

Mit Pushsafer kann man in Echtzeit, einfach und sicher, Push-Benachrichtigungen auf sein iPhone, iPad, Android oder Windows Gerät sowie auf den Desktop senden lassen!

======================
Google Play
App Store
Windows Store
Homepage
stianeik

openHAB 3 - Syntax for sending

Postby stianeik » 25. May 2021, 17:39

Hi,

I have created the pushsafer thing in the UI and are trying to send a message in a rule. According to the example the following shall be used

sendPushsaferMessage(String message, @Nullable String title) // ref https://www.pushsafer.com/en/openhab3

I have the used the following
sendPushsaferMessage("Test message", "MyTitle")
and are only recieving the following error message

[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'test-1' failed: An error occurred during the script execution: index=2, size=2 in test

What am I doing wrong?

User avatar
admin
Site Admin
Posts: 943
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: openHAB 3 - Syntax for sending

Postby admin » 25. May 2021, 19:22

Hello,

go the things and open the pushsafer binding you created.
Now copy the identifier that you need in the script.

Example Script:

Code: Select all

val actions = getActions("pushsafer", "pushsafer:pushsafer-account:**********")  
//var receipt = actions.sendPushsaferAttachmentMessage("HelloWorld", "openHAB3", "D:/path/image.jpg","jpeg","")
//var receipt = actions.sendPushsaferAttachmentMessage("HelloWorld", "openHAB3", "http://192.168.2.222:8088/tmpfs/snap.jpg","jpeg","admin:password")
//var receipt = actions.sendPushsaferAttachmentMessage("HelloWorld", "openHAB3", "https://www.pushsafer.com/de/assets/img/screenshot_en_01.jpg","jpeg","")
//var receipt = actions.sendPushsaferMessage("HelloWorld", "openHAB3")
var receipt = actions.sendPushsaferURLMessage("HelloWorld", "openHAB3", "https://www.openhab.org/addons/", "Open openHab AddOns")
Hope that helps

Kevin
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

stianeik

Re: openHAB 3 - Syntax for sending

Postby stianeik » 26. May 2021, 07:37

Thanks, it is now working!

User avatar
admin
Site Admin
Posts: 943
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: openHAB 3 - Syntax for sending

Postby admin » 26. May 2021, 10:31

great :D
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

vbevan
Posts: 3
Joined: 13. Aug 2022, 22:46

Re: openHAB 3 - Syntax for sending

Postby vbevan » 13. Aug 2022, 23:04

Hi I have installed the OH3 binding and have a pushsafer Account Thing online.

I have the correct pushsafer:pushsafer-account:******** identifier, but I am having problems with setting a rule in OH3. I tried using the synatx that you replied to @stiannek but this didn't work for me.

My rule (extract) looks like this:

var myaction = actions.thingActions("pushsafer","pushsafer:pushsafer-account:********")
myaction.sendPushsaferMessage("Test", "BEVHOME")

and the rule file saves correctly (no synatx errors reported by OH3).

However when I execute the rule, OH3 reports "[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'sms-1' failed: An error occurred during the script execution: index=0, size=0 in sms" (the rule file is sms.rules)."

I tried using a var (variable) and a val (value) statement but neither works. I also changed the name of the variable/value to "myaction" as I read somewhere that "actions" is reserved by OH. Can you tell me what I am doing wrong?

Many thanks in advance!

vbevan

User avatar
admin
Site Admin
Posts: 943
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: openHAB 3 - Syntax for sending

Postby admin » 14. Aug 2022, 07:25

Hi,

As the error log already says, the problem is not with Pushafer but with the SMS plugin, uninstall it and try again.

Kevin
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

vbevan
Posts: 3
Joined: 13. Aug 2022, 22:46

Re: openHAB 3 - Syntax for sending

Postby vbevan » 14. Aug 2022, 09:37

admin wrote:
14. Aug 2022, 07:25
Hi,

As the error log already says, the problem is not with Pushafer but with the SMS plugin, uninstall it and try again.

Kevin
Hi Kevin, I created a new rules file just for pushsafer alerting, the rule (alert.rules) text complete is:

Code: Select all

rule "Send Alert"

when
    Item testalert changed from OFF to ON
then
	logInfo("ALERT:", "Alert message sent")
	var myaction = actions.thingActions("pushsafer","pushsafer:pushsafer-account:2******1")
	myaction.sendpushSaferMessage("Test", "BEVHOME")

end
I use another test_alert.rules file to trigger the alert based on switch item testalert. I still get a similar message, here the fronttail log from OH3:

Code: Select all

2022-08-14 11:33:48.939 [INFO ] [org.openhab.core.model.script.ALERT:] - Alert message sent
2022-08-14 11:33:48.942 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'alert-1' failed: An error occurred during the script execution: index=0, size=0 in alert
So the rule is firing, the log is populated with the logInfo text but then fails on the further code.
Any help appreciated ;)

Cheers

Vincent

User avatar
admin
Site Admin
Posts: 943
Joined: 1. Dec 2014, 12:41
Location: Germany

Re: openHAB 3 - Syntax for sending

Postby admin » 14. Aug 2022, 10:45

Hello,

i think it is not a pushsafer plugin issue.
Please write a thread to the openhab3 forum and reffer to this post.
They will help better than i can

Kevin
Pushsafer DE: Dir gefällt Service und Support! Dann freuen wir uns auf deine Bewertung!
Pushsafer EN: You like Service and Support! Then we look forward to your review!

Pushsafer.com Website - iOS - Android - Windows 10

vbevan
Posts: 3
Joined: 13. Aug 2022, 22:46

Re: openHAB 3 - Syntax for sending

Postby vbevan » 15. Aug 2022, 19:54

admin wrote:
14. Aug 2022, 10:45
Hello,

i think it is not a pushsafer plugin issue.
Please write a thread to the openhab3 forum and reffer to this post.
They will help better than i can

Kevin
Ok thx Kevin

Cheers

Vincent


Who is online

Users browsing this forum: No registered users and 28 guests