www.homeseer.com    
 

Go Back   HomeSeer Message Board > 3rd Party Plug-Ins/Scripts > Plug-ins by Author > Click Here for List of Author Forums > Bruce Behrens Plug-Ins > BBMessenger

BBMessenger Discussion of BBMessenger plug-in

Reply
 
Thread Tools Display Modes
  #1  
Old September 7th, 2017, 01:19 PM
djmilez djmilez is offline
Seer
 
Join Date: Dec 2005
Location: Ipswich, England
Posts: 51
Sending Message via script fails

Hi!

Firstly great plugin! I've got this working nicely in terms of receiving messages and performing actions.

I can send reply's using the send message action ok but can't send messages from scripts. I've tried both from within a script and from an event.

Please see output below from logs. From what I could see from debugging the script it was failing on this line: plugin.PluginFunction("SendMessage", {s1(0), s1(1)})

Any help would be much appreciated.

Thanks
Chris

Sep-07 6:11:59 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: http://mono-project.com/Bugs)
Sep-07 6:11:59 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Variable declaration without an 'As' clause; Object type assumed.
Sep-07 6:11:59 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: The import 'System.Core' could not be found.
Sep-07 6:11:51 PM Event Running script in background: /HomeSeer/scripts/BBMessenger.vb("Main","example@public.talk.google.com|Testin g")
Reply With Quote
  #2  
Old September 7th, 2017, 11:27 PM
brbjr brbjr is offline
Seer
 
Join Date: Aug 2008
Location: Houston
Posts: 36
What operating system are you running?

Quote:
Originally Posted by djmilez View Post
Hi!

Firstly great plugin! I've got this working nicely in terms of receiving messages and performing actions.

I can send reply's using the send message action ok but can't send messages from scripts. I've tried both from within a script and from an event.

Please see output below from logs. From what I could see from debugging the script it was failing on this line: plugin.PluginFunction("SendMessage", {s1(0), s1(1)})

Any help would be much appreciated.

Thanks
Chris

Sep-07 6:11:59 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: http://mono-project.com/Bugs)
Sep-07 6:11:59 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Variable declaration without an 'As' clause; Object type assumed.
Sep-07 6:11:59 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: The import 'System.Core' could not be found.
Sep-07 6:11:51 PM Event Running script in background: /HomeSeer/scripts/BBMessenger.vb("Main","example@public.talk.google.com|Testin g")
Reply With Quote
  #3  
Old September 7th, 2017, 11:41 PM
brbjr brbjr is offline
Seer
 
Join Date: Aug 2008
Location: Houston
Posts: 36
Reading this thread https://forums.homeseer.com/showthread.php?t=175822

Try this, add Imports System.Core to the beginning of BBMessenger.vb file

-----new script file----


Imports System.Core
'BBMessenger example script on how to send a message via script
Public Sub Main(ByVal Parms As Object)
Dim logto As String = "BBMessenger-Script"
hs.WriteLog(logto, "Running script")
hs.WriteLog(logto, "Sending Message: " + Parms.ToString())
Dim plugin = New HomeSeerAPI.PluginAccess(hs, "BBMessenger", "")
Dim s1 As String() = Parms.ToString().Split("|".ToCharArray())
If (s1.Length >= 2) Then
If plugin IsNot Nothing Then
plugin.PluginFunction("SendMessage", {s1(0), s1(1)})
Else
hs.WriteLog(logto, "Error sending message. Not able to locate the plug-in.")
End If
End If
hs.WriteLog(logto, "Exiting script")
End Sub



-----end new script file----



Quote:
Originally Posted by djmilez View Post
Hi!

Firstly great plugin! I've got this working nicely in terms of receiving messages and performing actions.

I can send reply's using the send message action ok but can't send messages from scripts. I've tried both from within a script and from an event.

Please see output below from logs. From what I could see from debugging the script it was failing on this line: plugin.PluginFunction("SendMessage", {s1(0), s1(1)})

Any help would be much appreciated.

Thanks
Chris

Sep-07 6:11:59 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: http://mono-project.com/Bugs)
Sep-07 6:11:59 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Variable declaration without an 'As' clause; Object type assumed.
Sep-07 6:11:59 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: The import 'System.Core' could not be found.
Sep-07 6:11:51 PM Event Running script in background: /HomeSeer/scripts/BBMessenger.vb("Main","example@public.talk.google.com|Testin g")
Attached Images
 
