Milesight UG65 Lorawan + MQTT

Good morning,

3 years ago I set in my house a Lorawan sensors network in this way :
Milesight AM319 > Lorawan protocol > Milesight UG65 gateway > MQTT protocol > Home Assistant (Mosquitto server inside Home Assistant)
I read on this forum that the best way is to publish one topic for each sensor, so I created inside UG65 an application for each sensor that publish data in different mqtt topics and in /homeassistant/packages/mqtt.yaml sensors like this :

mqtt:
  sensor:
    - name: "bagno nonna co2"
      state_topic: "milesight/24e124710c345488"
      value_template: "{{ value_json.co2 }}"
      qos: 0
      unit_of_measurement: "ppm"
      force_update: true
      unique_id: "6261676e6f206e6f6e6e6120636f32"
    - name: "bagno nonna hcho"
      state_topic: "milesight/24e124710c345488"
      value_template: "{{ value_json.hcho }}"
      qos: 0
      unit_of_measurement: "mg/m3"
      force_update: true
      unique_id: "6261676e6f206e6f6e6e61206863686f"
    - name: "bagno nonna umidità"
      state_topic: "milesight/24e124710c345488"
      value_template: "{{ value_json.humidity }}"
      qos: 0
      unit_of_measurement: "%"
      force_update: true
      unique_id: "6261676e6f206e6f6e6e6120756d69646974e0"
    - name: "bagno nonna luminosità"
      state_topic: "milesight/24e124710c345488"
      value_template: "{{ value_json.light_level }}"
      qos: 0
      force_update: true
      unique_id: "6261676e6f206e6f6e6e61206c756d696e6f736974e0"
    - name: "bagno nonna presenza"
      state_topic: "milesight/24e124710c345488"
      value_template: "{{ value_json.pir }}"
      qos: 0
      force_update: true
      unique_id: "6261676e6f206e6f6e6e612070726573656e7a61"
    - name: "bagno nonna pm10"
      state_topic: "milesight/24e124710c345488"
      value_template: "{{ value_json.pm10 }}"
      qos: 0
      unit_of_measurement: "μg/m3"
      force_update: true
      unique_id: "6261676e6f206e6f6e6e6120706d3130"
    - name: "bagno nonna pm2.5"
      state_topic: "milesight/24e124710c345488"
      value_template: "{{ value_json.pm2_5 }}"
      qos: 0
      unit_of_measurement: "μg/m3"
      force_update: true
      unique_id: "6261676e6f206e6f6e6e6120706d322e35"
    - name: "bagno nonna pressione"
      state_topic: "milesight/24e124710c345488"
      value_template: "{{ value_json.pressure }}"
      qos: 0
      unit_of_measurement: "hPa"
      force_update: true
      unique_id: "6261676e6f206e6f6e6e61207072657373696f6e65"
    - name: "bagno nonna temperatura"
      state_topic: "milesight/24e124710c345488"
      value_template: "{{ value_json.temperature }}"
      qos: 0
      unit_of_measurement: "°C"
      force_update: true
      unique_id: "6261676e6f206e6f6e6e612074656d7065726174757261"
    - name: "bagno nonna tvoc"
      state_topic: "milesight/24e124710c345488"
      value_template: "{{ value_json.tvoc }}"
      qos: 0
      unit_of_measurement: "mg/m3"

At the beginning It was all working fine but after some months (4 or 5) I started to struggle with a strange problem : randomly Home Assistant stops to receive data from some sensors.
I made these checks :

  1. I have 12 sensors and Home Assistant lose data from some sensors (never all the sensors, at most from 4 sensors)
  2. it happens randomly between sensors, there aren’t sensors more afflicted
  3. it happens randomly about time, all can work fine for some weeks than appear one time the problem then work fine than appear the problem 2 / 3 / more time a day then work fine than…
  4. mosquitto mqtt is working fine when it happens (I have some Shelly through mqtt and there aren’t problems)
  5. the UG65 load normally is CPU Load 6% RAM (Capacity/Available) 512MB/34MB (6.64%) eMMC (Capacity/Available) 8.0GB/6.5GB (80.97%)
  6. the only way to solve the problem is an UG65 reboot from it’s webgui
  7. I sscheduled inside UG65 10 reboot a day (the max possible), each one every 2 hours and 30 minutes but it doesn’t solve : Home Assistant loose data for more than 4 or 5 hours (it is like the UG65 doesn’t make a reboot); so I must continue to check and make reboot manually.

I’m a noob and I’m not able to go further.
Can someone help me ?

Thanks in advance

Lora is a fire and forget protocol like my rf433 devices. I found that some of my sensors would try to broadcast on the same physical event at the same time, and interfere with each other in the radio spectrum part of things, giving scrambled codes to the receiver and such.
Are these things firing at about the same time? can you get them to stagger with delays? One of my problems was removed by physically removing a door RF sensor and relying only on the reed switch sensor. Another was fixed but adding a small delay between sending the command for each switch.

The sensors seem not firing at the same time and the UG65 tells (during the problem) that it can see all the sensors :


So, it seems that there aren’t problems on the path sensors > LoraWan protocol > UG65 gateway.