got it working but zwave device doesnt turn on as i thought, i now need to look in to capi
Announcement
Collapse
No announcement yet.
Script for 2 Way Control over RS232
Collapse
X
-
Originally posted by Matt Powell View Postgot it working but zwave device doesnt turn on as i thought, i now need to look in to capiMike____________________________________________________________ __________________
HS3 Pro Edition 3.0.0.548, NUC i3
HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti
Comment
-
Thanks, i have downloaded and create this script but it works once, then doesnt work again. Any thoughts on what i am doing wrong.
Sub main(ByVal data)
Dim DeviceRef As Integer
Dim dimvalue As Integer
DeviceRef = Mid(data, 5, 3)
dimvalue = Mid(data, 8, 3)
Dim cc As HomeSeerAPI.CAPI.CAPIControl = hs.CAPIGetSingleControl(DeviceRef, True, "(value)%", False, False)
cc.ControlValue = dimvalue
Dim cr As HomeSeerAPI.CAPI.CAPIControlResponse = hs.CAPIControlHandler(cc)
End Sub
THIS IS MY ERROR IN LOG
Aug-24 19:13:18 Error 3 Running script capi.vb :Exception has been thrown by the target of an invocation.->Does entry point main exist in script? at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Obj ect obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at A.c17b105f989efe61e5979e67bec1ef734.cffd66cb0782c50126727e3f a75582d7a()
Comment
-
Try adding an explicit conversion of the data to integer values.
DeviceRef = CInt(Mid(data, 5, 3))
dimvalue = CInt(Mid(data, 8, 3))
Some WriteLog statements may help to identify what is happening, as well.
hs.WriteLog "data", data
hs.WriteLog "data53", DeviceRef
hs.WriteLog "data83", dimvalue
Also, try changing Sub main to Sub Main with a capital M, and capitalize Main in the calling statement e = hs.OpenComPortTerm(2, "19200,N,8,1", 1, "rx.vb", "Main", chr(13))
I recall another case where that caused the call to fail.Mike____________________________________________________________ __________________
HS3 Pro Edition 3.0.0.548, NUC i3
HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti
Comment
-
Is there a way to clear the data will it be held if i dont use it?
After the first message i then always get an error so its not working out the mids correctly.
Aug-24 20:01:41 capi.vb Error, Exception parsing Parm: Conversion from string "E06" to type 'Integer' is not valid.
I can change the message that hs3 is being sents but i will still need to split it down somehow for the device ref and value
Comment
-
Originally posted by Matt Powell View PostIs there a way to clear the data will it be held if i dont use it?
After the first message i then always get an error so its not working out the mids correctly.
I can change the message that hs3 is being sents but i will still need to split it down somehow for the device ref and value
Can you use a different terminator? I use a '$' as my terminator,
hs.OpenComPortTerm(21, "9600,N,8,1", 1, "Data_GetSG_ASCII.vb", "Main", "$")
and that has been effective. Any character that will not show up as part of a normal control string ought to work.
PS. Do you know there is no line feed after the Chr(13)? If there is, Chr(10) may be the first character in the buffer for each successive message.Mike____________________________________________________________ __________________
HS3 Pro Edition 3.0.0.548, NUC i3
HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti
Comment
-
Excellent. Glad it's working.Mike____________________________________________________________ __________________
HS3 Pro Edition 3.0.0.548, NUC i3
HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti
Comment
-
Generic needs seen/receive on port
Hi,
I have been reading this thread in hope of solving my needs.
The problem looks extremely generic:
- Open (and keep open) port:
- send strings coming from somewhere
- receive and trap strings for destination elsewhere
I need exactly above, would you mind posting the final solution as it would help me a lot.
Thx,
Bob
Comment
-
Originally posted by Bobone View PostHi,
I have been reading this thread in hope of solving my needs.
The problem looks extremely generic:
- Open (and keep open) port:
- send strings coming from somewhere
- receive and trap strings for destination elsewhere
I need exactly above, would you mind posting the final solution as it would help me a lot.
Thx,
Bob
Hi Bob,
I will put something together to send over as bits need putting in startup script aswell as 3 others.
Do you need what comes out on the RS232 leg to be generic or specific if its a light or pir etc ? I use the device ref to change the RS232 command.
Comment
Comment