Reply With Quote
  #4  
Old September 8th, 2017, 04:40 AM
djmilez djmilez is offline
Seer
 
Join Date: Dec 2005
Location: Ipswich, England
Posts: 51
I did try that before and also came across that thread. But same still unfortunately. Running on Rasp Pi details below.

HomeSeer Version: HS3 Standard Edition 3.0.0.313
Linux version: Linux raspberrypi 4.4.48-v7+ #964 SMP Mon Feb 13 16:57:51 GMT 2017 armv7l GNU/Linux System
Reply With Quote
  #5  
Old September 8th, 2017, 08:59 AM
djmilez djmilez is offline
Seer
 
Join Date: Dec 2005
Location: Ipswich, England
Posts: 51
Seems New Object is required on Linux.

https://forums.homeseer.com/showthread.php?t=188645

I tried:

plugin.PluginFunction("SendMessage", New Object {s1(0), s1(1)})

But getting other errors now.

Compiling script /HomeSeer/scripts/BBMessenger.vb: 'End Namespace' must be preceded by a matching 'Namespace'.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Identifier expected.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Identifier expected.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Identifier expected.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Identifier expected.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Identifier expected.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Identifier expected.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Expected 'End'.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Expected 'End'.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Expected 'End'.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Expected 'End'.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Expected ')'.
Reply With Quote
  #6  
Old September 8th, 2017, 09:15 PM
brbjr brbjr is offline
Seer
 
Join Date: Aug 2008
Location: Houston
Posts: 36
My raspberry pi died. I am trying with QEMU windows emulation. I will try to pick up a raspberry pi 3 tomorrow.

Bruce

Quote:
Originally Posted by djmilez View Post
Seems New Object is required on Linux.

https://forums.homeseer.com/showthread.php?t=188645

I tried:

plugin.PluginFunction("SendMessage", New Object {s1(0), s1(1)})

But getting other errors now.

Compiling script /HomeSeer/scripts/BBMessenger.vb: 'End Namespace' must be preceded by a matching 'Namespace'.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Identifier expected.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Identifier expected.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Identifier expected.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Identifier expected.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Identifier expected.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Identifier expected.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Expected 'End'.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Expected 'End'.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Expected 'End'.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Expected 'End'.
Sep-08 1:47:53 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Expected ')'.
Reply With Quote
  #7  
Old September 9th, 2017, 06:25 PM
brbjr brbjr is offline
Seer
 
Join Date: Aug 2008
Location: Houston
Posts: 36
I am able to replicate the issue on Debian 9. I think it is a HomeSeer issue, I am going to log a support case with HomeSeer.


Updated script below to fix the object compile error. With this fix now I am getting Error: Compiling script /home/brbjr/HomeSeer/scripts/BBMessenger.vb: http://mono-project.com/Bugs)
Sep-09 5:20:30 PM Error Compiling script /home/brbjr/HomeSeer/scripts/BBMessenger.vb: Namespace or type specified in the Imports 'System.Core' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

--script--

Public Sub Main(ByVal Parms As Object)
Dim logto As String = "BBMessenger-Script"
hs.WriteLog(logto, "Running script")
hs.WriteLog(logto, "Sending Message: " + Parms.ToString())
Dim plugin As HomeSeerAPI.PluginAccess = New HomeSeerAPI.PluginAccess(hs, "BBMessenger", "")
Dim s1 As String() = Parms.ToString().Split("|".ToCharArray())
If (s1.Length >= 2) Then
If plugin IsNot Nothing Then
plugin.PluginFunction("SendMessage", {s1(0), s1(1)})
Else
hs.WriteLog(logto, "Error sending message. Not able to locate the plug-in.")
End If
End If
hs.WriteLog(logto, "Exiting script")
End Sub

--end script ---


Quote:
Originally Posted by djmilez View Post
Hi!

Firstly great plugin! I've got this working nicely in terms of receiving messages and performing actions.

I can send reply's using the send message action ok but can't send messages from scripts. I've tried both from within a script and from an event.

Please see output below from logs. From what I could see from debugging the script it was failing on this line: plugin.PluginFunction("SendMessage", {s1(0), s1(1)})

Any help would be much appreciated.

