Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 105934

How to properly create a "Generic Sensor"?

$
0
0

Hello and thank you for developing Home Assistant and helping others in this community!

In short, I would like to create a couple of virtual entities that represents the result of a calculation of two other entities. However, I want to write some sort of recipe, so that I do not have to repeat the formula for every pair of sensors involved.

Here’s my real world problem:

I installed a BLE temperature/humidity sensor installed in every room of my home. From this information I can derive the absolute humidity as well as the dew point. As I also have the temperature and relative humidity from outside my home (in my case: weather data), I can also calculate the dew point and absolute humidity in my city.

I would like to create a dashboard with the following information:

  • Mold risk for each room: That is the difference between the dew point and the real temperature - if the temperature is below the dew point, the risk is very high, if the difference is less than 4 it’s moderate risk and if it’s above 4 there’s only low risk.
  • Benefit of opening the window: When the difference between outside absolute humidity and inside absolute humidity is high, there’s a big benefit of ventilating the room with fresh air. Otherwise, when the difference is small or even negative, it makes no sense to ventilate.

I would be capable of creating this data individually for each room. However, repeating these formulas for each room is not only exhausting, it also leaves a lot of room for possible errors.

Therefore I search for a solution where I can define my code in some sort of generic sensor or entity and then use this script with each of the sensors.

So far, I didn’t find a good solution. Can you help me with a best practice?

Thank you in advance!

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>