Announcement

Collapse
No announcement yet.

Controlling Generic Network/Wifi Relay Boards with HomeSeer PI

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Controlling Generic Network/Wifi Relay Boards with HomeSeer PI

    Hi, just thought I'd post how I setup HomeSeer PI to control a couple generic WiFi relay boards I got on eBay (the kind that you telnet to on port 2000, and just enter a single ascii character to turn on/off a relay on the board).

    I just created a file in the /home/homeseer directory,
    Put this in it (where x.x.x.x is the IP of your network relay board):

    #!/bin/sh

    host=x.x.x.x
    port=2000


    echo $1 | nc ${host} ${port}


    In HomeSeer, create an event, and set the action to "Run Another Program or Process", set it to launch /bin/sh
    Set the parameters to /home/homeseer/yourfilename eo
    as an example if your filename was called yourfilename, and you wanted to momentarily turn on relay 1 (e turns it on, o turns it off).

    I have one relay board tied into an X10 remote to control a couple legacy X10 channels, and some other relays tied into a couple other things, and they work great this way along with HomeSeer events! I couldn't seem to get around creating the file rather than just running /bin/echo with command line parameters for some reason. I had to run /bin/sh with the file I created above.

    #2
    Hi,

    thanks for your script !
    what board are you using ?

    Comment


      #3
      Hi, I've got one called a LazyBone (single channel, but in a housing), and also a TOSR08-T WiFi (remember to buy a separate 5v power supply, and make sure to get the version with WiFi), both from TinySine. You can get them from their web site too. The software that comes with them stinks, but I've had no problems using them with HomeSeer, and the possibilities are endless! The LazyBone has built in momentary switch support, but with the 8 channel relay board, all you need to do is issue two commands to do a momentary pulse. If you need a longer pulse, just redo the script slightly to put in a pause if you need that too.

      I've wired / soldered the 8 channel one into a HR12A X10 remote and a couple other things since you trip anything with a button. I wired the LazyBone into my thermostat to turn it on and off for now. I haven't decided on a remote thermostat yet since I don't want anything cloud based, the Z-Wave ones all seem to have various issues, and I really want one with remote sensors to get the temperature correct where I'm at.

      Sorry for the extra nerd talk here

      Comment


        #4
        8 Port Script Clarification Please

        Hey thanks for posting your solution for relays. I am new to this so wondering if you could help me out a little further. I am trying to automate 2 push buttons for garage door openers so Homeseer will close the door at night when my kids leave it open (with my alarm connection Homeseer already knows when its open). So with the 8 Port TOSR08 I want to connect the USB directly to the Homeseer computer. From there I don't think i need WiFi as i don't really care if i can control it wireless. Please let me know if i just order the board and the power supply if this will work and I need further explanation on the scripting.

        How do you control the relays for a momentary closure you mention 2 commands can you give an example or attach an example of the file with the 2 commands to simulate a button press and optionally how to put a pause in if i need one?

        If I understand it correctly all I do is execute /home/homeseer/yourfilename eo and the "EO" at the end of the line is the 2 commands correct? Then all i need is the pause.

        Very cool solution!!!

        Thanks again Dale

        Comment


          #5
          IP Address

          I assume the board gets its own IP address?

          Comment


            #6
            Thank-you for the post.

            Yup; here looking at the XBee configuration.



            - Pete

            Auto mator
            Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
            Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
            HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

            HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
            HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

            X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

            Comment


              #7
              More Questions

              Originally posted by DaleRS View Post
              Hey thanks for posting your solution for relays. I am new to this so wondering if you could help me out a little further.

              I am trying to automate 2 push buttons for garage door openers so Homeseer will close the door at night when my kids leave it open (with my alarm connection Homeseer already knows when its open).

              So with the 8 Port TOSR08 I want to connect the USB directly to the Homeseer computer.

              I need further explanation on the scripting.

              How do you control the relays for a momentary closure you mention 2 commands can you give an example or attach an example of the file with the 2 commands to simulate a button press and optionally how to put a pause in if i need one?

              If I understand it correctly all I do is execute /home/homeseer/yourfilename eo and the "EO" at the end of the line is the 2 commands correct? Then all i need is the pause.

              Very cool solution!!!

              Thanks again Dale
              Can someone please let me know if I have this correct? Thanks

              Comment


                #8
                Can someone please let me know if I have this correct? Thanks
                Note that this is an example for Homeser on Linux. It is not clear if your configuration is Linux or Windows. In a single event that is triggered by the conditions when you want to close the door you will have two actions and a delay before the second action. Each action will be to launch a bash script. The first is to activate the relay and the second is to deactivate it. The delay amount is not critical so something like 5 seconds should work.

                Recognize that this remote relay accepts commands but does not provide status. This means you do not know if the command was recognized. If you have some other means to recognize the result of the relay action (door now closed) the it is not a problem.

                If you are on Windows a similiar approach can be used but your script will not be bash, but something that Windows recognizes such as vb.script.

                With simple ascii character being delivered via WiFi it may be less complex if the script is a socket rather than a serial command as .NET does sockets well. You would not need the driver to be installed as shown in their user manual.

                Comment


                  #9
                  Frustrated LOL

                  Michael

                  Thanks for the quick reply; however, i cannot even get the COMM port on Windows to recognize the relay or install the drivers. Quite frustrated tonight lol thanks.

                  Comment


                    #10
                    1/2 way there!

                    Michael,

                    I finally got HyperTerminal to connect to the Relay and configured it to log onto my wireless router. Now I am trying to figure out the scripting for a windows machine to send the host, port and signal to turn the relay on and off. If anyone can assist with the VB.NET (currently on HS2 converting to HS3 soon so would rather use the .net version since that is what is supported in HS3) and how to set it up in Homeseer I would be very grateful. Is it a TXT file and what/how does it need to work? New to scripting. Thank for your patience.

                    Thanks guys!
                    Last edited by DaleRS; December 28, 2014, 01:02 AM.

                    Comment


                      #11
                      No Need for Scripting

                      Hey everybody!

                      Thanks for all the feedback. I found a plugin "drhsIpPlugIn plug-in" from another thread that allows for output to IP/Serial that is exactly what i need so the plugin works in HS rather than external scripting much easier, for me anyway. LOL its a great plugin!!! Thanks again for the posts and help.... I am sure you will hear more from me when I convert to HS3 sometime soon!

                      Make sure you check this plugin out if you are trying to use this relay.

                      I have it up and running however sometimes when the event runs to trigger the relay it does not work trying to figure out if its the plugin or the TinySine relay. Let me know if you have had any "miss fire" issues with the Relay thanks!!!

                      Comment


                        #12
                        What you are seeing is the downside of one-way communications for this product. As mentioned earlier if you have some way to sense if the relay's command has resulted in a change then you can use this in event the event condition. Another approach you can take is similar to what is done with X10. Each X10 command is sent 4 times with the expectation that at least one of the four will be heard by the recipient. To do something like this you would setup you event to have action, delay, action, delay, action. This approach should work if your relay accepts discrete off and on commands. It cannot be used to improve chance of a toggle command being received.

                        Another approach is to dig deeper into communication and determine why sometimes it is missed. Once understood then try to fix it. For example a TCP communication has a connect, data, close sequence. The relay side server may be able to only accept one connection at a time. If the connection was not closed from the prior communication then it will not be able to accept a new one. It may have a timeout to always close connection after some specified period so after that period another connection could be established. I am not indicating that this is your situation, but just giving an example. Wireshark is what I would use to start looking at the lower lever communications to better understand what may be happening.

                        Comment

                        Working...
                        X