DIY Zigbee weather station

I have the same issue here, after updating HA and Zigbee2mqtt, the humidity, temperature and pressure readings became unavailable.
I see the values are updated in Zigbee2mqtt, but not shown in the dashboard.
Anyone has the same issue and found a solution?

It still doesn’t work for me. I had the device on all the time (3 weeks) and there was no problem with it. The problem is with the HA software part or z2mqtt. I gave up for a while because I’m on a business trip. It would be a pity to abandon this topic, because I already have all the sensors for it.

Same here, temp, pressure and humidity gone…

Hi, I don’t know anything about electronics. My actions consist of reproducing the work of others. What does “~R” mean in your diagram?
image

“~R” is the variable resistance of the vane.

After some research, if I remove the following lines associated to the availability then I am able to see again the Tem, Humidity and Pressure:
availability_topic:…
payload_available:…
payload_not_available:…

1 Like

Shout out to Mike, Thank you!

I managed to assemble a weather station, but not all entities work or work incorrectly. First of all, the pressure is incorrectly indicated. Secondly, the following entities do not work: wind direction, wind force (both) and wind speed. I am surprised that wind force (both) and wind speed do not work because they are probably calculated from the wind pulse and this entity works. Can the wind direction failure be caused by incorrect connection of the wires? In the wind direction indicator, I only connected 2 of the 4 wires. Additionally, when I manually switch Daily rain clicks, 0 is still displayed, so Rainfall today also indicates 0. Can you advise what to do?

did you comment out (#) on all the MQTT sensors?

#availability_topic: "zigbee2mqtt/bridge/state"
#payload_available: "online"
#payload_not_available: "offline"

Yes I removed it. It had no effect.
For pressure I modified the code as follows
value_template: “{{ ((value_json.pressure_l1| float ) | round (0))/100 }}”

As I wrote earlier - I am surprised that entities that are calculated and not data received from sensors are not available.

For wind direction. Regardless of how I change the position of the wind flag, the voltage it is still the same. Is it a matter of bad connection?

In general, I slightly mydified the codes using Gemini AI.

This is how it looks now.

This is how the codes look

/homeassistant/mqtt_sensors/weatherstation.yaml

#########################################################
#                                                       #
#      BME280 DATA                                      #
#                                                       #
######################################################### 

- state_topic: "zigbee2mqtt/0x00124b00025e47c3"
  unit_of_measurement: "%"
  value_template: "{{ value_json.humidity_l1| round(0) }}"
  json_attributes_topic: "zigbee2mqtt/0x00124b00025e47c3/attributes" 
  icon: mdi:water-percent 
  name: "Humidity shed"
  unique_id: humshed
    
- state_topic: "zigbee2mqtt/0x00124b00025e47c3"
  unit_of_measurement: "hpa"
  value_template: "{{ ((value_json.pressure_l1| float ) | round (0))/100 }}"
  json_attributes_topic: "zigbee2mqtt/0x00124b00025e47c3/attributes" 
  icon: mdi:weight  
  name: "Pressure shed"
  unique_id: preshed
    
- state_topic: "zigbee2mqtt/0x00124b00025e47c3"
  unit_of_measurement: "°C"
  value_template: "{{ value_json.temperature_l1| round(1) }}"
  json_attributes_topic: "zigbee2mqtt/0x00124b00025e47c3/attributes" 
  icon: mdi:thermometer-lines  
  name: "Temperature shed"
  unique_id: tempshed
#########################################################
#                                                       #
#      WIND                                             #
#                                                       #
#########################################################

- state_topic: "zigbee2mqtt/0x00124b00025e47c3"
  unit_of_measurement: "v"
  value_template: "{{ value_json.l8| round(2) }}"
  json_attributes_topic: "zigbee2mqtt/0x00124b00025e47c3/attributes" 
  icon: mdi:call-made
  name: "Wind voltage"
  unique_id: windvoltage

- state_topic: "zigbee2mqtt/0x00124b00025e47c3"
  unit_of_measurement: "rpm"
  value_template: "{{ value_json.l6 }}"
  json_attributes_topic: "zigbee2mqtt/0x00124b00025e47c3/attributes" 
  icon: mdi:call-made
  name: "Windpulse"
  unique_id: windpulse
   

#########################################################
#                                                       #
#            END OF CONFIGURATION FILE                  # 
#                                                       # 
#########################################################

/homeassistant/sensors/sensors.yaml

#########################################################
#                                                       #
#      BME280 DATA                                      #
#                                                       #
######################################################### 

- platform: template
  sensors:
      humidity_abs_shed:
        value_template: >-
          {% set h, t = states('sensor.humidity_shed') | float, states('sensor.temperature_shed') %}
          {% if not h or t == 'unknown' -%}
            'unknown'
          {%- else %}
            {% set t = t | float %}
            {{ (h*6.112*2.1674*e**((t*17.67)/(t+243.5))/(t+273.15))|round(1) }}
          {% endif %}
        unit_of_measurement: g/m³
        friendly_name: Absolute Humidity shed

- platform: template
  sensors:
      dewpoint_shed:
        friendly_name: "Dewpoint shed"
        value_template: >-
          {{ (log( states('sensor.humidity_shed')|int / 100 ) + 18.678 * states('sensor.temperature_shed')|float / (257.14 + states('sensor.temperature_shed')|float ) )| round (1) }}  
        unit_of_measurement: °C
        
#########################################################
#                                                       #
#      RAIN METER                                       #
#                                                       #
#########################################################  

- platform: history_stats
  name: Daily rain clicks
  entity_id: switch.0x00124b00025e47c3_l5
  state: 'off'
  type: count
  start: '{{ now().replace(hour=0, minute=0, second=0) }}'
  end: '{{ now() }}'

- platform: template
  sensors:
    rainfall_today:
      friendly_name: Rainfall today
      unit_of_measurement: mm
      value_template: >-
        {% set count = states('sensor.daily_rain_clicks') | int(0) %}
        {% set mm_per_pulse = 0.30303 %}
        {% set mm = count * mm_per_pulse %}
        {{ mm | round(1, 'floor') }}    
          
#########################################################
#                                                       #
#      ANEMOMETER                                       #
#                                                       #
#########################################################

- platform: template
  sensors:
    windspeed:
      friendly_name: Wind speed
      unit_of_measurement: m/s
      # m_per_pulse = (r * 2 * Pi)/2 = (0.09 * 2 * 3.14)/2 = 0.2826 m
      value_template: >-
        {% set count = states('sensor.wind_pulse') | int %}
        {% set m_per_pulse = 0.2826 %}
        {% set mps = count * m_per_pulse %}
        {{ mps | round(0) }}

- platform: template
  sensors:
    windkmh:
      friendly_name: Wind speed kmh
      unit_of_measurement: km/h
      value_template: >-
        {% set mps = states('sensor.windspeed') | float %}
        {{ (mps * 3.6) | round(1) }}

- platform: template
  sensors:
    windforce:
      friendly_name: Wind force
      icon_template: "mdi:weather-windy"
      value_template: >-
        {% set wind = states('sensor.windspeed') | float %}
        {% set wind_round = wind | round(1) %}
        {% if wind <= 0.2 %}Bft: 0, Wind stil, {{ wind_round }} m/s
        {% elif wind <= 1.5 %}Bft: 1, Zwak: flauwe wind, {{ wind_round }} m/s
        {% elif wind <= 3.3 %}Bft: 2, Zwak, {{ wind_round }} m/s
        {% elif wind <= 5.4 %}Bft: 3, Matig: lichte bries, {{ wind_round }} m/s
        {% elif wind <= 7.9 %}Bft: 4, Matig: flauwe bries, {{ wind_round }} m/s
        {% elif wind <= 10.7 %}Bft: 5, Vrij krachtig, {{ wind_round }} m/s
        {% elif wind <= 13.8 %}Bft: 6, Krachtig, {{ wind_round }} m/s
        {% elif wind <= 17.1 %}Bft: 7, Hard, {{ wind_round }} m/s
        {% elif wind <= 20.7 %}Bft: 8, Stormachting, {{ wind_round }} m/s
        {% elif wind <= 24.4 %}Bft: 9, Storm, {{ wind_round }} m/s
        {% elif wind <= 28.4 %}Bft: 10, Zware storm, {{ wind_round }} m/s
        {% elif wind <= 32.6 %}Bft: 11, Zeer zware storm, {{ wind_round }} m/s
        {% else %}Bft: 12, Orkaan, {{ wind_round }} m/s
        {%- endif %}

- platform: template
  sensors:
    beaufort:
      friendly_name: Wind force (Bft)
      icon_template: "mdi:weather-windy"
      unit_of_measurement: Bft
      value_template: >-
        {% set wind = states('sensor.windspeed') | float %}
        {% if wind <= 0.2 %}0
        {% elif wind <= 1.5 %}1
        {% elif wind <= 3.3 %}2
        {% elif wind <= 5.4 %}3
        {% elif wind <= 7.9 %}4
        {% elif wind <= 10.7 %}5
        {% elif wind <= 13.8 %}6
        {% elif wind <= 17.1 %}7
        {% elif wind <= 20.7 %}8
        {% elif wind <= 24.4 %}9
        {% elif wind <= 28.4 %}10
        {% elif wind <= 32.6 %}11
        {% else %}12
        {%- endif %}
             
#########################################################
#                                                       #
#      WIND DIRECTION                                   #
#                                                       #
#########################################################

- platform: template
  sensors:
    wind_azimuth:
      friendly_name: Wind azimuth
      unit_of_measurement: '°'
      value_template: >-
        {% set wind = states('sensor.wind_voltage') | float %}
        {% if wind <= 0.21 %}112.5
        {% elif wind <= 0.27 %}67.5
        {% elif wind <= 0.30 %}90.0
        {% elif wind <= 0.41 %}157.5
        {% elif wind <= 0.60 %}135.0
        {% elif wind <= 0.79 %}202.5
        {% elif wind <= 0.93 %}180.0
        {% elif wind <= 1.31 %}22.5
        {% elif wind <= 1.49 %}45.0
        {% elif wind <= 1.93 %}247.5
        {% elif wind <= 2.03 %}225.0
        {% elif wind <= 2.26 %}337.5
        {% elif wind <= 2.53 %}0.0
        {% elif wind <= 2.67 %}292.5
        {% elif wind <= 2.86 %}315.0
        {% elif wind <= 3.05 %}270.0
        {% else %}295.5
        {%- endif %}

- platform: template
  sensors:
    wind_direction:
      friendly_name: Wind direction
      icon_template: "mdi:compass-outline"
      value_template: >
        {% set degrees = states('sensor.wind_azimuth') | float %}
        {% set abbr = ['N','NNE','NE','ENE','E','ESE','SE',
        'SSE','S','SSW','SW','WSW','W','WNW','NW','NNW' ] %}
        {%- set i = ((degrees / 22.5) | round(0)) | int %}
        {%- set i = 0 if i == 16 else i %}
        {{ abbr[i] }}

#########################################################
#                                                       #
#            END OF CONFIGURATION FILE                  # 
#                                                       # 
#########################################################

/homeassistant/configuration.yaml

mqtt: 
  sensor: !include_dir_merge_list mqtt_sensors 
  switch: !include_dir_merge_list mqtt_switches
  
sensor: !include_dir_merge_list sensors

Hi,
I have the code for the sensors set up like this and it works for me
/homeassistant/sensors.yaml

More information about my entire project here.


#########################################################
#                                                       #
#      BME280 DATA                                      #
#                                                       #
######################################################### 

  - platform: template
    sensors:
      humidity_abs_shed:
        value_template: >-
          {% set h, t = states('sensor.humidity_shed') | float, states('sensor.temperature_shed') %}
          {% if not h or t == 'unknown' -%}
            'unknown'
          {%- else %}
            {% set t = t | float %}
            {{ (h*6.112*2.1674*e**((t*17.67)/(t+243.5))/(t+273.15))|round(1) }}
          {% endif %}
        unit_of_measurement: g/m³
        friendly_name: Absolute Humidity shed

  - platform: template
    sensors:
      dewpoint_shed:
        friendly_name: "Dewpoint shed"
        value_template: >-
          {{ (log( states('sensor.humidity_shed')|int / 100 ) + 18.678 * states('sensor.temperature_shed')|float / (257.14 + states('sensor.temperature_shed')|float ) )| round (1) }}  
        unit_of_measurement: °C

#########################################################
#                                                       #
#      RAIN METER                                       #
#                                                       #
#########################################################  

  - platform: history_stats
    name: Daily rain clicks
    entity_id: switch.0x00124b000633d676_l5
    state: 'off'
    type: count
    start: '{{ now().replace(hour=0, minute=0, second=0) }}'
    end: '{{ now() }}'
    
  - platform: template
    sensors:
      rainfall_today:
        friendly_name: Rainfall today
        unit_of_measurement: mm
        value_template: >-
          {% set count = states('sensor.daily_rain_clicks') | int(0)  %}
          {% set mm_per_pulse = 0.30303 %}
          {% set mm = count * mm_per_pulse %}
          {{ mm|round(1, 'floor') }}    
          
#########################################################
#                                                       #
#      ANEMOMETER                                       #
#                                                       #
#########################################################

  - platform: template
    sensors:
      windspeed:
        friendly_name: Wind speed
        unit_of_measurement: m/s
        # m_per_pulse = (r * 2 * Pi)/2 = (0.09 * 2 * 3.14)/2 = 0.2862 m
        value_template: >-
          {% set count = states('sensor.wind_pulse') | int %}
          {% set m_per_pulse = 0.2826 %} 
          {% set mps = count * m_per_pulse %}
          {{ mps|round(0) }}    
          
  - platform: template
    sensors:
      windkmh:
        friendly_name: Wind speed
        unit_of_measurement: km/h
        value_template: >-
          {% set count = states('sensor.windspeed') | int %}
          {% set conversion =  0.2777778 %} 
          {% set mps = count * conversion %}
          {{ mps|round(0) }}      

  - platform: template
    sensors:
      windforce:
        friendly_name: Wind force
        icon_template: "mdi:weather-windy"
        value_template: "{% set wind = states('sensor.windspeed')|float %}
        {% set wind_round = wind|round(1) %}
        {% if wind <= 0.2 %}Bft: 0, Wind stil, {{wind_round}} m/s
        {% elif wind <= 1.5 %}Bft: 1, Zwak: flauwe wind, {{wind_round}} m/s
        {% elif wind <= 3.3 %}Bft: 2, Zwak, {{wind_round}} m/s
        {% elif wind <= 5.4 %}Bft: 3, Matig: lichte bries, {{wind_round}} m/s
        {% elif wind <= 7.9 %}Bft: 4, Matig: flauwe bries, {{wind_round}} m/s
        {% elif wind <= 10.7 %}Bft: 5, Vrij krachtig, {{wind_round}} m/s
        {% elif wind <= 13.8 %}Bft: 6, Krachtig, {{wind_round}} m/s
        {% elif wind <= 17.1 %}Bft: 7, Hard, {{wind_round}} m/s
        {% elif wind <= 20.7 %}Bft: 8, Stormachting, {{wind_round}} m/s
        {% elif wind <= 24.4 %}Bft: 9, Storm, {{wind_round}} m/s
        {% elif wind <= 28.4 %}Bft: 10, Zware storm, {{wind_round}} m/s
        {% elif wind <= 32.6 %}Bft: 11, Zeer zware storm, {{wind_round}} m/s
        {% else %}Bft: 12, Orkaan, {{wind_round}} m/s
        {%- endif %}"


  - platform: template
    sensors:
      beaufort: 
        friendly_name: Wind force
        icon_template: " mdi:weather-windy" 
        unit_of_measurement: Bft
        value_template: "{% set wind = states('sensor.windspeed')|float %} 
        {% if wind <= 0.2 %}0
        {% elif wind <= 1.5 %}1
        {% elif wind <= 3.3 %}2
        {% elif wind <= 5.4 %}3
        {% elif wind <= 7.9 %}4
        {% elif wind <= 10.7 %}5
        {% elif wind <= 13.8 %}6
        {% elif wind <= 17.1 %}7
        {% elif wind <= 20.7 %}8
        {% elif wind <= 24.4 %}9
        {% elif wind <= 28.4 %}10
        {% elif wind <= 32.6 %}11
        {% else %} > 32.6 %}12
        {%- endif %}"
             
