I got started last week, but then was out of town for the weekend. I can definitely see how a flowsheet would help in understanding how everything ties together. . .I only got a quick glance as the plugin.vb (I think it was). . .need a more thorough read. I have done basic coding in many different languages, but mostly scripting recently (Kixstart, php, perl, ahk). And VB definitely has a much different syntax.
Announcement
Collapse
No announcement yet.
HSPI_MoskusSample - An easier plugin sample [VB.NET]
Collapse
X
-
You're right! That is missing!
I can add this but it will be a while, I'll write it down so I don't forget.HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
Running on Windows 10 (64) virtualized on ESXi (Fujitsu Primergy TX150 S8).
WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample
Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!
Comment
-
diaskenu
Comment
-
Hmmm! That's weird! You shouldn't get to that place in the code, that bit is only "leftovers" from the original sample.
I don't know which devices you are creating, but it seems that you have not set the device.Device_Type_String to anything other than "" or String.Empty.
The subs CreateBasicDevice, CreateAdvancedDevice and CreateRootDevice all set this to the plugin name, a space char and "Basic", "Advanced" and "Root", like this:
Code:device.Device_Type_String(hs) = Me.Name & " " & "Basic"
The function ConfigDevice (where you hare having problems) is using .Device_Type_String to determine which device type you are handling at the moment, that's what the "Select Case" is doing (it removes the Me.Name (the plugin name) first).
If you want a quick and dirty fix, you can add Return String.Empty after Select Case "", like this:
.... but I would suggest that you rather try to understand what's going on. I'll try to help if I can!HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
Running on Windows 10 (64) virtualized on ESXi (Fujitsu Primergy TX150 S8).
WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample
Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!
Comment
-
Two points of clarity
1. As a point of suggestion. I have replaced all references in your code fromCode:device.Device_Type_String(hs) = Me.Name & "..."
Code:PEDAdd(device.PlugExtraData_Get(hs), "C_Type", c_type)
2. This above method works in ALL areas except for one. The Function for ConfigDevice I call the PluginExtraData for the C_Type to render the page and it does not add the page to the control?
Comment
-
Originally posted by DNATechnologySolutions View PostThe reason for this is data assurance. Users can change the Device_Type which would then break your code. Using the PluginExtraData ensures users cannot access it to change the device type. I used the string C_Type for "Control Type". To speed this ability along I added an ENUM in the utils.vb for DeviceType so I can reference them in code more simply and also convert from integer to string when needed.
Instead I recommend using DeviceTypeInfo, as this cannot be easily overwritten.
Code:Dim typeInfo As New DeviceTypeInfo typeInfo.Device_Type = DeviceTypeInfo.eDeviceAPI.Plug_In typeInfo.Device_API = DeviceTypeInfo.eDeviceAPI.Plug_In typeInfo.Device_SubType = type 'an integer for me typeInfo.Device_SubType_Description = type.ToString & ",IP=" & ip_address device.DeviceType_Set(hs) = typeInfo
Originally posted by DNATechnologySolutions View Post2. This above method works in ALL areas except for one. The Function for ConfigDevice I call the PluginExtraData for the C_Type to render the page and it does not add the page to the control?HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
Running on Windows 10 (64) virtualized on ESXi (Fujitsu Primergy TX150 S8).
WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample
Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!
Comment
-
I had started a separate thread for that specific issue in http://board.homeseer.com/showthread.php?t=185828
but in short, the built in PEDAdd util function (by HomeSeer) called in the DeviceConfig function isn't working.
I called this to add additional data right after creating the devices and I keep getting null errors.
Comment
-
I FIGURED IT OUT MOSKUS
Solution found in http://forums.homeseer.com/showthread.php?t=173585 and after Tinkering
I Posted a More Detailed note on thread
Comment
-
HUGE Thankyou to Moskus and Telholde, I was able to combine their samples into one example Serial script.
I am not the best coder and new to .net so happy for others to take and improve this. Much of the logging and code in there is to aid in testing so you'll want to streamline it for live use.
It's very basic (it's a sample), but has the following features:- Single serial port with send and receive logic
- Port and Baud can be set in the config page
- It handles disconnect and reconnect
- It send a confirmation message to the serial port sender
- Creates an additional device (Device Name is "UpdateMeFromSerial")
- Device has two buttons that send data to the serial port
- Any received data will appear on the Serial Device Status field
- You can call the send function from a script to send data out the serial port
Code:Public Sub Main(ByVal param As Object) Const ScriptName = "Serial command" Try hs.WriteLog(ScriptName, "Sending to Serial port") hs.PluginFunction("TestSerial", "", "SendToSerialPort", New Object() { "some data to send to serial port goes here"}) Catch ex As Exception hs.WriteLog(ScriptName, "Error C: " & ex.Message) End Try End Sub
Hope it helps others.Last edited by davros; January 27, 2017, 06:34 AM.
Comment
-
Cool!HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
Running on Windows 10 (64) virtualized on ESXi (Fujitsu Primergy TX150 S8).
WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample
Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!
Comment
-
Yep. And on the back of this I have just completed by first plugin for my Arduino Mega Based IO Controller.
16 Relays contacts, 8 interupt driven opto-isolated Digital inputs (dry and active), 8 Analog opto isolated inputs. Very happy.
Relays can be set to timed events and it saves state. It's run via simple command like "11,2;" to set relay 2 to on, and returns state as "R2=1".
I even used PlugExtraData to store device info. which turns out to be very useful - and like many things HS, unecessarily complex and poorly documented.
Hey, does anyone have a TCPIP server Visual Studio VB.Net Solution/project they can share
Happy to reshape and publish as a TCP demo interface as per serial.
Sharing is caringLast edited by davros; January 28, 2017, 08:36 PM.
Comment
-
Just added basic TCPIP to the plugin Will share shortly.
https://forums.homeseer.com/showpost...2&postcount=12
Comment
Comment