Skip to content
  • 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. Handling NACKs
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

Handling NACKs

Scheduled Pinned Locked Moved Development
44 Posts 9 Posters 445 Views 13 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.
  • mfalkviddM mfalkvidd

    As expected, there have been no errors recorded. The number of TX OK per hour is constant.
    Domoticz log file shows that the gateway reports every 5 minutes.
    usage-last-7-days.png

    Maybe the gateway should look at INDICATION_GW_TX.

    sundberg84S Offline
    sundberg84S Offline
    sundberg84
    Hardware Contributor
    wrote on last edited by sundberg84
    #26

    @mfalkvidd - INDICATION_GW_TX sounds like a good plan. This is a great tool I think for the future to evaluate and debug your network. I used S_CUSTOM and a utility meter (hourly) in HA to get the values.

    Just started up, first values in - will report back when I have more data:
    No errors so far :)

    Just so I understand: case INDICATION_ERR_TX: means NACK ?

    ded136f0-d906-4102-bfc6-daa433bf8763-image.png

    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

    mfalkviddM 1 Reply Last reply
    1
    • sundberg84S sundberg84

      @mfalkvidd - INDICATION_GW_TX sounds like a good plan. This is a great tool I think for the future to evaluate and debug your network. I used S_CUSTOM and a utility meter (hourly) in HA to get the values.

      Just started up, first values in - will report back when I have more data:
      No errors so far :)

      Just so I understand: case INDICATION_ERR_TX: means NACK ?

      ded136f0-d906-4102-bfc6-daa433bf8763-image.png

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

      @sundberg84 I think so.

      https://github.com/mysensors/MySensors/blob/79d7977cff47555d7bc812036caa6159df9cc8c7/core/MyTransport.cpp#L560 (I've cut out some code for brevity)

      	const bool result = transportSendWrite(route, message);
      #if !defined(MY_GATEWAY_FEATURE)
      	// update counter
      	if (route == _transportConfig.parentNodeId) {
      
      		if (!result) {
      			setIndication(INDICATION_ERR_TX);
      			_transportSM.failedUplinkTransmissions++;
      		} else {
      			_transportSM.failedUplinkTransmissions = 0u;
      		}
      	}
      #else
      	if(!result) {
      		setIndication(INDICATION_ERR_TX);
      	}
      #endif
      
      

      https://github.com/mysensors/MySensors/blob/79d7977cff47555d7bc812036caa6159df9cc8c7/core/MyTransport.h#L433

      /**
      * @brief Send message to recipient
      * @param to Recipient of message
      * @param message
      * @return true if message sent successfully
      */
      

      I guess we could use _transportSM.failedUplinkTransmissions instead of using our own counter.

      1 Reply Last reply
      1
      • electrikE Offline
        electrikE Offline
        electrik
        wrote on last edited by
        #28

        @mfalkvidd said in Handling NACKs:

        I guess we could use _transportSM.failedUplinkTransmissions instead of using our own counter.

        That one is reset when a message is sent successfully, and we want to know the total number of failed msgs right?

        mfalkviddM 1 Reply Last reply
        0
        • electrikE electrik

          @mfalkvidd said in Handling NACKs:

          I guess we could use _transportSM.failedUplinkTransmissions instead of using our own counter.

          That one is reset when a message is sent successfully, and we want to know the total number of failed msgs right?

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

          @electrik I see. Good point.

          sundberg84S 1 Reply Last reply
          0
          • mfalkviddM mfalkvidd

            @electrik I see. Good point.

            sundberg84S Offline
            sundberg84S Offline
            sundberg84
            Hardware Contributor
            wrote on last edited by
            #30

            Something strange happened last hour:

            521328c2-1331-4efb-8998-956c027748f7-image.png

            But atleast now I know something is up.

            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

            skywatchS mfalkviddM 2 Replies Last reply
            1
            • sundberg84S sundberg84

              Something strange happened last hour:

              521328c2-1331-4efb-8998-956c027748f7-image.png

              But atleast now I know something is up.

              skywatchS Offline
              skywatchS Offline
              skywatch
              wrote on last edited by
              #31

              @sundberg84 said in Handling NACKs:

              Something strange happened last hour:

              @sundberg84 - OMG, I have sat through whole flims with less suspense than this thread! ......

              1 Reply Last reply
              1
              • sundberg84S sundberg84

                Something strange happened last hour:

                521328c2-1331-4efb-8998-956c027748f7-image.png

                But atleast now I know something is up.

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

                @sundberg84 that's a very nice visual representation. Could you share how you set that up in HA?

                sundberg84S 1 Reply Last reply
                0
                • mfalkviddM mfalkvidd

                  @sundberg84 that's a very nice visual representation. Could you share how you set that up in HA?

                  sundberg84S Offline
                  sundberg84S Offline
                  sundberg84
                  Hardware Contributor
                  wrote on last edited by
                  #33

                  @mfalkvidd - its accually Grafana and Influx database. So HA sends values to Influx which are visually presented in Grafana. Im sure you can do this from Domoticz as well... there are some limitations in Influx db so I might change to another database in the future which suits me better.

                  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

                  mfalkviddM 1 Reply Last reply
                  0
                  • sundberg84S sundberg84

                    @mfalkvidd - its accually Grafana and Influx database. So HA sends values to Influx which are visually presented in Grafana. Im sure you can do this from Domoticz as well... there are some limitations in Influx db so I might change to another database in the future which suits me better.

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

                    @sundberg84 sorry for going off topic, but what limitations have you experienced?

                    I've been thinking about using something better than Domoticz for a long time. Maybe Grafana is the way to go.

                    BearWithBeardB sundberg84S 2 Replies Last reply
                    0
                    • mfalkviddM mfalkvidd

                      @sundberg84 sorry for going off topic, but what limitations have you experienced?

                      I've been thinking about using something better than Domoticz for a long time. Maybe Grafana is the way to go.

                      BearWithBeardB Offline
                      BearWithBeardB Offline
                      BearWithBeard
                      wrote on last edited by BearWithBeard
                      #35

                      @mfalkvidd Domoticz is a full-blown home automation system, isn't it? Grafana is just a monitoring dashboard that pulls data from a time-series database (like InfluxDB) and generates fancy graphs. It can't automate and control things or send commands other than alarms (eg. if a value exceeds a threshold, or no new data came in since x minutes, send an email).

                      One of InfluxDBs limitations is that you can't use (or only some basic) math operations on db queries, which may limit what you can graph in Grafana. Also, changing data types of existing fields in measurements is also not possible, which is annoying, because Grafana treats values differently based on their data type. @sundberg84 can probably name more limitations. I'd love to switch to Carbon / Graphite for data collection and storage... if only it wouldn't take time to read up, setup and migrate all the data. :tired_face:

                      By the way - great idea to use the indication handler to log radio reliability! :+1: Definitely going to implement this on my gateways repeaters when I find the time.

                      1 Reply Last reply
                      2
                      • mfalkviddM mfalkvidd

                        @sundberg84 sorry for going off topic, but what limitations have you experienced?

                        I've been thinking about using something better than Domoticz for a long time. Maybe Grafana is the way to go.

                        sundberg84S Offline
                        sundberg84S Offline
                        sundberg84
                        Hardware Contributor
                        wrote on last edited by sundberg84
                        #36

                        @mfalkvidd - @BearWithBeard said it. The limitations are mostly math related. For example, you cant show a graph with current and last years values (timeshift) on the same graph due to that limitation in InfluxDB. I want to compare power usage this day to same day last year - not possible. Im looking to change to Graphite as well instead of Influx.

                        Moving from Domoticz to HA was a great move for me, but not as i thought. Im using HA more or less just as an umbrella. I would say im using only the OS Hass.IO and not using Home Assistant that much. Whats good in Home Assistant is that its quite easy to integrate different protocolls like MySensors or whatever you use. But after that I dont use Home Assistant but the great possibilities to have add-ons on Hass.IO. I use Node Red for all my automations (Extremly easy compared to code!), Influx + Grafana for visual, motionEyeOs for camera secutiry and more... all you have to do is install the addon from the "store" and you are more or less ready to go. These addons im sure you can install with domoticz as well if you like the integrations with the different protocolls there.

                        i think we have handeled the NACK questions so no worries for me if we go off topic, but if you rather like send me a dm.

                        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

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

                          I just love this idea. Implemented the code on my second now, one to go.

                          c33a129c-12ef-4a22-a966-d7c0dbe3847b-image.png

                          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

                          mfalkviddM 1 Reply Last reply
                          1
                          • sundberg84S sundberg84

                            I just love this idea. Implemented the code on my second now, one to go.

                            c33a129c-12ef-4a22-a966-d7c0dbe3847b-image.png

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

                            @sundberg84 very nice. I'm happy we were able to implement it with so little effort. What does your graph look like now?

                            Mine is very boring, as I suspected. Don't have any outgoing traffic from my GW. Will have to add it to my nodes to get any useful data.

                            4c010679-17fa-4779-ac38-84b3642f3056-image.png
                            7fc8c6a8-6006-4fc7-a189-ab2d2e9dce05-image.png

                            sundberg84S 1 Reply Last reply
                            0
                            • mfalkviddM mfalkvidd

                              @sundberg84 very nice. I'm happy we were able to implement it with so little effort. What does your graph look like now?

                              Mine is very boring, as I suspected. Don't have any outgoing traffic from my GW. Will have to add it to my nodes to get any useful data.

                              4c010679-17fa-4779-ac38-84b3642f3056-image.png
                              7fc8c6a8-6006-4fc7-a189-ab2d2e9dce05-image.png

                              sundberg84S Offline
                              sundberg84S Offline
                              sundberg84
                              Hardware Contributor
                              wrote on last edited by sundberg84
                              #39

                              @mfalkvidd i didnt fins time yet to implement more. But very good for two repeaters.

                              Screenshot_20200225-100340.png

                              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

                              E 1 Reply Last reply
                              1
                              • alowhumA Offline
                                alowhumA Offline
                                alowhum
                                Plugin Developer
                                wrote on last edited by
                                #40

                                Very cool stuff.

                                @mfalkvidd Would it be possible to create the functionality, but to measure the successrate of outgoing messages from the gateway node?

                                For example, I'l love to be able to see how often the controller/gateway tries to toggle a distant node, but fails.

                                mfalkviddM 1 Reply Last reply
                                0
                                • alowhumA alowhum

                                  Very cool stuff.

                                  @mfalkvidd Would it be possible to create the functionality, but to measure the successrate of outgoing messages from the gateway node?

                                  For example, I'l love to be able to see how often the controller/gateway tries to toggle a distant node, but fails.

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

                                  @alowhum unless I misunderstand your suggestion, that's exactly what I have already done.

                                  1 Reply Last reply
                                  0
                                  • alowhumA Offline
                                    alowhumA Offline
                                    alowhum
                                    Plugin Developer
                                    wrote on last edited by
                                    #42

                                    Ah, now I see. Thanks!

                                    1 Reply Last reply
                                    0
                                    • sundberg84S sundberg84

                                      @mfalkvidd i didnt fins time yet to implement more. But very good for two repeaters.

                                      Screenshot_20200225-100340.png

                                      E Offline
                                      E Offline
                                      evb
                                      wrote on last edited by
                                      #43

                                      @sundberg84 If I get it correct you implemented in your repeater sketch the use of the MySensors indication handler?

                                      void indication(indication_t ind)
                                      {
                                        switch (ind)
                                        {
                                          case INDICATION_TX:
                                            txOK++;
                                            break;
                                          case INDICATION_ERR_TX:
                                            txERR++;
                                            break;
                                        }
                                      }
                                      

                                      txOk and txErr are always incremented in the sketch and send to the gateway.
                                      Yet I see in your graphs a hourly count? Graphs from Grafana?
                                      Can you explain how you did this?

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

                                        @evb - yes, that is correct, here is a complete sketch with a GW (Nrf24 - ethernet)

                                        // Enable debug prints to serial monitor
                                        #define MY_DEBUG
                                        
                                        // Enable and select radio type attached
                                        #define MY_RADIO_NRF24
                                        #define MY_RF24_PA_LEVEL RF24_PA_MAX
                                        
                                        // Enable gateway ethernet module type
                                        #define MY_GATEWAY_W5100
                                        
                                        // Enable Soft SPI for NRF radio (note different radio wiring is required)
                                        // The W5100 ethernet module seems to have a hard time co-operate with
                                        // radio on the same spi bus.
                                        #if !defined(MY_W5100_SPI_EN) && !defined(ARDUINO_ARCH_SAMD)
                                        #define MY_SOFTSPI
                                        #define MY_SOFT_SPI_SCK_PIN 14
                                        #define MY_SOFT_SPI_MISO_PIN 16
                                        #define MY_SOFT_SPI_MOSI_PIN 15
                                        #endif
                                        
                                        // When W5100 is connected we have to move CE/CSN pins for NRF radio
                                        #ifndef MY_RF24_CE_PIN
                                        #define MY_RF24_CE_PIN 5
                                        #endif
                                        #ifndef MY_RF24_CS_PIN
                                        #define MY_RF24_CS_PIN 6
                                        #endif
                                        
                                        #define MY_IP_ADDRESS 192,168,1,8   // If this is disabled, DHCP is used to retrieve address
                                        // Renewal period if using DHCP
                                        //#define MY_IP_RENEWAL_INTERVAL 60000
                                        // The port to keep open on node server mode / or port to contact in client mode
                                        #define MY_PORT 5003
                                        
                                        // Controller ip address. Enables client mode (default is "server" mode).
                                        // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere.
                                        //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 254
                                        
                                        // The MAC address can be anything you want but should be unique on your network.
                                        // Newer boards have a MAC address printed on the underside of the PCB, which you can (optionally) use.
                                        // Note that most of the Ardunio examples use  "DEAD BEEF FEED" for the MAC address.
                                        #define MY_MAC_ADDRESS 0xDE, 0xAD, 0xBE, 0xEF, 0x01, 0x08 //AF-A0-F2-15-3B-1C
                                        
                                        // Set blinking period
                                        #define MY_DEFAULT_LED_BLINK_PERIOD 300
                                        
                                        // Enable inclusion mode
                                        //#define MY_INCLUSION_MODE_FEATURE
                                        // Enable Inclusion mode button on gateway
                                        //#define MY_INCLUSION_BUTTON_FEATURE
                                        // Set inclusion mode duration (in seconds)
                                        //#define MY_INCLUSION_MODE_DURATION 60
                                        // Digital pin used for inclusion mode button
                                        //#define MY_INCLUSION_MODE_BUTTON_PIN  3
                                        
                                        // Uncomment to override default HW configurations
                                        #define MY_DEFAULT_ERR_LED_PIN 7  // Error led pin
                                        #define MY_DEFAULT_RX_LED_PIN  9  // Receive led pin
                                        #define MY_DEFAULT_TX_LED_PIN  8  // the PCB, on board LED
                                        
                                        
                                        #define MY_INDICATION_HANDLER
                                        static uint32_t txOK = 0;
                                        static uint32_t txERR = 0;
                                        #define REPORT_INTERVAL 300000 // Report every 5 minutes
                                        #define CHILD_ID_TX_OK 0
                                        #define CHILD_ID_TX_ERR 1
                                        
                                        #include <SPI.h>
                                        
                                        #if defined(MY_USE_UDP)
                                        #include <EthernetUdp.h>
                                        #endif
                                        #include <Ethernet.h>
                                        #include <MySensors.h>
                                        
                                        MyMessage txOKmsg(CHILD_ID_TX_OK, V_CUSTOM);
                                        MyMessage txERRmsg(CHILD_ID_TX_ERR, V_CUSTOM);
                                        
                                        void indication(indication_t ind)
                                        {
                                          switch (ind)
                                          {
                                            case INDICATION_TX:
                                              txOK++;
                                              break;
                                            case INDICATION_ERR_TX:
                                              txERR++;
                                              break;
                                          }
                                        }
                                        
                                        void presentation()
                                        {
                                          //Send the sensor node sketch version information to the gateway
                                          sendSketchInfo("Gateway #1", "1.0");
                                          present(CHILD_ID_TX_OK, S_CUSTOM);
                                          present(CHILD_ID_TX_ERR, S_CUSTOM);
                                        }
                                        
                                        void setup()
                                        {
                                        }
                                        
                                        void loop() {
                                        
                                          static unsigned long last_send = 0;
                                          if (millis() - last_send > REPORT_INTERVAL) {
                                            send(txOKmsg.set(txOK));
                                            send(txERRmsg.set(txERR));
                                            last_send = millis();
                                          }
                                        
                                        }
                                        
                                        

                                        In Home Assistant you need to create a sensor that breaks down the incrementing number to each intervall you want.
                                        I use a utility_meter.

                                        utility_meter:
                                        hourly_ok_gw:
                                            source: sensor.gateway_1_0_0
                                            cycle: hourly
                                          hourly_err_gw:
                                            source: sensor.gateway_1_0_1
                                            cycle: hourly
                                        

                                        This sensors will be sent to Grafana each hour just like any other sensor and you can create a graph there:

                                        2556f0fa-a34b-49da-bac6-e0a8aadbd633-image.png

                                        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

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


                                        13

                                        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
                                        • OpenHardware.io
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular