Ruuvi cloud and local mqtt

Received my gateway and 6 sensors and iā€™m trying to set it up. I have 1 sensor configured via the app and when the gateway (v1.12.4) is configured to ā€œRuuvi Cloud (recommended)ā€ i can see the sensor at ā€œstation.ruuvi.comā€.

I first had the gateway set to a local mqtt server and cloud (ā€œUse Ruuvi Cloud or/and a custom server and configure more settingsā€) as follows:
MQTT transport type: MQTT over unencrypted TCP
Server: local ip address, Port: 1883, user/passwd: empty

Use ā€˜ruuviā€™ on the prefix: no
Use Ruuvi Gatewayā€™s MAC address on the topic prefix: no
Use a custom topic prefix: ā€œhouse/ad/tempStatusā€

Advanced settings

Allow sending statistics: no
HTTP server where to send statistics: https://network.ruuvi.com/status

in my mqtt i saw only ā€œGateway not connectedā€ now i will see nothing at all.

Than i changed to ā€œRuuvi Cloud (recommended)ā€ and saw my sensor in the cloud.

Reverted it back to the previous configuration with ā€œAllow sending statistics: yesā€, no change.

Any hint how to configure the gateway to send to a local mqtt server and to the ruuvi cloud ?

Thanks for heling me out.

when i remove authentication and perform a

