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. How v2 Gateway with local sensors to delay messages?

How v2 Gateway with local sensors to delay messages?

Scheduled Pinned Locked Moved Development
3 Posts 2 Posters 1.2k Views 2 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.
  • TriXwooDT Offline
    TriXwooDT Offline
    TriXwooD
    wrote on last edited by
    #1

    If trying to understand how to add a local sensor to a mysensors v2 gateway.

    void loop() {
    // Send locally attached sensor data here
    ...
    send(voltage_msg.set(voltage / 1000.0, 3));

    }

    I want to add a sensor here. I did and it send like every second (seen in the log of domoticz). So what do I do to only send like every 30 seconds a sensor value?

    mfalkviddM 1 Reply Last reply
    0
    • TriXwooDT TriXwooD

      If trying to understand how to add a local sensor to a mysensors v2 gateway.

      void loop() {
      // Send locally attached sensor data here
      ...
      send(voltage_msg.set(voltage / 1000.0, 3));

      }

      I want to add a sensor here. I did and it send like every second (seen in the log of domoticz). So what do I do to only send like every 30 seconds a sensor value?

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

      Welcome to MySensors @TriXwooD !

      You use sleep() or wait(). sleep() if you don't expect incoming radio messages, wait() if you do.

      See https://www.mysensors.org/download/sensor_api_20#waiting for details

      You can also look at one of the examples, like https://github.com/mysensors/MySensors/blob/development/examples/LightSensor/LightSensor.ino

      1 Reply Last reply
      0
      • TriXwooDT Offline
        TriXwooDT Offline
        TriXwooD
        wrote on last edited by TriXwooD
        #3

        Yes I got that from the examples. But my question is: on the gateway itself, which has to do something to talk to the other nodes (?). If I add a sensor to the gateway itself, then what do I do? Can I use sleep()? will the gateway function properly?

        Ok I tried wait(), for some reason wait() did not worked before, (got only one message) now it works...

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


        6

        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