Comfort  Automation/ Security System Forums Home
Home Search search Menu menu Not logged in - Login | Register
Comfort Automation/ Security System Forums > Software Applications > Comfort with Home Assistant > MultiSensor Module MSM01 Temperature and Humidity in Home Assistant

MultiSensor Module MSM01 Temperature and Humidity in Home Assistant
 Moderated by: slychiu
 New Topic   Reply   Printer Friendly 
 Rate Topic 
AuthorPost
 Posted: Sunday Apr 6th, 2025 07:42 am
   PM  Quote  Reply 
1st Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5841
Status: 
Offline

  back to top

The Multisensor Module MSM01 has internal sensors for Temperature & Humidity as well as connections to water leakage detection cable for Water Leakage. It also has 4 external inputs for Dry contacts which can trigger alarms or Responses in Comfort.



see http://www.comfortforums.com/forum139/4919.html for more info.

The temperature and Humidity can be mapped to Comfort Sensors eg






 The Comfort 2 mqtt addon in Home Assistant can be configured to display the temperature and Humidity sensors on the dashboard, eg Entry in configuration.yaml

   - name: Temperature
     unique_id: "comfort2_sensor1"
     state_topic: "comfort2mqtt/sensor1"
     value_template: "{{ value_json.Value }}"
     availability_topic: "comfort2mqtt/alarm/online"
     json_attributes_template: "{{ value_json | tojson }}"
     json_attributes_topic: "comfort2mqtt/sensor1"
     device_class: temperature
     state_class: measurement
     unit_of_measurement: °C
     payload_available: "1"
     payload_not_available: "0"

   - name: Humidity
     unique_id: "comfort2_sensor2"
     state_topic: "comfort2mqtt/sensor2"
     value_template: "{{ value_json.Value }}"
     availability_topic: "comfort2mqtt/alarm/online"
     json_attributes_template: "{{ value_json | tojson }}"
     json_attributes_topic: "comfort2mqtt/sensor2"
     device_class: humidity
     state_class: measurement
     unit_of_measurement: "%"
     payload_available: "1"
     payload_not_available: "0"
the dashboard should show 











Last edited on Thursday Apr 24th, 2025 05:37 am by slychiu



 Posted: Sunday Apr 6th, 2025 09:39 am
   PM  Quote  Reply 
2nd Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5841
Status: 
Offline

  back to top

It is possible to graph the sensor values on the dashboard  using the built in graphing tool in Home Assistant.



The graph above is done by editing the Dashboard Raw configuration Editor. 

views:
  - title: Home
    cards:
      - type: history-graph
        entities:
          - entity: sensor.temperature
          - entity: sensor.humidity
        hours_to_show: 24
        refresh_interval: 60

views:
  - title: Home
    cards:
      - type: statistics-graph
        entities:
          - entity: sensor.temperature
          - entity: sensor.humidity
        chart_type: line
        period: hour

This can be viewed live at our demo system
http://slychiu.ddns.net:9000/dashboard-environment/0
user name: comfortpassword Cytech408935

Last edited on Friday Apr 11th, 2025 06:29 am by slychiu



 Posted: Friday Apr 11th, 2025 03:12 am
   PM  Quote  Reply 
3rd Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5841
Status: 
Offline

  back to top

Temperature and Humidity Storage and Graphical Display using InfluxDb and Grafana

InfluxDB and Grafana are powerful tools that, when integrated with Home Assistant, significantly enhance its data logging, storage, and visualization capabilities. Here's a breakdown of what each does in the context of Home Assistant:  

InfluxDB
  • Time Series Database: InfluxDB is a time series database specifically designed to handle time-stamped data efficiently. Home Assistant generates a continuous stream of data from various sensors, devices, and integrations (e.g., temperature readings, switch states, energy consumption). InfluxDB acts as a long-term storage solution for this data. 
  • Long-Term Data Storage: By default, Home Assistant stores its historical data in an internal SQLite database. While functional for basic history and short-term trends, this database can become large and impact performance over extended periods. InfluxDB allows you to offload this historical data to a separate database, which is optimized for time-based queries and can handle much larger datasets without performance degradation. 
  • Efficient Data Retrieval: InfluxDB's architecture is optimized for querying data based on time ranges. This makes it efficient to retrieve data for creating graphs, analyzing trends over days, weeks, months, or even years, which is crucial for understanding your home's behavior and energy usage patterns. 
  • Data Aggregation and Retention Policies: InfluxDB supports features like data aggregation (e.g., calculating averages, minimums, maximums over specific time intervals) and retention policies (automatically removing older data after a defined period). This helps in managing the database size and focusing on relevant timeframes for analysis. 
  • Integration with Home Assistant: Home Assistant has a built-in integration for InfluxDB. Once configured, Home Assistant can automatically send the state changes of selected entities to your InfluxDB database. You can specify which entities to include or exclude.  
Example: You might configure Home Assistant to send temperature and humidity readings from your sensors to InfluxDB. This allows you to track how these values change over time and identify patterns like daily temperature fluctuations or seasonal humidity variations.  

Grafana
  • Data Visualization: Grafana is a powerful open-source data visualization and monitoring platform. It excels at creating interactive and informative dashboards from various data sources, including InfluxDB. 
  • Creating Dashboards: Grafana allows you to build custom dashboards with different types of panels (graphs, tables, gauges, etc.) to visualize the data stored in InfluxDB. You can create dashboards to monitor various aspects of your smart home, such as energy consumption, temperature trends, security system activity, and more. 
  • Real-Time Monitoring and Historical Analysis: Grafana can display real-time data as it's being recorded in InfluxDB, as well as historical data for analysis. You can zoom in on specific time periods, compare data from different entities, and overlay different metrics on the same graph. 
  • Customizable Visualizations: Grafana offers a wide range of customization options for your visualizations. You can adjust colors, labels, units, legends, and more to create clear and insightful representations of your data. 
  • Integration with InfluxDB: Grafana has excellent integration with InfluxDB as a data source. You can easily connect Grafana to your InfluxDB database and use its query language (InfluxQL or Flux, depending on the InfluxDB version) to retrieve and visualize the data. 
  • Embedding in Home Assistant: Grafana dashboards or individual panels can be embedded into your Home Assistant Lovelace UI using the iframe panel. This allows you to view your detailed historical data visualizations directly within your Home Assistant interface.
Example: Using the temperature and humidity data stored in InfluxDB, you can create a Grafana dashboard with time series graphs showing the trends for each sensor over the last week, month, or year. You could also add a gauge panel to display the current temperature in a prominent way. This Grafana dashboard can then be embedded into your main Home Assistant dashboard for easy monitoring.  

In Summary

InfluxDB and Grafana work together in Home Assistant to provide a robust solution for long-term data logging and visualization:  

Home Assistant collects data from your smart home devices and integrations.   

The InfluxDB integration in Home Assistant sends this data to the InfluxDB time series  database for efficient and long-term storage.

Grafana connects to the InfluxDB database and allows you to create customizable dashboards with various visualizations to analyze and monitor this historical data.  
These Grafana dashboards or individual panels can then be embedded back into your Home Assistant interface for seamless access to detailed insights about your smart home.  

This combination provides significant advantages over Home Assistant's built-in history capabilities, especially for users who want to track trends over longer periods, analyze their data in more detail, and create custom monitoring dashboards.
This youtube video from Smart Home Australia  shows how to install and configure InfluxDB and Grafana in Home Assistant
https://www.youtube.com/watch?v=k-7dO1o52dQ

This is an example graph of temperature and Humidity obtained from the MSM sensors using InfluxDb and Grafana








Last edited on Friday Apr 11th, 2025 03:29 am by slychiu



 Posted: Friday Apr 11th, 2025 04:35 am
   PM  Quote  Reply 
4th Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5841
Status: 
Offline

  back to top

InfluxDb installation and Configuration

In Home Assistant, go to Settings > AddOns, press AddOn Store at the bottom right. Search for InfluxDb and select it . Press Install. turn on Start on Boot, Watchdog, and Show in Sidebar, There is no configuration required, so just press the START button. 

You will see InfluxDB in the left sidebar.

On the left of the InfuxDb screen, press the Crown icon for Admin

 In top left corner press Create Database. Enter a database name eg homessistant and press the green Tick on the right. Add a retention policy. This is the duration that the data will be stored in the InfluxDb database. Note that the longer the duration, the more flash memory will be used in Raspberry Pi.








Next Go to the users Tab on the top menu and create a user and password. 


Give the user permission to read and write to the database. 
Update the configuration.yaml file using File Editor. Add the following;
influxdb:
  host: a0d7b954-influxdb
  port: 8086
  database: homeassistant
  username: <your username>
  password: <tour password>
  max_retries: 3
  default_measurement: state

Restart Home Assistant. After restart, go back to InfluxDb in the sidebar. Go to Explore (the graph icon),
Go to Query1, select your hoe assistant database called "homeassistant"  To the right you should see measurement units like %, 0C etc




for %, open the entity ID list, you should see humidity in the list 



You do not have to select the humidity
For 0C open the entity ID list- you should see temperature in the list. These are the entities that  are passed on to Grafana.





Last edited on Friday Apr 11th, 2025 05:10 am by slychiu



 Posted: Friday Apr 11th, 2025 05:53 am
   PM  Quote  Reply 
5th Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5841
Status: 
Offline

  back to top

Grafana Installation and Configuration

Go to Settings > Add on Store, press AddOn Store at the bottom right. Search for Grafana and select it . Press Install. turn on Start on Boot, Watchdog, and Show in Sidebar, There is no configuration required, so just press the START button. 

Go to Grafana in the Sidebar.



Press the orange symbol on the top left hand corner of Grafana. go to Connections on the left menu and Add new Connection. Search For InfluxDB and select it 


 Press the ADD new data source in the  top right. This connects InfluxDB data to Grafana.


in the influxDb connection screen enter the IP address with port 8086



scroll down to influxDB Details and enter the database, username and password for the database Then press Save and Test. you should see a green tick and a message that the data source is working.



Next use Grafana toi create a new dashboard for temperature and Humidity.Prss the +  symbol on the topright corner and Add a new Dashboard. 

select Add Visualization.
select DataSource as InfluxDB

in select measurements there are a list if units eg %, 0C
select  0C for WHERE press + to select entity_id and in tag value search for temperature




you can add another visualisation on the same page eg Humidity



If the dashboard configuration is correct you should se the graphs for temperature and humidity on the Grafana Dashboard




Please take a look at the Youtube video at https://www.youtube.com/watch?v=k-7dO1o52dQ for more information about how to customise the graphs

Last edited on Friday Apr 11th, 2025 06:35 am by slychiu



 Posted: Friday Apr 11th, 2025 06:27 am
   PM  Quote  Reply 
6th Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5841
Status: 
Offline

  back to top

Data from the graph can be exported to a csv file.
go to the visualisation eg Temperature graph. click on the 3 dots on the top left of the visualisation, select Inspect >  Data



The date and time range for the exported data can be selected in the Time Picker 


Last edited on Friday Apr 11th, 2025 07:36 am by slychiu



 Posted: Friday Apr 11th, 2025 07:32 am
   PM  Quote  Reply 
7th Post
slychiu
Administrator


Joined: Saturday Apr 29th, 2006
Location: Singapore
Posts: 5841
Status: 
Offline

  back to top

The temperature and Humidity Graphs in Grafana  can be viewed Live on our Demo Home assistant in the office at http:// http://slychiu.ddns.net:9000/a0d7b954_grafana/ingress


user name = comfort
password = Cytech408935



 Current time is 11:30 pm
Comfort Automation/ Security System Forums > Software Applications > Comfort with Home Assistant > MultiSensor Module MSM01 Temperature and Humidity in Home Assistant
Top




UltraBB 1.172 Copyright © 2007-2014 Data 1 Systems