#########################################################
#                                                       #
#      WIND DIRECTION                                   #
#                                                       #
#########################################################

  - platform: template
    sensors:
      wind_azimuth: 
        friendly_name: Wind azimuth
        unit_of_measurement: '°'
        value_template: "{% set wind = states('sensor.wind_voltage')|float %}
        {% if wind <= 0.21 %}112.5
        {% elif wind <= 0.27 %}67.5
        {% elif wind <= 0.30 %}90.0
        {% elif wind <= 0.41 %}157.5
        {% elif wind <= 0.60 %}135.0
        {% elif wind <= 0.79 %}202.5
        {% elif wind <= 0.93 %}180.0
        {% elif wind <= 1.31 %}22.5
        {% elif wind <= 1.49 %}45.0
        {% elif wind <= 1.93 %}247.5
        {% elif wind <= 2.03 %}225.0
        {% elif wind <= 2.26 %}337.5
        {% elif wind <= 2.53 %}0.0
        {% elif wind <= 2.67 %}292.5
        {% elif wind <= 2.86 %}315.0
        {% elif wind <= 3.05 %}270
        {% else %} > 3.05 %}295.5
        {%- endif %}"

  - platform: template
    sensors:
      wind_direction:
        friendly_name: Wind direction
        icon_template: "mdi:compass-outline"
        value_template: >
          {% set degrees = states('sensor.wind_azimuth')|float %}
          {% set abbr = ['N','NNE','NE','ENE','E','ESE','SE',
          'SSE','S','SSW','SW','WSW','W','WNW','NW','NNW' ] %}
          {%- set i = ((degrees / 22.25) | round(0)) | int %}
          {%- set i = 0 if i == 16 else i %}
          {{ abbr[i] }}

#########################################################
#                                                       #
#            END OF CONFIGURATION FILE                  # 
#                                                       # 
#########################################################

Nice project @bearstorm , a reference to the original from @Doublet is appreciated and polite.

Id like to make my own weather station using same rain gauge, wind speed and direction meter, but i dont have any zigbee devices and would like to use bt or wifi instead, any recomendations to use instead of CC2530?

By switching the zigbee coordinator for something on WiFi, this whole setup becomes something else.

That part i understand, but i’m not familiar to these boards/devices, i dont know what to look for, or where to look from

In the first post of this thread I have put a link to an esp home solution :nerd_face:

Now i see, missed that one first.
Something like this should be enought https://www.waveshare.com/wiki/ESP32-S3-Zero