ad@lnx ~]# curl -v ā€œhttp://ruuvi.armin.d/historyā€

  • Trying 192.168.254.222:80ā€¦
  • Connected to ruuvi.armin.d (192.168.254.222) port 80 (#0)

GET /history HTTP/1.1
Host: ruuvi.armin.d
User-Agent: curl/7.82.0
Accept: /

  • Mark bundle as not supporting multiuse
  • HTTP 1.0, assume close after body
    < HTTP/1.0 200 OK
    < Server: Ruuvi Gateway
    < Date: Thu, 20 Oct 2022 20:24:47 GMT
    < Content-type: application/json; charset=utf-8
    < Content-Length: 272
    < Cache-Control: no-store, no-cache, must-revalidate, max-age=0
    < Pragma: no-cache
    <
    {
    ā€œdataā€: {
    ā€œcoordinatesā€: ā€œā€,
    ā€œtimestampā€: ā€œ1666297487ā€,
    ā€œgw_macā€: ā€œEF:41:9E:B9:03:16ā€,
    ā€œtagsā€: {
    ā€œF0:66:1B:4D:46:21ā€: {
    ā€œrssiā€: -40,
    ā€œtimestampā€: ā€œ1666297486ā€,
    ā€œdataā€: ā€œ0201061BFF9904050F605096C57D0008FFE40418C4164E07A3F0661B4D4621ā€
    }
    }
    }
  • Closing connection 0
    i can see the actual sensor data (timestamp changes if i move the sensor), so the geteway as well as the sensor is ok.

i have done a full reset and now i can see the data in my mqtt server but no longer at station.ruuvi.com, ok for me.
A little bit disappointing is that only raw data is posted so i have to write a program that decodes the data and reposts that to mqtt.
Are there any plans to change that ?
And are there any plans to post from the gateway to InfluxDB ?

You might find RuuviBridge useful, it has the ability to read the raw data from the gateway (through MQTT or HTTP), parse it, and write the parsed data back to MQTT in a simple json format for further consumption. It also includes the ability to directly write the parsed data into InfluxDB

1 Like

Iā€™m having the same issue. As I first configured the gateway with default settings, the data were nicely transferred to cloud. After trying to have both the cloud and MQTT Iā€™m only getting data to MQTT.

Should I put in some user name and password for the server ā€œhttps://network.ruuvi.com/recordā€?

Hi @Timeoni
you donā€™t need to put user name/password for the server, see screenshot:

Could you collect and share your syslogs (after connecting the gateway to USB it appeared as a virtual COM-port, you can use Putty or any other terminal emulator to connect and save syslogs)

2 Likes

Absolutely. I assume that the output that appears on Putty is the syslog. I let that run for a while and this is what I see.

I (123865) ruuvi_gateway: [main/1] free heap: 117944
I (133865) ruuvi_gateway: [main/1] free heap: 118152
I (135077) ADV_POST_TASK: [adv_post_task/1] Got ADV_POST_SIG_RETRANSMIT
I (135078) ADV_POST_TASK: [adv_post_task/1] Advertisements in table: 1
I (135081) ADV_POST_TASK: [adv_post_task/1] i: 0, tag: DF:79:48:9C:D3:DB, rssi:                                                                                                                                                              -35, timestamp: 1669918176:
I (135092) ADV_POST_TASK: [adv_post_task/1] 0000: 02 01 06 1B FF 99 04 05 15 69                                                                                                                                                              22 90 D1 0E FF F4 | .........i".....
I (135102) ADV_POST_TASK: [adv_post_task/1] 0010: FF D4 03 F0 B9 16 25 3A 45 DF                                                                                                                                                              79 48 9C D3 DB    | ......%:E.yH...
I (135116) http: [adv_post_task/1] ### HTTP POST to URL=https://network.ruuvi.co                                                                                                                                                             m/record
I (135120) http: [adv_post_task/1] HTTP POST DATA:
{
        "data": {
                "coordinates":  "",
                "timestamp":    "1669918176",
                "nonce":        "4223606744",
                "gw_mac":       "F2:7C:82:98:A0:B4",
                "tags": {
                        "DF:79:48:9C:D3:DB":    {
                                "rssi": -35,
                                "timestamp":    "1669918176",
                                "data": "0201061BFF99040515692290D10EFFF4FFD403F                                                                                                                                                             0B916253A45DF79489CD3DB"
                        }
                }
        }
}
I (135155) esp-tls: [adv_post_task] esp_tls_init: tls=0x3ffe3ad0
I (135206) esp-tls: [tiT] esp_tls_low_level_conn_callback_dns_found: resolved su                                                                                                                                                             ccessfully
I (135263) esp-tls: [adv_post_task] hostname 'network.ruuvi.com' resolved to 35.                                                                                                                                                             157.177.176
I (135653) esp-x509-crt-bundle: Certificate validated
I (137031) http: [adv_post_task/1] ### HTTP POST to URL=https://network.ruuvi.co                                                                                                                                                             m/record: STATUS=200
I (137032) TRANS_SSL: [adv_post_task] ssl_close: tls=0x3ffe3ad0
I (137037) esp-tls: [adv_post_task] esp_tls_conn_destroy: tls=0x3ffe3ad0
I (137049) LEDS: [adv_post_task/1] ### leds_indication_on_network_ok
I (137051) LEDS: [adv_post_task/1] LED: OFF
I (143865) ruuvi_gateway: [main/1] free heap: 118152
I (153865) ruuvi_gateway: [main/1] free heap: 118152
I (163865) ruuvi_gateway: [main/1] free heap: 118152
I (173865) ruuvi_gateway: [main/1] free heap: 118152
I (183865) ruuvi_gateway: [main/1] free heap: 118152
I (193865) ruuvi_gateway: [main/1] free heap: 118152
I (195077) ADV_POST_TASK: [adv_post_task/1] Got ADV_POST_SIG_RETRANSMIT
I (195078) ADV_POST_TASK: [adv_post_task/1] Advertisements in table: 1
I (195081) ADV_POST_TASK: [adv_post_task/1] i: 0, tag: DF:79:48:9C:D3:DB, rssi: -35, timestamp: 1669918235:
I (195092) ADV_POST_TASK: [adv_post_task/1] 0000: 02 01 06 1B FF 99 04 05 15 62 22 96 D1 0D FF F4 | .........b".....
I (195103) ADV_POST_TASK: [adv_post_task/1] 0010: FF D8 03 F8 B9 F6 25 3A 5C DF 79 48 9C D3 DB    | ......%:\.yH...
I (195116) http: [adv_post_task/1] ### HTTP POST to URL=https://network.ruuvi.com/record
I (195120) http: [adv_post_task/1] HTTP POST DATA:
{
        "data": {
                "coordinates":  "",
                "timestamp":    "1669918236",
                "nonce":        "4223606745",
                "gw_mac":       "F2:7C:82:98:A0:B4",
                "tags": {
                        "DF:79:48:9C:D3:DB":    {
                                "rssi": -35,
                                "timestamp":    "1669918235",
                                "data": "0201061BFF99040515622296D10DFFF4FFD803F8B9F6253A5CDF79489CD3DB"
                        }
                }
        }
}
I (195155) esp-tls: [adv_post_task] esp_tls_init: tls=0x3ffe3ad0
I (195213) esp-tls: [tiT] esp_tls_low_level_conn_callback_dns_found: resolved successfully
I (195262) esp-tls: [adv_post_task] hostname 'network.ruuvi.com' resolved to 3.121.138.4
I (195653) esp-x509-crt-bundle: Certificate validated
I (197008) http: [adv_post_task/1] ### HTTP POST to URL=https://network.ruuvi.com/record: STATUS=200
I (197009) TRANS_SSL: [adv_post_task] ssl_close: tls=0x3ffe3ad0
I (197014) esp-tls: [adv_post_task] esp_tls_conn_destroy: tls=0x3ffe3ad0
I (197026) LEDS: [adv_post_task/1] ### leds_indication_on_network_ok
I (197029) LEDS: [adv_post_task/1] LED: OFF
I (203865) ruuvi_gateway: [main/1] free heap: 118152
I (213865) ruuvi_gateway: [main/1] free heap: 118152
I (223865) ruuvi_gateway: [main/1] free heap: 118152
I (233865) ruuvi_gateway: [main/1] free heap: 118152
I (243865) ruuvi_gateway: [main/1] free heap: 118152
I (253865) ruuvi_gateway: [main/1] free heap: 118152
I (255077) ADV_POST_TASK: [adv_post_task/1] Got ADV_POST_SIG_RETRANSMIT
I (255078) ADV_POST_TASK: [adv_post_task/1] Advertisements in table: 1
I (255081) ADV_POST_TASK: [adv_post_task/1] i: 0, tag: DF:79:48:9C:D3:DB, rssi: -38, timestamp: 1669918296:
I (255092) ADV_POST_TASK: [adv_post_task/1] 0000: 02 01 06 1B FF 99 04 05 15 56 22 AA D1 10 FF F0 | .........V".....
I (255102) ADV_POST_TASK: [adv_post_task/1] 0010: FF DC 03 F8 B9 76 25 3A 74 DF 79 48 9C D3 DB    | .....v%:t.yH...
I (255116) http: [adv_post_task/1] ### HTTP POST to URL=https://network.ruuvi.com/record
I (255120) http: [adv_post_task/1] HTTP POST DATA:
{
        "data": {
                "coordinates":  "",
                "timestamp":    "1669918296",
                "nonce":        "4223606746",
                "gw_mac":       "F2:7C:82:98:A0:B4",
                "tags": {
                        "DF:79:48:9C:D3:DB":    {
                                "rssi": -38,
                                "timestamp":    "1669918296",
                                "data": "0201061BFF990405155622AAD110FFF0FFDC03F8B976253A74DF79489CD3DB"
                        }
                }
        }
}
I (255155) esp-tls: [adv_post_task] esp_tls_init: tls=0x3ffe3ad0
I (255186) esp-tls: [tiT] esp_tls_low_level_conn_callback_dns_found: resolved successfully
I (255262) esp-tls: [adv_post_task] hostname 'network.ruuvi.com' resolved to 52.57.55.20
I (255652) esp-x509-crt-bundle: Certificate validated
I (257014) http: [adv_post_task/1] ### HTTP POST to URL=https://network.ruuvi.com/record: STATUS=200
I (257015) TRANS_SSL: [adv_post_task] ssl_close: tls=0x3ffe3ad0
I (257020) esp-tls: [adv_post_task] esp_tls_conn_destroy: tls=0x3ffe3ad0
I (257032) LEDS: [adv_post_task/1] ### leds_indication_on_network_ok
I (257034) LEDS: [adv_post_task/1] LED: OFF
I (263865) ruuvi_gateway: [main/1] free heap: 118148

According to this syslogs, the data is successfully sent to the cloud (to network.ruuvi.com/record).
Now the transfer to the cloud and over MQTT work as expected? If you donā€™t see your data in the cloud, the problem may be on the cloud side.

The cloud is not showing anything, so Iā€™ll turn my attention there and have a closer look.

Thank you Alexey for the help! This narrowed the problem down a lot.

UPDATE: Iā€™m officially an idiot. I had not confirmed the ownership of my sensor. Thought I had done this, but one should always double check.

Nevertheless I learned some good stuff and the product works flawlessly.