DIY Zigbee weather station

Has anyone else come across this problem? I can program the CC2530 and join to HA through ZHA and all the sensors show up the BME data (temp/hum/press), does not update - it only uploads once on startup/reset of the CC2530. The switches (rain gauge) and anemometer work ok and the RSSI updates ok. I’ve tried 2 BME280 and a SHT3x with the same result. The BME280 data is accurate, just not updating. I can’t work out from ZHA if the problem is from the CC2530 not transmitting the data or HA not finding it. If anyone can point me in the right direction I’d be grateful. Thank you.

Here is a an overview of the flashing options: Flashing the CC2531 USB stick | Zigbee2MQTT

After spending some time debugging, the solution is the following:

mqtt:
  sensor:
    - name: "garden 5 psi voltage"
      unique_id: garden5psivoltage
      state_topic: 'zigbee2mqtt/ZIGBEE_PTVO_NAME'
      unit_of_measurement: "V"
      icon: mdi:call-made
      value_template: "{{value_json.l1 | round(3)}}" 
      availability: 
        - topic: "zigbee2mqtt/ZIGBEE_PTVO_NAME/availability"
          value_template: "{{ value_json.state }}"
          payload_available: "online"
          payload_not_available: "offline"
1 Like

I’ve finally managed to crack this. I’m not sure why, but setting the send report frequency to 30 seconds (in the advanced tab) in the PTVO software has fixed this. The default is 60s but for whatever reason it wasn’t working for me. I now have a very nice fully working unit! I may try and add a Lux/UV sensor at some point…

Hi.I built this circuit, but unfortunately I can’t read the sensor values in zigbee2mqtt. I did everything according to the description and checked several times. The pairing was successful in z2m, but after that the reading of the data is no longer unsuccessful. I get this error message:

2024-02-21 12:27:51Exception while calling fromZigbee converter: Definition 'wethear station' has not endpoint defined}

Error 2024-02-21 12:27:51Publish 'get' 'temperature' to '0x00124b0009693a1c' failed: 'Error: Read 0x00124b0009693a1c/1 msTemperatureMeasurement(["measuredValue"], {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":null,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Status 'WRITE_ONLY')'

I tried to find information, but I didn’t come across this error message anywhere.
Anyone have any ideas?
Thank you in advance for your help!
Thom

Please find here my latest config files:

BME280 & wind data, this is the updated MQTT Sensor format.

Put this in your configuration.yaml:

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

and create the two directories

/homeassistant/mqtt_sensors/
/homeassistant/mqtt_switches/

And put the file below in the Mqtt sensor directory: weatherstation.yaml

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

  - state_topic: "zigbee2mqtt/0x00124b000633d676"
    unit_of_measurement: "%"
    value_template: "{{ value_json.humidity_l1| round(0) }}"
    availability_topic: "zigbee2mqtt/bridge/state"
    payload_available: "online"
    payload_not_available: "offline"
    json_attributes_topic: "zigbee2mqtt/0x00124b000633d676/attributes" 
    icon: mdi:water-percent 
    name: "Humidity shed"
    unique_id: humshed
    
  - state_topic: "zigbee2mqtt/0x00124b000633d676"
    unit_of_measurement: "hpa"
    value_template: "{{ ((value_json.pressure_l1| float ) | round (0)) }}"
    availability_topic: "zigbee2mqtt/bridge/state"
    payload_available: "online"
    payload_not_available: "offline"
    json_attributes_topic: "zigbee2mqtt/0x00124b000633d676/attributes" 
    icon: mdi:weight  
    name: "Pressure shed"
    unique_id: preshed
    
  - state_topic: "zigbee2mqtt/0x00124b000633d676"
    unit_of_measurement: "°C"
    value_template: "{{ value_json.temperature_l1| round(1) }}"
    availability_topic: "zigbee2mqtt/bridge/state"
    payload_available: "online"
    payload_not_available: "offline"
    json_attributes_topic: "zigbee2mqtt/0x00124b000633d676/attributes" 
    icon: mdi:thermometer-lines  
    name: "Temperature shed"
    unique_id: tempshed

#########################################################
#                                                       #
#      WIND                                             #
#                                                       #
#########################################################

  - state_topic: "zigbee2mqtt/0x00124b000633d676"
    unit_of_measurement: "v"
    value_template: "{{ value_json.l8| round(2) }}"
    availability_topic: "zigbee2mqtt/bridge/state"
    payload_available: "online"
    payload_not_available: "offline"
    json_attributes_topic: "zigbee2mqtt/0x00124b000633d676/attributes" 
    icon: mdi:call-made
    name: "Wind voltage"
    unique_id: windvoltage

  - state_topic: "zigbee2mqtt/0x00124b000633d676"
    unit_of_measurement: "rpm"
    value_template: "{{ value_json.l6 }}"
    availability_topic: "zigbee2mqtt/bridge/state"
    payload_available: "online"
    payload_not_available: "offline"
    json_attributes_topic: "zigbee2mqtt/0x00124b000633d676/attributes" 
    icon: mdi:call-made
    name: "Windpulse"
    unique_id: windpulse

   


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

