Windows command line control

LightwaveRF Communi… > Forum > LightwaveRF Hackers > Windows command… > Page 2

LightwaveRF Community: Welcome Forums LightwaveRF Hackers Windows command line control

This topic contains 120 replies, has 12 voices, and was last updated by  jamieburchell 3 weeks, 4 days ago.

Viewing 15 posts - 16 through 30 (of 121 total)
  • Author
    Posts
  • #12552
     skiv71 says:

    skiv71
    Participant

    Not much useful data to be had from the wifilink as yet :-/

    developer of BMS Link (http://linode.bmslink.co.uk). A cloud based Home Automation platform for LightwaveRF, Z-Wave, RFXCOM.
    #12553
     jamieburchell says:

    jamieburchell
    Participant

    Hi

    The information I’ve gathered about the protocol is what I’ve found by analysing the network packets using Wireshark. My experience in terms of apps is this command line batch file (feel free to analyse and pull it apart) and the iViewer Next/guiDesigner software from CommandFusion. I have templates if they would be useful.

    The string needed to cancel all sequences is:

    001,!FcP"*"|Text1|Text2|

    001 is a sequence number, it can be anything between 000-999. If the WifiLink receives the command it will send back the string:

    001,OK

    Where 001 is the sequence number you’ve sent.

    Text1 and Text2 are the lines of text displayed on the WifiLink.

    The command could be abbreviated to

    001,!FcP"*"|

    The commands I’ve seen being transmitted to the WifiLink via the official apps are usually terminated with a carriage return, but like above a pipe character also seems to work.

    Note: If you’ve not registered your device with the WifiLink a sequence number of 000 doesn’t seem to work, so stick with 001-999.

    Hope that helps

    Jamie

    #12580
     alonmalka1 says:

    alonmalka1
    Participant

    Hi,

    This information is very usfull thanks.
    Can you please tell me what the exec command I need to send in order to cancel all events:
    ncat.exe ” ……”

    Alon

    #12583
     jamieburchell says:

    jamieburchell
    Participant

    Hey

    I couldn’t work out how to do this with just ncat, so the solution is a little convoluted as you will see in the command line utility attached here:

    <nul set /p ="001,^!FcP"*"|" | ncat -u -n -i 1 -p 9761 192.168.1.7 9760

    What we are doing here is piping the string: 001,!FcP"*"| in to the ncat command.

    The "set" command is used here instead of echo as echo outputs a CR/LF and we don't want to send that to ncat.
    The "<nul" is a clever trick to stop the "set" command from waiting for user input
    The extra "^" within the command string is an escape character so that "!" is not interpreted.
    9761 is the port to send from
    192.168.1.7 is the IP address of your WifiLink
    9760 is the destination port on your WifiLink

    Have a look at ncat –help for more command line options…

    Hope that helps

    Jamie

    #12650
     alonmalka1 says:

    alonmalka1
    Participant

    Hi

    Thanks for all your help. Unfortunatly this seems to be a bit complicated for me. What I would want to do is to send the text “clear events” to the wifilink along with the action of canceling the events (with the LWRF batch file it sends “LWRF”)
    Would it be possible for you to create a batch file that sends the cancel events command to the wifi link with some text? I can edit the port and the IP (that I can do :) ).
    If it is too much trouble I will understand.

    Again thanks for all you help. I use your batch file with eventghost along with the RFXTRX433 unit I use for recieving the signals. I even managed to know at all time which light is on at every moment by remebering the sent signal.
    For example I have a light switch near the house entrance and by pressing it I send an event sequence to turn off all lights by your LWRF batch file along with turning off al TV’s.

    If you or anybody else need some information am willing to share ofcourse.

    Thanks again,
    Alon

    #12655
     jamieburchell says:

    jamieburchell
    Participant

    Create a new file: clearevents.bat with the following content:

    @echo off
    <nul set /p ="001,^!FcP"*"|clear events|" | ncat -u -n -i 1 -p 9761 192.168.1.7 9760

    Changing the IP address to match your WifiLink.

    That should do it, if not let me know :)

    Jamie

    #12656
     alonmalka1 says:

    alonmalka1
    Participant

    Great I will try it.
    Can you also give me the code to put in a batch file for running events?
    I would like to edit the text here as well that is shown on the wifilink.

    Thanks,
    Alon

    #12672
     jamieburchell says:

    jamieburchell
    Participant

    Hey

    @echo off
    <nul set /p ="001,^!FqP"event name"|start event|" | ncat -u -n -i 1 -p 9761 192.168.1.7 9760

    Event name is the name you’ve allocated to the event, start event is the text displayed on the top row of the WifiLink.

    I wonder if you realise the command line utility I wrote already supports cancelling all events and running specific events? E.g:

    lwrf seq --cancel-all
    lwrf seq "Event name"

    It doesn’t support cancelling a single event but it probably could.

    Jamie

    #12689
     alonmalka1 says:

    alonmalka1
    Participant

    Hey Jamie,

    To answer your last question, I know your batch tool can do all that stuff. My system I have build is so complicated and full of scenes and event (through Event ghost) I sometimes see the wifilink send a command but I don’t know what the command is because it says LWRF on the unit display. It was important for me to se the name of the running event.
    Now that I got these two batch files I can write the text I want.
    How complicated will it be to put these two settings (name of event and text written on the wifilink) as arguments.

    I guess I am asking for too much… :-)

    in any case I appreciate all your help.

    Alon

    #12694
     jamieburchell says:

    jamieburchell
    Participant

    Ah I see. It never occurred to me the display text might be important (mine is in a fuse cupboard).

    Interesting request though. What if the text reflected the action automatically?

    Something like:

    lounge lights
    on

    kitchen lights
    dim 35%

    cancel all
    events

    I’ll likely have an issue with the limited character length on the display. Unless I used the room and device code instead:

    R1D1
    Dim 30%

    R2D3
    Off

    Etc

    #12695
     alonmalka1 says:

    alonmalka1
    Participant

    What is the maximum length possible?
    Maybe if the text exceeds the max length then it goes to R1D1 etc…
    With events it can just cut the text if it is too long and with cancel all it is not a problem.

    Thanks,
    Alon

    #12699
     jamieburchell says:

    jamieburchell
    Participant

    2 lines of 16 characters by the looks of it. I can see that being exceeded.

    Windows shell programming is a little primitive, so I don’t hold out much hope of being able to fit that logic in. I’ll have a look when I get time, I’m sure I can make it more informative than it is now.

    #12700
     alonmalka1 says:

    alonmalka1
    Participant

    Thanks.

    Lets say I want to use the first argument of a batch file which is %1.
    How can I insert it insted of “event name” in this string?

    <nul set /p ="001,^!FqP"event name"|start event|" | ncat -u -n -i 1 -p 9761 192.168.1.7 9760

    I know my way around with java and python. Shell programming I am not familier with… I am a fast learner though.. :-)

    Thanks,

    Alon

    #12703
     jamieburchell says:

    jamieburchell
    Participant

    Well, “event name” becomes “%1″. Except, if your argument contains quotation marks I believe it will translate to “”my event”" so, try “%~1″ which strips quotes from an argument.

    If you’re being really cautious, you should probably strip out anything that might interfere with the command like | (pipe)

    At some point I’ll revisit the script and see if I can improve/simplify the flow and add descriptive text to the panel’s display.

    #12714
     jamieburchell says:

    jamieburchell
    Participant

    Here’s the latest offering (v4.0)

    * Messages on the WifiLink front panel
    * Errors are output to stderr
    * Proper exit codes (1 error, 0 OK)
    * Misc re-factoring

    (Remove the .txt extension)

    Attachments:
    You must be logged in to view attached files.
Viewing 15 posts - 16 through 30 (of 121 total)

You must be logged in to reply to this topic.