Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Announcements
  3. 💬 Relay

💬 Relay

Scheduled Pinned Locked Moved Announcements
139 Posts 47 Posters 33.9k Views 45 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lekeb
    wrote on last edited by
    #112

    correct, it makes sense. I will correct this error.
    However Domoticz reads correctly the temperature and links correctly the CHILD ID's, so...

    1 Reply Last reply
    0
    • Jonathan PucelJ Offline
      Jonathan PucelJ Offline
      Jonathan Pucel
      wrote on last edited by
      #113

      Hello everybody !

      I would like to creat a sensor with two relays and two buttons to command this relay direct from the sensor (with actualisation of their stat in domoticz)
      Someone know the code to do this ? I'm a complete newbie on mysensor !

      Thank's a lot !

      rejoe2R 1 Reply Last reply
      0
      • Jonathan PucelJ Jonathan Pucel

        Hello everybody !

        I would like to creat a sensor with two relays and two buttons to command this relay direct from the sensor (with actualisation of their stat in domoticz)
        Someone know the code to do this ? I'm a complete newbie on mysensor !

        Thank's a lot !

        rejoe2R Offline
        rejoe2R Offline
        rejoe2
        wrote on last edited by
        #114

        @jonathan-pucel Have a look at the code in this post.

        Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

        1 Reply Last reply
        1
        • Jonathan PucelJ Offline
          Jonathan PucelJ Offline
          Jonathan Pucel
          wrote on last edited by
          #115

          Excellent ! It's perfect, thank's a lot rejoe2 !

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mysz0n
            wrote on last edited by
            #116
            This post is deleted!
            1 Reply Last reply
            0
            • V Offline
              V Offline
              Vorace
              wrote on last edited by
              #117

              Hi
              Using Home assistant, and Optimistic set to false in the mysensors config, the switch in homeassistant would turn the relay on, but in the view in homeassistant the flip switch jumped off straight after switching on. It was solved by adding the following line to the sketch, ensuring that hassio knows that the actuator actually have received the command. Not sure if this is a good way of doing it, but it seems to work for me.
              send(msg.set(state)); // Send new state and request ack back
              in:
              void receive(const MyMessage &message) {
              // We only expect one type of message from controller. But we better check anyway.
              if (message.isAck()) {
              Serial.println("This is an ack from gateway");
              }

              if (message.type == V_LIGHT) {
              // Change relay state
              state = message.getBool();
              digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
              // Store state in eeprom
              saveState(CHILD_ID, state);

               // Write some debug info
               Serial.print("Incoming change for sensor:");
               Serial.print(message.sensor);
               Serial.print(", New status: ");
               Serial.println(message.getBool());
               send(msg.set(state)); // Send new state and request ack back
              

              }
              }

              Thanks

              1 Reply Last reply
              0
              • A Offline
                A Offline
                arraWX
                wrote on last edited by arraWX
                #118

                Hi!

                I would like to control some 230VAC equipment (for now roller shutters), based on inputs from my mysensors sensors (temperature and light). For controller I use domoticz.

                I would like a safe, robust and preferably authorized/lawful solution (I'm in EU/Denmark).

                I came across the following solutions:

                https://aeotec.com/z-wave-plug-in-switch
                https://sonoff.itead.cc/en/products/sonoff/sonoff-basic
                https://dlidirect.com/products/iot-power-relay

                I think the first one and maybe the second one will be authorized/lawful...? However, I have experience only with mysensors and neither z wave nor sonoff...

                Anyone has some experience/thoughts/suggestions to share?

                Thanks.

                1 Reply Last reply
                0
                • gohanG Offline
                  gohanG Offline
                  gohan
                  Mod
                  wrote on last edited by
                  #119

                  There are also roller shutters nodes running via zwave if you are looking at a retail solution

                  A 1 Reply Last reply
                  1
                  • gohanG gohan

                    There are also roller shutters nodes running via zwave if you are looking at a retail solution

                    A Offline
                    A Offline
                    arraWX
                    wrote on last edited by arraWX
                    #120

                    Thank you @gohan! Retail solution is not the keyword here. What I am searching for is an authorized/lawful (safe) solution.

                    I decided to do my own node (mysensors) with a cheap relay module for the arduino. Once I achieve the desired functionality I will change to some more robust hardware. Following your suggestion this could be a z wave roller shutter (e.g. fibaro or qubino).

                    bjacobseB 1 Reply Last reply
                    0
                    • A arraWX

                      Thank you @gohan! Retail solution is not the keyword here. What I am searching for is an authorized/lawful (safe) solution.

                      I decided to do my own node (mysensors) with a cheap relay module for the arduino. Once I achieve the desired functionality I will change to some more robust hardware. Following your suggestion this could be a z wave roller shutter (e.g. fibaro or qubino).

                      bjacobseB Offline
                      bjacobseB Offline
                      bjacobse
                      wrote on last edited by
                      #121

                      @arrawx said in 💬 Relay:

                      Retail solution is not the keyword here. What I am searching for is an authorized/lawful (safe) solution.

                      Sorry to comment negative, but your wording doesn't make sense. either you will go for a DIY solution, cheap and illegal (but not necessary a bad solution), or you will purchase a retail solution.
                      Retail solution must have the required certificates to allow you to sell. Those are not cheap to get, which also provide the reason for a retail solution to
                      be usually fairly expensive
                      https://arbejdstilsynet.dk/da/regler/bekendtgorelser/i/sam-indretning-af-tekniske-hjaelpemidler-612

                      And also you need Notified Body
                      https://en.wikipedia.org/wiki/Notified_Body

                      And I know that Cetekom can create certificate for Country Approvals
                      https://www.cetecom.com/en/certification/country-appoval/

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        slt1
                        wrote on last edited by
                        #122

                        There is a problem with the example code for RelayActuator.ino It is not checking for ACK messages. See the other example called SecureActuator.ino that does this. Without checking for ACK messages my relay gets an ON signal and turns on then immediately thereafter gets an ACK signal for V_STATUS command which is assumed in this example to be a control and the value is "0" so it turns off the relay.

                        mfalkviddM 1 Reply Last reply
                        1
                        • S slt1

                          There is a problem with the example code for RelayActuator.ino It is not checking for ACK messages. See the other example called SecureActuator.ino that does this. Without checking for ACK messages my relay gets an ON signal and turns on then immediately thereafter gets an ACK signal for V_STATUS command which is assumed in this example to be a control and the value is "0" so it turns off the relay.

                          mfalkviddM Offline
                          mfalkviddM Offline
                          mfalkvidd
                          Mod
                          wrote on last edited by
                          #123

                          @slt1 I'm not sure I'm following. RelayActuator.ino does not send any messages, so it should never receive any ack messages. Compare with RelayWithButtonActuator.ino which does send messages, and therefore also checks for ack.

                          Could you elaborate on the problem?

                          S 1 Reply Last reply
                          0
                          • mfalkviddM mfalkvidd

                            @slt1 I'm not sure I'm following. RelayActuator.ino does not send any messages, so it should never receive any ack messages. Compare with RelayWithButtonActuator.ino which does send messages, and therefore also checks for ack.

                            Could you elaborate on the problem?

                            S Offline
                            S Offline
                            slt1
                            wrote on last edited by slt1
                            #124

                            @mfalkvidd

                            For some reason I am now unable to reproduce the issue on the standard RelayActuator.ino example. It was definitely sending ACK requests when I was testing a few days ago. I have subsequently updated MySensors library and also MyController to their latest Snapshot - so perhaps the issue comes up under one of those scenarios.

                            The issue around this though is that the example does not report the current status of the relay in the loop. My own sketch was doing so. I guess many people take an example and modify it like I do. Therefore copying the example and adding in the code to send the current relay status periodically means the receive function will not work properly due to the Ack messages received,

                            I would then suggest adding a note to the receive function of the relay example sketch to say that "if your node sends messages then you need to check for Ack and discard those messages" - or something along those lines. This will help !

                            mfalkviddM 2 Replies Last reply
                            1
                            • S slt1

                              @mfalkvidd

                              For some reason I am now unable to reproduce the issue on the standard RelayActuator.ino example. It was definitely sending ACK requests when I was testing a few days ago. I have subsequently updated MySensors library and also MyController to their latest Snapshot - so perhaps the issue comes up under one of those scenarios.

                              The issue around this though is that the example does not report the current status of the relay in the loop. My own sketch was doing so. I guess many people take an example and modify it like I do. Therefore copying the example and adding in the code to send the current relay status periodically means the receive function will not work properly due to the Ack messages received,

                              I would then suggest adding a note to the receive function of the relay example sketch to say that "if your node sends messages then you need to check for Ack and discard those messages" - or something along those lines. This will help !

                              mfalkviddM Offline
                              mfalkviddM Offline
                              mfalkvidd
                              Mod
                              wrote on last edited by
                              #125

                              @slt1 thanks for explaining.

                              I'll think about it for a bit but I hope to submit a pull request soon. I'll post here when it is ready.

                              1 Reply Last reply
                              0
                              • S slt1

                                @mfalkvidd

                                For some reason I am now unable to reproduce the issue on the standard RelayActuator.ino example. It was definitely sending ACK requests when I was testing a few days ago. I have subsequently updated MySensors library and also MyController to their latest Snapshot - so perhaps the issue comes up under one of those scenarios.

                                The issue around this though is that the example does not report the current status of the relay in the loop. My own sketch was doing so. I guess many people take an example and modify it like I do. Therefore copying the example and adding in the code to send the current relay status periodically means the receive function will not work properly due to the Ack messages received,

                                I would then suggest adding a note to the receive function of the relay example sketch to say that "if your node sends messages then you need to check for Ack and discard those messages" - or something along those lines. This will help !

                                mfalkviddM Offline
                                mfalkviddM Offline
                                mfalkvidd
                                Mod
                                wrote on last edited by
                                #126

                                @slt1 sending current status won't generate an ack/echo message. So there should not be a need to handle the ack/echo flag. Hardware acks (which are enabled by default) do not trigger the receive function.

                                The only case when an ack/echo message will be sent is if the sketch developer explicitly requests an ack/echo by setting the ack parameter in send() to true. If the sketch developer does that, they need to handle the ack/echo message inside the receive function, according to however they plan to handle the ack/echo message.

                                My guess is that people set the ack flag to true without understanding what they are doing. I hope to make the documentation slightly less confusing by doing https://github.com/mysensors/MySensors/issues/1103

                                S 1 Reply Last reply
                                0
                                • mfalkviddM mfalkvidd

                                  @slt1 sending current status won't generate an ack/echo message. So there should not be a need to handle the ack/echo flag. Hardware acks (which are enabled by default) do not trigger the receive function.

                                  The only case when an ack/echo message will be sent is if the sketch developer explicitly requests an ack/echo by setting the ack parameter in send() to true. If the sketch developer does that, they need to handle the ack/echo message inside the receive function, according to however they plan to handle the ack/echo message.

                                  My guess is that people set the ack flag to true without understanding what they are doing. I hope to make the documentation slightly less confusing by doing https://github.com/mysensors/MySensors/issues/1103

                                  S Offline
                                  S Offline
                                  slt1
                                  wrote on last edited by slt1
                                  #127

                                  @mfalkvidd Thanks - and yes - I did make the assumption that send with ack = true means do a hardware ack. I was unaware that a "software ack" also exists. I read your comment here : https://forum.mysensors.org/topic/3346/discussion-reliable-delivery/17 and what you mention there needs to be made loud and clear in the docs - perhaps some mention in both the message send function and message receive function,

                                  mfalkviddM 1 Reply Last reply
                                  0
                                  • S slt1

                                    @mfalkvidd Thanks - and yes - I did make the assumption that send with ack = true means do a hardware ack. I was unaware that a "software ack" also exists. I read your comment here : https://forum.mysensors.org/topic/3346/discussion-reliable-delivery/17 and what you mention there needs to be made loud and clear in the docs - perhaps some mention in both the message send function and message receive function,

                                    mfalkviddM Offline
                                    mfalkviddM Offline
                                    mfalkvidd
                                    Mod
                                    wrote on last edited by
                                    #128

                                    @slt1 I agree. Made the same mistake and it took me 40 hours of reading documentation and troubleshooting before I realized there was a difference between the two acks.

                                    1 Reply Last reply
                                    0
                                    • B Offline
                                      B Offline
                                      b0wi
                                      wrote on last edited by
                                      #129

                                      The script for 'Example with button' works perfectly! Thanks for that.
                                      Has someone a script for multiple Relays with buttons ready to use for me?
                                      I want to use it in my garden to switch the lights with physical buttons and also control them with Domoticz.

                                      1 Reply Last reply
                                      0
                                      • J Offline
                                        J Offline
                                        jimmy loyens
                                        wrote on last edited by jimmy loyens
                                        #130
                                        This post is deleted!
                                        1 Reply Last reply
                                        0
                                        • badmannenB Offline
                                          badmannenB Offline
                                          badmannen
                                          wrote on last edited by badmannen
                                          #131

                                          I am having this particular switch to be recognized in "Mozilla WEBTHINGS".

                                          IS there some issue with having a repeater node and sensors/switches etc attaches to it? .. it sends in the data as it should when I check with MYSController and I can switch it from there with sending "V_STATUS" messages. but no luck so far of getting the sensors appear in WEBTHINGS , every other sensor works fine.

                                          rPi 3 - UNO R3 - Mini - Nano - custom

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          17

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular