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. Development
  3. Mysensors protocol requirements

Mysensors protocol requirements

Scheduled Pinned Locked Moved Development
6 Posts 2 Posters 2.0k Views 1 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.
  • J Offline
    J Offline
    jokkemokke
    wrote on last edited by
    #1

    Hi. I have made an Arduino sketch that communicates with my PC using the Mysensors protocol. However, I am not using the Mysensors library, but done my own implementation of the protocol.

    The reason for this approach is that I have mounted a 433 MHz receiver and transmitter on the Arduino. The receiver I use for receiving the signal directly from my weather station in the garden and the transmitter I use for sending commands directly to some cheap RF plugs.

    In other words, the units I communicate with on 433 MHz are not Mysensors units, and my Arduino sketch is just translating the signal to/from the 433 MHz units to the Mysensors protocol. In this way I can use existing home automation software that already supports Mysensors.

    So far I have tested it with Domotics and MYSController, and everything seems to work just fine. However, I have a few questions to the Mysensors protocol that I hope you can help me with:

    1:
    Is it required/mandatory that each sensors/actuator sends a presentation message? This would be troublesome for me to implement, since my "gateway" sketch does not know which sensors/actuators I have when it boots up. Normally the sensors/actuators would send the presentation message themselves when they are booted, but this does of course not happen in my case, since my sensors/actuators that communicates on 433MHz are not Mysensors devices. Both Domoticz and MYSController seems to register the sensors the first time they send a message (for example the first time the weather station sends the temperature). Is it ok to do it like this, or could there be any cases where this could cause problems?

    2:
    At the moment my sketch does not support Ack, meaning that all Mysensors messaages I send to the PC have Ack parameter set to 0, and the sketch does not do anything if it receives and message from the PC where the Ack parameter is set to 1. If it is required to support Ack, then how does the aknowledge telegram look like, and what should be done if no acknowledge is received?

    3:
    In which cases would the req message type be used?

    4:
    Are there any of the internal messages that are required/mandatory to be supported in my sketch?

    Thanks.

    hekH 1 Reply Last reply
    0
    • J jokkemokke

      Hi. I have made an Arduino sketch that communicates with my PC using the Mysensors protocol. However, I am not using the Mysensors library, but done my own implementation of the protocol.

      The reason for this approach is that I have mounted a 433 MHz receiver and transmitter on the Arduino. The receiver I use for receiving the signal directly from my weather station in the garden and the transmitter I use for sending commands directly to some cheap RF plugs.

      In other words, the units I communicate with on 433 MHz are not Mysensors units, and my Arduino sketch is just translating the signal to/from the 433 MHz units to the Mysensors protocol. In this way I can use existing home automation software that already supports Mysensors.

      So far I have tested it with Domotics and MYSController, and everything seems to work just fine. However, I have a few questions to the Mysensors protocol that I hope you can help me with:

      1:
      Is it required/mandatory that each sensors/actuator sends a presentation message? This would be troublesome for me to implement, since my "gateway" sketch does not know which sensors/actuators I have when it boots up. Normally the sensors/actuators would send the presentation message themselves when they are booted, but this does of course not happen in my case, since my sensors/actuators that communicates on 433MHz are not Mysensors devices. Both Domoticz and MYSController seems to register the sensors the first time they send a message (for example the first time the weather station sends the temperature). Is it ok to do it like this, or could there be any cases where this could cause problems?

      2:
      At the moment my sketch does not support Ack, meaning that all Mysensors messaages I send to the PC have Ack parameter set to 0, and the sketch does not do anything if it receives and message from the PC where the Ack parameter is set to 1. If it is required to support Ack, then how does the aknowledge telegram look like, and what should be done if no acknowledge is received?

      3:
      In which cases would the req message type be used?

      4:
      Are there any of the internal messages that are required/mandatory to be supported in my sketch?

      Thanks.

      hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by hek
      #2

      @jokkemokke

      1. Some controllers rely on and use the presentation message to know which device to create. When you receive a 433Mhz message can you determine it's type? Couldn't you just send the presentation message the first time (after startup) you receive a message from a new 433-sender?

      2. That is fine.

        If you send out a message with request-for-ack enabled from controller. The message travels all the way to its final destination. The library then issues an ack message which is sent back to gateway. Gateway produces a serial message with the ack parameter set to 1. Normal incoming sensor-data has ack set to 0 (as it isn't an ack).

        In your case you don't need to handle this as I imagine your don't have any actuators that you want to control? If you do... then just send the same message back to controller to simulate the ack-behaviour (when controller requests an ack).

      3. The req message type is used to request data from a node. It is up to the node to handle the reply. I don't think you need to implement this.

      4. You should probably answer the version request (I_VERSION) message. And send a startup-complete message when you have everything up and running in your gateway. (I_GATEWAY_READY),

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jokkemokke
        wrote on last edited by
        #3

        Thanks for the reply.

        You write that the sketch should send I_GATEWAY_READY to the controller when it has finished starting up. But how can I be sure that a controller is connected and that this message will be seen (I guess the same goes for the presentation messages).

        My sketch communicates with the controller using ethernet. The ethernet part is handled the same way as in the EthernetGateway sketch from the Mysensors library. This sketch uses the client.available(), but this function does not return anything unless the controller actually sends some data (it does not return when the controller connects).

        So I am wondering how I can see when a controller is connected, so that I know when I should start sending the messages that only are send during startup.

        1 Reply Last reply
        0
        • hekH Offline
          hekH Offline
          hek
          Admin
          wrote on last edited by
          #4

          You can send it the first time you have something available from a new client.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jokkemokke
            wrote on last edited by
            #5

            But teoretically it could take forever before the controller sends something to the gateway, since it seems that it only sends a message if you press a button in the controller to activate a actuator or something.

            Maybe it would be better to have a delay in the sketch before it sends the startup message to the controller, and the hope that a controller connects during this delay?

            1 Reply Last reply
            0
            • hekH Offline
              hekH Offline
              hek
              Admin
              wrote on last edited by
              #6

              I cannot answer for all controller implementations. But the Vera-plugin asks for version when it start up.

              https://github.com/mysensors/Vera/blob/master/L_Arduino.lua#L650

              This is how we do it in the dev-branch
              https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/examples/EthernetGateway/EthernetGateway.ino#L177

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


              25

              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