Thanks
Chris

Sep-07 6:11:59 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: http://mono-project.com/Bugs)
Sep-07 6:11:59 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: Variable declaration without an 'As' clause; Object type assumed.
Sep-07 6:11:59 PM Error Compiling script /HomeSeer/scripts/BBMessenger.vb: The import 'System.Core' could not be found.
Sep-07 6:11:51 PM Event Running script in background: /HomeSeer/scripts/BBMessenger.vb("Main","example@public.talk.google.com|Testin g")
Reply With Quote
  #8  
Old September 10th, 2017, 07:22 AM
djmilez djmilez is offline
Seer
 
Join Date: Dec 2005
Location: Ipswich, England
Posts: 51
Thanks Bruce, i've tried with the changes to see if any different on Rasp Pi and it gives The import 'System.Core' could not be found, same still if I try and import this at the top.

Will definitely be purchasing this plugin if I can get this resolved, got it working nicely in a script to receive messages and control devices and events, just need to be able to reply with a status.

Cheers
Chris
Reply With Quote
  #9  
Old September 10th, 2017, 09:37 AM
brbjr brbjr is offline
Seer
 
Join Date: Aug 2008
Location: Houston
Posts: 36
Chris,

I found a fix in the script syntax, mono is very picky . I pushed a update to the HS Store but it will not overwrite the BBMessenger.vb file, you need to manually update the file with the script below.

'---BBmessenger.vb script-----------

'BBMessenger example script on how to send a message via script
Public Sub Main(ByVal Parms As Object)
Dim logto As String = "BBMessenger-Script"
hs.WriteLog(logto, "Running script")
hs.WriteLog(logto, "Sending Message: " + Parms.ToString())
Dim plugin As HomeSeerAPI.PluginAccess = New HomeSeerAPI.PluginAccess(hs, "BBMessenger", "")
Dim s1 As String() = Parms.ToString().Split("|".ToCharArray())
If (s1.Length >= 2) Then
If plugin IsNot Nothing Then
Dim message(1) As Object
message(0) = s1(0)
message(1) = s1(1)
plugin.PluginFunction("SendMessage", message)
Else
hs.WriteLog(logto, "Error sending message. Not able to locate the plug-in.")
End If
End If
hs.WriteLog(logto, "Exiting script")
End Sub
'---End BBmessenger.vb script-----------

Bruce

Quote:
Originally Posted by djmilez View Post
Thanks Bruce, i've tried with the changes to see if any different on Rasp Pi and it gives The import 'System.Core' could not be found, same still if I try and import this at the top.

Will definitely be purchasing this plugin if I can get this resolved, got it working nicely in a script to receive messages and control devices and events, just need to be able to reply with a status.

Cheers
Chris
Reply With Quote
  #10  
Old September 10th, 2017, 05:08 PM
djmilez djmilez is offline
Seer
 
Join Date: Dec 2005
Location: Ipswich, England
Posts: 51
Thumbs up

Excellent that's sorted, thanks for resolving so quickly.

Is there any way to send images in messages? No worries if not just would be nice addition. But can always send a link to image instead.
Reply With Quote
  #11  
Old September 12th, 2017, 11:07 AM
brbjr brbjr is offline
Seer
 
Join Date: Aug 2008
Location: Houston
Posts: 36
I researched sending pictures/files via XMPP messages in the past and determined that you have to reference a hosted url in the message.

Bruce

Quote:
Originally Posted by djmilez View Post
Excellent that's sorted, thanks for resolving so quickly.

Is there any way to send images in messages? No worries if not just would be nice addition. But can always send a link to image instead.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending email fails SSL? happnatious1 HS3 / HS3PRO Discussion 1 July 31st, 2017 10:33 AM
Sending message to clients... wpiman Clients - Android 1 October 11th, 2012 11:09 PM
Sending a message to the Elk KP from HS irfanh Elk M1 Plug-In 4 July 14th, 2006 09:14 PM
Sending an http message from HS, Help ? 22v10 HomeSeer General Discussion Area 6 July 13th, 2005 09:06 AM
Sending message to console VIA Script Sean Willoughby HAI/OnQ Panel (HS2) 6 November 17th, 2004 10:00 AM


All times are GMT -4. The time now is 03:31 AM.


Copyright HomeSeer Technologies, LLC