Integrating Modbus TCP Sensors and Rainwater Usage Tracking

Hey everyone! I’ve been working on integrating some Modbus TCP sensors for my Komfovent system and wanted to share my experience, as well as ask for some advice on a related project.

First, regarding the Modbus TCP integration: I’ve been trying to convert the numerical values returned by the sensors into readable states. From what I understand, the documentation mentions using char, but in practice, it returns a number. I’ve set up a basic sensor configuration, but I’m not sure if I should handle the state conversion within the sensor definition or if I need to create a separate template sensor for this. Here’s what I have so far:

sensors:

  • name: “Komfovent Power”
    address: 4
    input_type: holding
    data_type: uint16

If anyone has tips on the best approach for this, I’d greatly appreciate it!

Now, moving on to my rainwater usage tracking project: I’ve got a pressure sensor that measures the water level in my rain tank, and it’s been working really well. However, I want to take it a step further by calculating the amount of water we use. My initial thought is to create a counter that triggers when the sensor value drops by more than 0.05. Here’s the workflow I’m considering:

  1. Check if the new sensor value is lower than the previous one.
  2. If the difference is greater than 0.05, convert it to a percentage and calculate the volume of water used.
  3. Update a total usage counter with this value.

I’ve started drafting some rules for this, but the sensor readings are quite sensitive, leading to a lot of false positives. For example, during a short rain event, I noticed over 20 readings in just 20 minutes. I’m wondering if there’s a way to smooth out these readings or set a threshold to ignore minor fluctuations.

If anyone has experience with similar projects or suggestions on how to refine this setup, I’d love to hear your thoughts! It’s been a fun challenge, and I’m excited to see how it turns out. :blush: