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. Troubleshooting
  3. 2 dallas temp + 4 relays

2 dallas temp + 4 relays

Scheduled Pinned Locked Moved Troubleshooting
39 Posts 6 Posters 3.2k Views 5 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.
  • dzjrD Offline
    dzjrD Offline
    dzjr
    wrote on last edited by
    #30

    I have it working!

    In "void setup" I removed the extra lines , and then it worked \ o /

    // Theo: initialize the array with 0.0 as a value.
    for (int i = 0; i < numSensors && i < MAX_ATTACHED_DS18B20; i++) {
      lastTemperature[MAX_ATTACHED_DS18B20] = 0.0;
    };
    

    @ rejoe2 i removed the " wait transport" ,
    I tried your Dallas_Addresses_Array_Solution sketch, I think that maybe there are some library adjustments given, because it did not work directly (I got 00000000 as message).
    By the way, if I disconnect one sensor, another sensor is set it place at the controller, if it is connected again then it is back to the original ID.

    I have changed this line (line 114)

    float temperature = static_cast<float>(static_cast<int>((metric ? sensors.getTempC(dallasAddresses[i]) : sensors.getTempF(dallasAddresses[i])) * 10.)) / 10.;
    

    into this: (from the example sketch at the build section)

    float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
    
    zboblamontZ 1 Reply Last reply
    0
    • dzjrD dzjr

      I have it working!

      In "void setup" I removed the extra lines , and then it worked \ o /

      // Theo: initialize the array with 0.0 as a value.
      for (int i = 0; i < numSensors && i < MAX_ATTACHED_DS18B20; i++) {
        lastTemperature[MAX_ATTACHED_DS18B20] = 0.0;
      };
      

      @ rejoe2 i removed the " wait transport" ,
      I tried your Dallas_Addresses_Array_Solution sketch, I think that maybe there are some library adjustments given, because it did not work directly (I got 00000000 as message).
      By the way, if I disconnect one sensor, another sensor is set it place at the controller, if it is connected again then it is back to the original ID.

      I have changed this line (line 114)

      float temperature = static_cast<float>(static_cast<int>((metric ? sensors.getTempC(dallasAddresses[i]) : sensors.getTempF(dallasAddresses[i])) * 10.)) / 10.;
      

      into this: (from the example sketch at the build section)

      float temperature = static_cast<float>(static_cast<int>((getControllerConfig().isMetric?sensors.getTempCByIndex(i):sensors.getTempFByIndex(i)) * 10.)) / 10.;
      
      zboblamontZ Offline
      zboblamontZ Offline
      zboblamont
      wrote on last edited by
      #31

      @dzjr said in 2 dallas temp + 4 relays:

      By the way, if I disconnect one sensor, another sensor is set it place at the controller, if it is connected again then it is back to the original ID.

      This is where the array method is advantageous, the child-IDs of the chip addresses are fixed consecutively in the array, remove the chip from the line and it's place remains vacant until replaced.

      1 Reply Last reply
      0
      • rejoe2R Offline
        rejoe2R Offline
        rejoe2
        wrote on last edited by
        #32

        @dzjr said in 2 dallas temp + 4 relays:

        MY_TRANSPORT_WAIT_READY_MS

        This flag is - amongst a lot of other stuff - explained here: https://www.mysensors.org/download/sensor_api_20.
        So putting it to (default) "0" will keep the node looking for an uplink to the GW until that one is really available. As I don't want that (my nodes have some logic of their own, I want to work independently), I added that. But in case, it's just sensors and so on, I'd recommend to stick with the defaults.

        Wrt. to the "metric"-topic: Please do always have a look at the entire sketch. In my sketches, typically the metric variable is just initialized once in setup(). Eg. in the array-sketch you'll find that in line 97.
        If you are looking for a "easy" way to replace single sensors and keeping the original order of the others, have a look at this one.

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

        dzjrD 1 Reply Last reply
        0
        • rejoe2R rejoe2

          @dzjr said in 2 dallas temp + 4 relays:

          MY_TRANSPORT_WAIT_READY_MS

          This flag is - amongst a lot of other stuff - explained here: https://www.mysensors.org/download/sensor_api_20.
          So putting it to (default) "0" will keep the node looking for an uplink to the GW until that one is really available. As I don't want that (my nodes have some logic of their own, I want to work independently), I added that. But in case, it's just sensors and so on, I'd recommend to stick with the defaults.

          Wrt. to the "metric"-topic: Please do always have a look at the entire sketch. In my sketches, typically the metric variable is just initialized once in setup(). Eg. in the array-sketch you'll find that in line 97.
          If you are looking for a "easy" way to replace single sensors and keeping the original order of the others, have a look at this one.

          dzjrD Offline
          dzjrD Offline
          dzjr
          wrote on last edited by
          #33

          @rejoe2

          thank you, now I understand how it works, had it tried without a wait and then the transport did not start well, not all nodes were visible in the MySController, with "wait" in the setup all node's are visible in the controller at a complete restart (in case of power failure)

          The current method with dallas sensors also works well for me, not me to change the sensors, but to always give the sensors a fixed child id in Domoticz.

          1 Reply Last reply
          0
          • rejoe2R Offline
            rejoe2R Offline
            rejoe2
            wrote on last edited by
            #34

            @dzjr Did you also try with the default value ("0") instead of 3000?
            I'm not familiar wir domoticz, but the need for another wait looks like a strange behaviour to me.

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

            dzjrD 1 Reply Last reply
            0
            • K Offline
              K Offline
              kimot
              wrote on last edited by
              #35

              For low number of DS18B20 and if you have got enough free pins,
              I suggest use separate Arduino pin for each DS18B20.
              Then your code is absolute universal and you always know, which pin what measure.
              Do not matter, which DS18B20 you use.
              With your method, you must read each DS18B20 signature - hardcoded it, compile and flash.
              When sensor needs replacement due to malfunction - whole process again.

              rejoe2R dzjrD 2 Replies Last reply
              0
              • K kimot

                For low number of DS18B20 and if you have got enough free pins,
                I suggest use separate Arduino pin for each DS18B20.
                Then your code is absolute universal and you always know, which pin what measure.
                Do not matter, which DS18B20 you use.
                With your method, you must read each DS18B20 signature - hardcoded it, compile and flash.
                When sensor needs replacement due to malfunction - whole process again.

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

                @kimot This consumes a lot of PINs, so it's a question what kind of trade-off you are looking for.
                As the 1Wire sensors have the option to address them correctly, I really like the advantage of reducing bus numbers. Just to remark: I also have at least one node running with 3 1Wire PINs - but each with a different timing :grin: . But if you are just worrying about replacement of single sensors, use something like that: https://github.com/rejoe2/MySensors-Dallas-Address-ChildID-Consistency. That only needs a restart between eacht replacement :smirk: .
                Or add OTA features to your nodes...

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

                1 Reply Last reply
                0
                • rejoe2R rejoe2

                  @dzjr Did you also try with the default value ("0") instead of 3000?
                  I'm not familiar wir domoticz, but the need for another wait looks like a strange behaviour to me.

                  dzjrD Offline
                  dzjrD Offline
                  dzjr
                  wrote on last edited by
                  #37

                  @rejoe2

                  Yes i tried is, i disable'd it in the sketch, but than the node's are nog presenting good to MYSController, only the update's are coming true but without the name's, only the first node give his client names.
                  So ik just use wait in void setup.

                  0_1546544175576_7235d3d6-97e7-4a34-b31e-5c67ac9b9147-image.png

                  1 Reply Last reply
                  0
                  • K kimot

                    For low number of DS18B20 and if you have got enough free pins,
                    I suggest use separate Arduino pin for each DS18B20.
                    Then your code is absolute universal and you always know, which pin what measure.
                    Do not matter, which DS18B20 you use.
                    With your method, you must read each DS18B20 signature - hardcoded it, compile and flash.
                    When sensor needs replacement due to malfunction - whole process again.

                    dzjrD Offline
                    dzjrD Offline
                    dzjr
                    wrote on last edited by
                    #38

                    @kimot
                    In this node i can do that, i had copied it from another sketch i used 8 dallas sensors and i just copied that to this sketch.

                    Perhaps i wil adjust the sketch and hardware.

                    1 Reply Last reply
                    0
                    • MGHaffM Offline
                      MGHaffM Offline
                      MGHaff
                      wrote on last edited by
                      #39

                      First of all. thank you guys for all the help! here is what i found out. When testing my hardware i found that alone with the MySensors Dallas sensors sketch i would get readings from my Dallas sensors in serial and at controller. With relay sketch alone i would get All 4 relays working in controller and in serial. But combined no Dallas temp in serial or controller. I rewired with new sensors, Arduino nano, radio! Finally digging through my stuff i found a new board from a batch ordered 2 years ago, wired it up on bread board and wallah! Apparently the last batch or boards i ordered must have not passed quality or damaged in shipping!! Thanks again for the support!! On a way brighter note I have address's assigned to my temp sensors now on all my nodes and have learned so much more about the MySensors network!

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


                      20

                      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