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. Controllers
  3. Domoticz
  4. gw.request - how is it done?

gw.request - how is it done?

Scheduled Pinned Locked Moved Domoticz
15 Posts 4 Posters 6.0k Views 4 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.
  • hekH Offline
    hekH Offline
    hek
    Admin
    wrote on last edited by
    #4

    Hook up the sensor to Arduino IDE and look in serial monitor.

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hyla
      wrote on last edited by
      #5

      Okay. Did that already, of course. :)
      Let's start from something known. I've used the demo code for
      the EnergyMeterPulseSensor Example. All I changed is the Node_ID
      (to 123). Did this in:

      gw.begin(incomingMessage, NODE_ID, false);

      And I am sending a demo value to V_VAR1:

      gw.send(pcMsg.set(123456));
      This does get sent obviously. In the Domoticz.db file I can find that value
      in the "MySensorsVar" table. After having sent the value I remove this line.

      And this is what I get (b.t.w.: how do I decipher those messages? This is
      not the format that is used in the MySensors SerialProtocol document):

      send: 123-123-0-0 s=255,c=0,t=17,pt=0,l=3,sg=0,st=ok:1.5
      send: 123-123-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
      sensor started, id=123, parent=0, distance=1
      send: 123-123-0-0 s=255,c=3,t=11,pt=0,l=12,sg=0,st=ok:Energy Meter
      send: 123-123-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
      send: 123-123-0-0 s=0,c=0,t=13,pt=0,l=0,sg=0,st=ok:
      send: 123-123-0-0 s=0,c=2,t=24,pt=0,l=0,sg=0,st=ok:
      send: 123-123-0-0 s=0,c=2,t=24,pt=0,l=0,sg=0,st=ok:
      send: 123-123-0-0 s=0,c=2,t=24,pt=0,l=0,sg=0,st=ok:
      send: 123-123-0-0 s=0,c=2,t=24,pt=0,l=0,sg=0,st=ok:
      send: 123-123-0-0 s=0,c=2,t=24,pt=0,l=0,sg=0,st=ok:
      read: 12-13-0 s=0,c=1,t=1,pt=7,l=5,sg=0:46.6
      send: 123-123-0-0 s=0,c=2,t=24,pt=0,l=0,sg=0,st=ok:
      send: 123-123-0-0 s=0,c=2,t=24,pt=0,l=0,sg=0,st=ok:
      send: 123-123-0-0 s=0,c=2,t=24,pt=0,l=0,sg=0,st=ok:
      send: 123-123-0-0 s=0,c=2,t=24,pt=0,l=0,sg=0,st=ok:

      and so on.
      Some of this I understand (I think). What about the lonesome "read" line?
      As I already wrote: it doesn't look like the routine...

      void incomingMessage(const MyMessage &message)

      ... is ever entered.

      What else can I tell You?

      Christoph

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

        Ok, guess you have to ask someone over at Domoticz forum if it even supports REQ/VARx.

        1 Reply Last reply
        0
        • H Offline
          H Offline
          hyla
          wrote on last edited by
          #7

          Okay, will do.
          But apart from that: really nobody here with Domoticz who successfully worked with
          "request"? Can't believe that...

          Thanks,
          Christoph

          1 Reply Last reply
          0
          • H Offline
            H Offline
            hyla
            wrote on last edited by
            #8

            Hi,

            this is my workaround for my problem:
            Ive added a 1F goldcap capacitor as an emergency power supply.
            If my powersupply voltage drops a routine is called which stores
            the current counter value via gw.setState() and then enters an
            endless loop. And an LED is switched on to empty the capacitor.
            Next time the sensor boots up, first thing it'll do is to retrieve the
            old value for the pulsecount from the EEPROM.

            With this I can use the setstate function in case it's necessary
            but I don't have to write to the EEPROM continuously which
            wouldn't work for long (100k write cycle limit).

            It's probably not failsafe. For example: what happens if there
            are multiple reboots because the brownout watchdog "barks"
            and the final power cut happens while the EEPROM is written to?

            But for now it seems to work. Dah!

            :)
            Christoph

            1 Reply Last reply
            0
            • M Offline
              M Offline
              Mediacj
              wrote on last edited by
              #9

              Interesting workaround!

              Could you please share your sketch?

              H 1 Reply Last reply
              0
              • sundberg84S Offline
                sundberg84S Offline
                sundberg84
                Hardware Contributor
                wrote on last edited by sundberg84
                #10

                I have made a sketch requesting VVAR1 from Domoticz. It didnt work with the stable version but better with the beta.
                But as i wrote in this post im still having issues with getting the request back: http://forum.mysensors.org/topic/2116/hard-to-grab-time-and-value-sent-from-controller

                The sketch is in the link, but its a rain gauge.

                Controller: Proxmox VM - Home Assistant
                MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                H 1 Reply Last reply
                1
                • H Offline
                  H Offline
                  hyla
                  wrote on last edited by
                  #11

                  @Mediacj sure. It's not cleaned up. And a hack of various sources.
                  I guess You won't mind ;)
                  EnergyMeterPulseSensorGrace.ino

                  The fun stuff happens in the void graceful() routine.

                  First of all You'll have to run this line once to set Your startup value:
                  pulseCount = ((1912810 * PULSE_FACTOR / 10) + 5) / 10; graceful();

                  After that You can comment this out and hopefully won't ever need it again :)
                  With the next booting of the sensor the value will be read from the EEPROM:

                  pulseCount = 0;
                  pulseCount += gw.loadState(GRACE + 3); // get highest byte
                  pulseCount *= 256;
                  pulseCount += gw.loadState(GRACE + 2);
                  pulseCount *= 256;
                  (and so on).

                  If the pre-voltage-regulator voltage drops the gold cap will still hold enough power
                  to save the current value to the EEPROM.

                  Still. I'd much prefer the software solution ...

                  Christoph

                  1 Reply Last reply
                  0
                  • sundberg84S sundberg84

                    I have made a sketch requesting VVAR1 from Domoticz. It didnt work with the stable version but better with the beta.
                    But as i wrote in this post im still having issues with getting the request back: http://forum.mysensors.org/topic/2116/hard-to-grab-time-and-value-sent-from-controller

                    The sketch is in the link, but its a rain gauge.

                    H Offline
                    H Offline
                    hyla
                    wrote on last edited by
                    #12

                    @sundberg84 I'll have a look at that.
                    I've just tried the TimeAwareSensor example mentioned and it doesn't work.
                    But I DO get some reads, as far as I could see I got them from those
                    sensors that are repeater enabled.
                    But NEVER anything from "GW". WHat's it's address anyway?

                    Christoph

                    1 Reply Last reply
                    0
                    • M Mediacj

                      Interesting workaround!

                      Could you please share your sketch?

                      H Offline
                      H Offline
                      hyla
                      wrote on last edited by
                      #13

                      @Mediacj

                      You guessed it:

                      pulseCount = ((1912810 * PULSE_FACTOR / 10) + 5) / 10; graceful();
                      You don't use the number 1912810 of course: that's just my kWh at the time I started, MULTIPLYED BY 100!

                      Christoph

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        Mediacj
                        wrote on last edited by
                        #14

                        Thanks for sharing!!

                        Yes it would be better to have a stable software solution but your solution is good also and even safer when there is a power failure!

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          Mediacj
                          wrote on last edited by Mediacj
                          #15

                          Gizmocuz has a working sketch example

                          I have successfully used it.

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


                          11

                          Online

                          11.7k

                          Users

                          11.2k

                          Topics

                          113.0k

                          Posts


                          Copyright 2019 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