Why is the sample an exe-file? Should it not be example code?
Announcement
Collapse
No announcement yet.
Sample Plugin
Collapse
This is a sticky topic.
X
X
-
rjh
Are there any walk-throughs or samples of a Linux based plugin? My main question is relating to compiling it for mono and respective best practices/tips.
Thanks!HomeSeer 2, HomeSeer 3, Allonis myServer, Amazon Alexa Dots, ELK M1G, ISY 994i, HomeKit, BlueIris, and 6 "4k" Cameras using NVR, and integration between all of these systems. Home Automation since 1980.
Comment
-
You build the plugin on Windows and just copy over the EXE. Most of the time it just works as MONO is pretty complete. The MONO project page outlines interfaces that are not compatible with Linux. The obvious ones are anything PC specific or any code that references dll's directly.
Our Z-Wave plugin is a huge plugin and the same EXE runs on both.
Some points below (I will move this to a sticky post later).
The code itself checks if its on Linux at startup with:
Code:If hs.GetOSType = eOSType.linux Then IsLinux = True IsWindows = False Console.WriteLine("Z-Wave Plugin: " & "OS Type is Linux") Else IsLinux = False IsWindows = True Console.WriteLine("Z-Wave Plugin: " & "OS Type is Windows") End If
Code:Friend Function FixPath(ByVal fpath As String) As String If IsLinux Then Return fpath.Replace("\", "/") Else Return fpath End If End Function
Code:Public Function Erl() As Integer Return 0 End Function Public Class Err Public Shared Number As Integer = 0 Public Shared Erl As Integer = 0 Public Shared Description As String = "" Public Shared Sub Clear() End Sub End Class
Code:Class Application Shared Sub DoEvents() Threading.Thread.Sleep(10) 'If IsWindows Then 'System.Windows.Forms.Application.DoEvents() 'End If End Sub Shared Function ProductVersion() As String Return My.Application.Info.Version.ToString End Function End Class
Comment
-
Are the steps the same for RPI based Linux? How would one compile for RPI? From a code perspective what you provided earlier still applies, but the source needs to be compiled. I’ve done some research, but in case there are some differences in regards to HomeSeer, would appreciate some guidance in how to compile plugin for usage on RPI based hardware.
second, if the plugin runs remotely on a Pi connected to a Windows based HS installation, does anything special need to be done with In terms of HS licensing? Doubt ful Hs but what about plugin license?
thx!1HomeSeer 2, HomeSeer 3, Allonis myServer, Amazon Alexa Dots, ELK M1G, ISY 994i, HomeKit, BlueIris, and 6 "4k" Cameras using NVR, and integration between all of these systems. Home Automation since 1980.
Comment
-
There is no difference in the actual .exe file for windows or linux - they are the same. Inside the code itself, you just use the FixPath function above when referencing physical files.
HS4Pro on a Raspberry Pi4
54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI
HSTouch Clients: 1 Android
Comment
-
As rmasonjr mentioned the same EXE you build on Windows will run on Linux. You may have to build it with the "Any Cpu" setting. So no compiling on Linux, just copy over the EXE.
Use "Console.WriteLine("")" to print out any debug messages if you need to debug on Linux, there isn't any debugger that works well there.
Make sure you Try/Catch everything and log any errors with Console.Writeline so you can see any errors.
As for licensing, there are some issues there as HS needs to see the EXE file and it will not see it on a remote system. So the user will need to install it on Windows, license it, then they can run it remotely. At some point we need to address remote plugin licensing.
Originally posted by Krumpy View PostAre the steps the same for RPI based Linux? How would one compile for RPI? From a code perspective what you provided earlier still applies, but the source needs to be compiled. I’ve done some research, but in case there are some differences in regards to HomeSeer, would appreciate some guidance in how to compile plugin for usage on RPI based hardware.
second, if the plugin runs remotely on a Pi connected to a Windows based HS installation, does anything special need to be done with In terms of HS licensing? Doubt ful Hs but what about plugin license?
thx!1
Comment
Comment