UDP port for JSON responses

LightwaveRF Community: Welcome Forums LightwaveRF Hackers UDP port for JSON responses

This topic contains 17 replies, has 3 voices, and was last updated by  btidey 6 months, 2 weeks ago.

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #25036
     yertiz says:

    yertiz
    Participant

    HI, I’ve been controlling lots of light switches and relays on my LAN via UDP with my own bespoke software for quite a while now and been quite happy with sending out request on 9760 (e.g. 111,!R1D1F1) and receiving the simplistic acknowledgement on port 9761 (e.g. 111,OK) – all well and good. However, the API documentation says that after the simple acknowledgement I should also be receiving a JSON packet with a lot more detail. I initially ignored the fact that I wasn’t getting the JSON but now that I have just purchased a couple of “Electric Switches” for my heating which has 2-way RF comms I thought I would dig a bit further. What I have discovered is that the JSON reply is being broadcast (I actually get it twice due to unicast on top of broadcast) but it’s on port 4101 NOT 9761 – This port difference does not appear to be documented or even casually mentioned anywhere – surely this cannot just be me???

    #25072
     yertiz says:

    yertiz
    Participant

    Nobody else then? Probably not, as a short while after rebooted the link my software started to fail due to the JSON packets shifting from the mysterious 4101 (normally associated with the Braille protocol) to 9761 where they are supposed to come in – firmware update / bug / glitch – who knows? However, looking at the local API documentation I have noticed that the author can’t seem to make up his mind which ports are utilised. For instance, on the Introduction and Basic Communications page – the only JSON example is shown coming in on 9760 and the same applies to all examples (even the standard OK) on the heating page.

    #25087
     Ukterry01 says:

    Ukterry01
    Participant

    Hi
    I am also going to install 2 way lighting switches, I use the ha bridge to work with my harmony hub.
    I have looked hi and low for commands to turn two devices of the same room on at the same time, other than using the mood recall.

    The main reason is to DIM both devices at the same time, the only way I have managed to achieve this is with a delay between the two DIM commands.

    Do you have any experience, or stumbled on any useful information

    For the record I am using windows7 for the ha bridge, harmony elite hub, and lightwaverf gen1

    Thanks

    #25090
     btidey says:

    btidey
    Participant

    Commands are sent to devices over RF. Only 1 command can be sent at a time, and a command takes about a couple of seconds to be sent as it is repeated a number of times (Gen1, Gen2 may be different).

    If you want 2 or more devices to act on a command at a time then you only have 2 options

    a) Use a mood command that all the devices involve respond to.

    b) Use multiple pairing to one device. For example, add a new virtual device (3). Now pair device 1 and device 2 to the device 3. Device 1 will respond to device 1, device 2 will respond to device 2, device1 and device 2 will both respond to device 3. If you always want them together then you don’t need to set up device 1 and 2 but just use device 3. A single device can hold up to 6 pairings. Note this is suggested in a Gen1 context; as Gen2 has status / feedback I don’t know what that would like that in this scenario.

    #25095
     yertiz says:

    yertiz
    Participant

    Hi, your post is slightly off topic but to answer your question: other than moods there is no way to switch more than one device ON at the same time, BTW: you are aware that with two-way light switches only one of them (the master) actually powers the light(s) on an off and receives the RF commands whilst the other (the slave) is simply a wired remote to the master?

    To give you more of an idea of my setup:
    When ControlFreak (my custom software) fires up on my PC it starts up WebExtractor (to monitor the Alexa history page), HA-Bridge to fool Alerxa into thinking I’ve got approx 150 Philips Hue lights to control) and ContaCam (Video Survailance software with 2 x HD webcams). It then fires off 7 more instances of itself thus:
    1. A channel service to check for regional programming thus automatically switching my Virgin box from BBC HD (if currently displayed) to BBC local and vice versa.
    2. A history service to check that the WebExtractor is still pointing to a valid history page – restarting it if necessary.
    3. A Camera Watch service that hooks into the ContaCan video feeds and performs logic re how dark it is, whether a door is open or closed etc and continuously adjust the camera settings for optimal viewing.
    4. A dropbox service that monitors a dropbox folder for incoming command files that are acted upon when seen.
    5. A WebCam service that hooks into ContaCam and kicks off prompted recording sessions when requested.
    6. A Lighting service that uses the LighwaveRF local API to control all the lighting in and outside my house on timers and incoming commands
    7. A hot water service that switches on and off my boiler / immersion via LightwaveRF command on timers and incoming commands

    So when I ask Alexa to turn on BBC One (for example), it asks HA Bridge to switch on a specific light. That dummy light is configured to fire off an instance of ControlFreak with command line arguments indicating what to do. In this case it knows from which room the command was issued (I have one echo dot in the living room and one in the kitchen) via WebExtractor reference and either talks direct TCP to my Virgin Tivo box (living room) or issues a command to a Broadlink RM pro to blast the appropriate IR to my kitchen TV. Either way it knows whether to go to HD or SD local version of the channel depending on the TV listings extracted by the Channel Service.

    ControlFreak also has built in macros for doing many different things from single Alexa voice request controlling:
    * Lighting: 17 different lights in and around the house employing 3 x1 gang masters, 1 x 3 gang master, 1 x 1 gang slave, 5 x 2 gang wireless switches, 2 x dimmer relays, 4 x on/off relays, 1 x 3 gang relay, 2 x plugin mains switch, 1 x dimming plugin mains switch.
    * Hot water via 2 x LWRF “electrical switches” controlling the immersion and/or boiler
    * 2 x TVs
    * Virgin Tivo V6 Box
    * Denon Sound Base
    * AV Reciever
    * Bluray player
    * Roku3
    * Andoid TV Box
    * Plex server running on my PC
    * 6 x 2 HDMI matrix
    * 2 x 2 Optical Matrix
    Some of the control is via direct TCP whilst the other bits are via 2 x Broadlink RM Pro IR Blasters

    It keeps me entertained – but drives the wife nuts. She also thinks I’m having an affair with Alexa !!!

    #25096
     yertiz says:

    yertiz
    Participant

    Btidey has a good workaround i.e. create a dummy device and pair both your devices to it – simples!

    #25097
     yertiz says:

    yertiz
    Participant

    For instance, I have configured a couple of my 2 gang wireless switches in my kitchen such that one gang on each simply turns on/off the closest light to the switch whereas the other turns on/off all the lights in the room e.g. for master entrance/exit control. This is just an example of local switch control but the same approach can be applied to commands issued from the RF link.

    #25099
     Ukterry01 says:

    Ukterry01
    Participant

    Hello all Just like to thank you for your responses.

    There is a lot there to chew on, and some clever ideas, I will digest and probably try more than one.

    I will feed back any good results.

    I can see yertiz you are into this in a big way,

    btidey your suggestion of a virtual device sounds interesting, as a newby how do you set that up, only i thought you needed physical devices, where are you setting up the virtual device.

    #25100
     btidey says:

    btidey
    Participant

    You just set up a new device in the app then seprately pair each real device to that. I.e put 1 device in pairing mode and send an on from the new device in the app. Then put the other device in pairing mode and send the same on from the new device. From now on both devices will respond when the command is sent.

    #25101
     Ukterry01 says:

    Ukterry01
    Participant

    btidey thanks for the response sounds easy I will give that a try and report back

    #25102
     Ukterry01 says:

    Ukterry01
    Participant

    btidey
    I tried what you described, I created the following

    Virtual room. with a dimmer device called virtual1

    I then pressed both buttons on physical device1 until lights flashed then pressed the on button of the virtual device from the app lights stopped flashing.
    I then pressed both buttons on physical device2 until lights flashed then pressed the on button of the virtual device from the app lights stopped flashing.

    Only trouble is that only device2 responds to on/off from the virtual device, have i done something wrong ??

    #25103
     Ukterry01 says:

    Ukterry01
    Participant

    just to add btidey, the two devices are on a two gang light switch

    #25104
     Ukterry01 says:

    Ukterry01
    Participant

    ok, looked at other threads and read something about i receiver on two gang switches, and cannot pair each device like I wanted to.

    So to prove this i tried your method with two different switches and it worked as you described, so i still cannot do it.

    I still cant get my head around the fact that a mood can turn on both lights at the same time with a particular brightness, what is the udp commands used by the mood ?? someone knows, surely then I just issue those commands with different brightness values when required.

    #25106
     yertiz says:

    yertiz
    Participant

    Hi Ukterry01, the commands you need to control moods are in the Local API doc on the Power and Lighting Device Functions Page e.g.

    For example !R2FsP1 to store mood 1 for room 2 and !R2FmP1 to recall it

    Haven’t used it myself yet – but it seems relatively straight forward.

    #25108
     yertiz says:

    yertiz
    Participant

    Soz, that was supposed to contain this link: https://api.lightwaverf.com/lighting_power.html#moods-introduction

Viewing 15 posts - 1 through 15 (of 18 total)

You must be logged in to reply to this topic.