The other sensor configuration file can be put in the usual place:

In my case; I have created a sensor directory in configuration.yaml

sensor: !include_dir_merge_list sensors

and put all my sensor files in:

/homeassistant/sensors
#########################################################
#                                                       #
#      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                  # 
#                                                       # 
#########################################################   

Trust this helps

Hi Doublet!
I really appreciate your answer, it was extremely useful, because I was not aware of this configuration either. Unfortunately, it didn’t solve my problem, the error is still the same. I get the same error message in the log file. Maybe the BME280 is not communicating with the CC2530 for some reason

Debug 2024-02-22 09:53:11Received MQTT message on 'zigbee2mqtt/wethear station/1/set' with data '{"read":{"attributes":["measuredValue"],"cluster":"msTemperatureMeasurement","options":{}}}'

Debug 2024-02-22 09:53:11Publishing 'set' 'read' to 'wethear station'

Debug 2024-02-22 09:53:11Received Zigbee message from 'wethear station', type 'readResponse', cluster 'msTemperatureMeasurement', data '{}' from endpoint 1 with groupID 0

Error 2024-02-22 09:53:11Exception while calling fromZigbee converter: Definition 'wethear station' has not endpoint defined}

Debug 2024-02-22 09:53:11Error: Definition 'wethear station' has not endpoint defined at getEndpointName (/app/node_modules/zigbee-herdsman-converters/src/lib/utils.ts:129:15) at /app/node_modules/zigbee-herdsman-converters/src/lib/modernExtend.ts:459:72 at Array.find (<anonymous>) at Object.convert (/app/node_modules/zigbee-herdsman-converters/src/lib/modernExtend.ts:459:45) at Receive.onDeviceMessage (/app/lib/extension/receive.ts:153:51) at EventEmitter.wrappedCallback (/app/lib/eventBus.ts:174:23) at EventEmitter.emit (node:events:529:35) at EventBus.emitDeviceMessage (/app/lib/eventBus.ts:108:22) at Controller.<anonymous> (/app/lib/zigbee.ts:115:27)

It looks like the BME280 is not communicating with the CC2530, did you try another hexadress according to the spec of the specific BMEunit

The problem was that the device parameters were not set correctly in the firmware configurator. I set the model id and manufacturer id to my own name, so the device was not supported. When I set it to the default settings (ptvo.info and ptvo.switch), the device was supported and showed the data (temperatur, humidity, pressure) in the HA. My first screenshot shows the unsupported status.

Happy that you found the cause

(Translated by Google PL->EN)

Hi,
Can the following be connected simultaneously to the CC2530 module?
ADC photovoltaic panel 1
ADC photovoltaic panel 2
ADC battery voltage
ADC wind direction
ADC UV sensor
I2C BME280
I2C BH1750
GPIO rainfall
GPIO wind speed
*I still have 6x DS18B20 and AS3935 on the PCB, but that’s too much.

It would be great if you could turn on energy saving :slight_smile:
Could someone show a screenshot of how to set it and whether something must be on a certain GPIO or can I use any GPIO?
I purchased the premium option, but I don’t really know how to use it. I managed to program the CC2530 using NodeMCU

Kind regards.
Peter

Great Project, working on building a similar one right now, however it needs to be battery powered.
My setup would be Solar Panel → Charge Controller → LiIon Cell → 3.3V Step-Up-Down Converter → Rest of the stuff.
Even using a Solar Panel, It would have to be in Power Saving Mode. With the configuration you posted there would be two problems. Pulse generator is incompatible however I’m not sure its even needed. Second, the Wind Speed sensor would constantly wake up the device (Rain Fall to but probably less frequent). Does any one have an idea how to change this? Waking up every 10 minutes and measuring wind speed over 5 or 10 seconds would be great.
As a last step I would love to measure the cell voltage, which I could do using an INA219 I2C voltage meter, however I have no idea how to convert this to battery_level / battery_low. The PTVO website mentions periodic battery reporting in power saving mode but no information how it’s done. It would also have to do some calculation, 4.2V = 100% 2.7V = 0%, also not linear, guess I would have to do this defining another mqtt sensor.

I would really appreciate any help using the Power Saving Mode.

No need especially for a real business-e-mail. Ti don’t accept my gmail or hotmail addresses but works with my internet provider’s one