Windows command line control

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

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 months, 3 weeks ago.

Viewing 15 posts - 31 through 45 (of 121 total)
  • Author
    Posts
  • #12717
     jamieburchell says:

    jamieburchell
    Participant

    I had some spare time today, so added support for mood names instead of numbers, plus some minor tweaks
    E.g.:

    lwrf lounge mood relax

    v4.1 attached (remove the .txt extension)

    Attachments:
    You must be logged in to view attached files.
    #12731
     jamieburchell says:

    jamieburchell
    Participant

    I’ve moved this project to GitHub:

    https://github.com/jamieburchell/lwrf.cmd

    All future updates will come from there. Please note the script has been renamed to lwrf.cmd.

    #12745
     alonmalka1 says:

    alonmalka1
    Participant

    Thanks Jamie, for all your work. :-)

    #17687
     fuzzweed says:

    fuzzweed
    Participant

    Hi, I’m struggling to get this to work. I think it revolves aroung the commandline not registering correctly as a device, so it looks like the wifi link is not descriminating between different control devices in the network.
    Issue 1 is registering with the wifi link as a device at all. If I fire off an inital command I get a variety of outcomes.
    Sometimes I get the cmd response wifi link not registered, but the wifilink doesn’t show the register device dialogue
    Sometimes I get the Wifi link version in the command window as a response, but the wifi link doesn’t ask if I should register the device.
    Most recently I’m getting the command text appearing in the wifilink lcd display as if it were registered, even though I’ve just completely deregistered the device.

    Furthermore, if I register my android phone running lightwaver (on the same network) then the command line does seem to start to interact with the wifi link. The LCD displays the correct action text, but the function isn’t performed, however the wifi link response is picked up and displayed on my phone and not in the command line.

    Any help would be appreciated.

    #17689
     jamieburchell says:

    jamieburchell
    Participant

    Hi there

    I too am struggling to understand what’s going on here I’m afraid.

    Setting aside the lwrf.cmd utility, is the WifiLink behaving with your official app?

    Are you using the lwrf.cmd from the GitHub page? This is the most up-to-date.

    Jamie

    #17696
     fuzzweed says:

    fuzzweed
    Participant

    Yeah, wifi link is fine with official lightwaverf android app, and lightwaver 3rd party app, and lightwave webapp. And yes its the github version (I just copied the code into a text file and changed IP address and room and device names to suit). If I deregister everything and then just start the command line I don’t get the expected authorise device message on the wifilink, but I do get the wifi link version reported in the command line, so I knoe they’re ‘talking’ to each other.

    Do you know how the devices are identified? Is it my MAC address or somehintg else? Do you think changing the port numbers is a posability?

    #17697
     fuzzweed says:

    fuzzweed
    Participant

    And here’s another oddity in case it helps identify the problem. Just moved the wifi link back into the lounge having been testing it right by the PC;
    On first turning it on again
    lwfr command returns ‘no reply from wifilink’ to any number of commands, although I can ping it and see it on my router admin page.
    Start android app, turn a light on, run lwrf again and it suddenly sends the command OK (although as previously detailed that action is not actually performed and the reply from the wifi link goes to my phone and not the cmd box!)

    The only other thing I can see is that the ping of the wifilink shown a TTL of 100, wher as everything else on the network is 64. I don’t know enough about networking to say if this is relevent though….

    #17700
     jamieburchell says:

    jamieburchell
    Participant

    Hey

    The WifiLink sends a “broadcast” reply over UDP on 255.255.255.255, so ALL devices on the network will receive the reply. This probably explains why you are getting a reply on more than just your PC.

    Occasionally, the reply packet seems to take longer to come through than at other times, causing the “No reply from WifiLink” message. You can try increasing the “rx_timeout” value just outside of the “do not edit below this point” part in the code. It’s fractions of a second and the greater the number, the longer the lwrf.cmd program will wait for a reply.

    The WifiLink listens on port 9760, this can’t be changed, so make sure your PC is able to send UDP packets out on this port and listen to the replies on port 9761 (e.g. firewall configuration).

    Incidentally, just in case you are interested in delving deeper – all of this was figured out using the excellent Wireshark tool for network packet analysis, although it seems to have died on me in Windows 8.1. There was also an API document floating around here somewhere. But you shouldn’t need either to get this working. I use the lwrf.cmd frequently.

    Let me know how you get on.

    Jamie.

    #17719
     fuzzweed says:

    fuzzweed
    Participant

    This is all I’m getting at the moment.

    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Users\Jim>lwrf lounge mood all-on
    249,?V=”U2.91Q”

    C:\Users\Jim>lwrf lounge light1 off
    282,?V=”U2.91Q”

    C:\Users\Jim>lwrf lounge light2 off
    207,?V=”U2.91Q”

    C:\Users\Jim>

    And no readout on the display, and no action at the sockets. So something is happening, but where is the failure occuring?

    I’m mystified – the premise seems simple from reading the thread, but it’s just not working here!

    Questions;
    1) The wifi link is replying, so does that means UDP packets are sent and received OK?
    2) What does the changing first three digit number in the reply signify?
    3) Does it matter what my devices (or moods) are called? Is the name just for my reference and the wifi link just interprets R1D1, R1D2 or whatever?
    4) Does it matter that I have another Android controller set up? Could this be an influence?
    5) What version is your wifilink, perhaps I have differnet firmware that behaves differently to the commands?
    6) What are you controlling? I’ve just got three plug in socket adapters at the moment – maybe they need different commands to light switches?

    I’ll have a look at wireshark when I get some more time see if I can see exactly whats being sent.

    #17720
     jamieburchell says:

    jamieburchell
    Participant

    Can you attach your modified lwrf.cmd so I can see if anything is wrong?

    1. It seems to be replying to something, but that reply looks strange.
    2. When a message is sent it contains a 3 digit sequence number, well more a random number than a sequence and this number appears in the reply. Usually the reply would be something like 123,OK
    3. The names are for your reference, the WifiLink gets R1D1 (room 1, device 1)
    4. I use a few controllers with the system- iOS apps etc, it really shouldn’t matter
    5. 2.91Q
    6. Sockets and lights, actually the defaults in that file is my configuration

    Cheers
    Jamie

    #17722
     jamieburchell says:

    jamieburchell
    Participant

    I’ve just stumbled upon this post

    http://lightwaverfcommunity.org.uk/forums/topic/link-no-longer-responding-to-udp-commands-any-advice/page/4/#post-16959

    The comment suggests the WifiLink is replying with the current firmware version when it’s not registered. I.e. When the MAC address of your network adapter isn’t known to the WifiLink. I’ve not seen this before, but perhaps it’s because mine is already registered.

    I’ll need to experiment and see if I should be sending a special command for registration now.

    #17723
     jamieburchell says:

    jamieburchell
    Participant

    I just de-registered my WifiLink and got the same reply as you. I’ve updated the lwrf.cmd code to version 5

    Enter:

    lwrf reg

    Then accept the message on the WifiLink and you should be good to go.

    #17727
     fuzzweed says:

    fuzzweed
    Participant

    OK, that’s great that it’s looking like some progress, but unfortunately I’m not getting anything back now. Sorry :(

    Tried it an a deregistered and reset unit.

    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Users\Jim>lwrf reg
    No confirmation received from WifiLink

    C:\Users\Jim>lwrf lounge off
    No confirmation received from WifiLink

    C:\Users\Jim>lwrf reg
    No confirmation received from WifiLink

    C:\Users\Jim>lwrf lounge off
    No confirmation received from WifiLink

    C:\Users\Jim>lwrf lounge off
    No confirmation received from WifiLink

    C:\Users\Jim>lwrf reg
    No confirmation received from WifiLink

    C:\Users\Jim>

    #17738
     jamieburchell says:

    jamieburchell
    Participant

    When you did lwrf reg did the WifiLink ask you to “Add app”?

    Sounds silly but did you update your IP/port when you updated the lwrf.cmd file?

    #17752
     fuzzweed says:

    fuzzweed
    Participant

    Doh. All working perfectly now. Thanks for your knowledge and patience.

Viewing 15 posts - 31 through 45 (of 121 total)

You must be logged in to reply to this topic.