Airlab in HomeAssistant using modbus integration

There are two delay options in the modbus integration I missed and I need to keep connection open on fail. This seems to be a stable config for my Airlab:

modbus:
  - name: Airlab
    type: tcp
    host: 192.168.1.61
    port: 502
    message_wait_milliseconds: 100
    delay: .2
    retry_on_empty: true
    close_comm_on_error: false
    sensors:
      - name: CO2 level
        slave: 1
        address: 139
        unit_of_measurement: ppm
        input_type: holding
        data_type: uint16
        scan_interval: 15
      - name: Rel. Humidity
        slave: 1
        address: 140
        unit_of_measurement: '%'
        input_type: holding
        data_type: uint16
        scan_interval: 15
        scale: 0.1
        precision: 1
      - name: Airlab Temperature
        slave: 1
        address: 121
        unit_of_measurement: °C
        input_type: holding
        data_type: uint16
        scan_interval: 15
        scale: 0.1
        precision: 1
      - name: PM0.5
        slave: 1
        address: 764
        unit_of_measurement: ug/m3
        input_type: holding
        data_type: uint16
        scan_interval: 15
      - name: PM1.0
        slave: 1
        address: 765
        unit_of_measurement: ug/m3
        input_type: holding
        data_type: uint16
        scan_interval: 15
      - name: PM2.5
        slave: 1
        address: 766
        unit_of_measurement: ug/m3
        input_type: holding
        data_type: uint16
        scan_interval: 15
      - name: PM4.0
        slave: 1
        address: 767
        unit_of_measurement: ug/m3
        input_type: holding
        data_type: uint16
        scan_interval: 15
      - name: PM10.0
        slave: 1
        address: 768
        unit_of_measurement: ug/m3
        input_type: holding
        data_type: uint16
        scan_interval: 15
      - name: VOC
        slave: 1
        address: 988
        unit_of_measurement: ppb
        input_type: holding
        data_type: uint16
        scan_interval: 15

Phew, thanks for sticking with it ‘8098. If there’s anything else we can help with let us know. I believe doing this with the HA bacnet integration would go a lot smoother.

I didn’t know there is a bacnet integration, at least not supported? I’ve only found feature requests?

This isn’t about how fast the Airlab replies, it’s about the necessary delay(s) between connect and first read and between the numerous reads themselves.

We had one person working on it and HA recently. There were some problems but we got it working for the main Ethernet port devices. We were working on discovering subnet devices when we left off and havent heard much from that client in a while now. You could write to the HA folks, they were supportive.

Not following you there but we are ready to make changes or add features if we need to.

No, with the available config settings in HA modbus integration all is well, the only challenge for somebody new to the matter (like me) is that the Airlab is quite silent when using the defaults…

Not fully following that but OK. If there is something we can do to make things easier for the next guy let me know.

Ok, so the problem is, you should not hammer the Airlab with requests. After TCP connect, HA needs to sleep for ~200ms or it won’t respond at all (delay). And after a single read holding register, HA needs to sleep at least 100ms before sending the next read holding register (message_wait_milliseconds).
If you do that, all is well. If you don’t the Airlab is as dead as a doornail.

We stand by to help out as always.

Yes, please try to ensure the read interval of more than 50ms, reading too quickly will overload our devices which results in lost packets. Read intervals of more than 100ms can ensure that there is almost no packet loss. In practice the temperatures in the building dont change all that fast and a typical poll interval would be ten seconds and more.

If there are more than one master polling the device you will need to take that into account as well, our devices can support siultaneous connections to several masters but you will begin to see packet loss as the load increases.

Thank you for your feedback and support.

Yes, that’s what I discovered. The only addition to that: it’s not only the polling frequency in HA, but also the inter read interval timing that needs some delay, because I have HA configured to read every holding register as a seperate sensor. I know I can get a set in one call, but then the sensor naming in HA is not as clarifying as I want it to be (each holding register has it’s own sensor config now).

If it helps you can do a block read to read several parameters per read, all our devices support that.

I think you’re saying the airlab needs to respond under 100ms over IP.

Maurice

No, what I’m saying is that one needs to wait at least 100ms between every read. Which can be configured using message_wait_milliseconds: 100 in HA, so no problems, nothing to solve. Just reiterating what was discovered in the thread. The problem is solved.