DIY Zigbee weather station

Would love to do this but I feel like it would be way over my head!

Hi, Iā€™ve tried to make this interesting Zigbee Weather Station. BME280 is sending data (see payload).

2023-04-17 10:18:58MQTT publish: topic 'zigbee2mqtt/CC2530_Weather_Station', payload '{"action":null,"device_l1":"00","humidity_l1":39.1,"l1":39.079,"l10":null,"l11":null,"l12":null,"l13":null,"l14":null,"l15":null,"l16":null,"l2":null,"l3":null,"l4":null,"l5":null,"l6":0,"l7":null,"l8":3.3,"l9":null,"linkquality":91,"pressure_l1":100906,"state_l1":"OFF","state_l10":null,"state_l11":null,"state_l12":null,"state_l13":null,"state_l14":null,"state_l15":null,"state_l16":null,"state_l2":null,"state_l3":"OFF","state_l4":null,"state_l5":"OFF","state_l6":null,"state_l7":"ON","state_l8":null,"state_l9":null,"temperature_l1":28,"v

But when I add humidity sensor to the HA Dashboard Iā€™m getting ā€œUnavailableā€.
My HA is installed on an Intel laptop.
My configuration.yaml (for testing purposes) :


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml


mqtt:
  sensor:
    - name: "humidi_1"
      unique_id : humidi_1
      state_topic: "zigbee2mqtt/CC2530_Weather_Station"
      value_template: "{{ value_json.humidity_l1 }}"
      unit_of_measurement: "%"
      availability_topic: "zigbee2mqtt/bridge/state"
      payload_available: "online"
      payload_not_available: "offline"
      force_update: true
      json_attributes_topic: "zigbee2mqtt/CC2530_Weather_Station/attributes" 
      icon: mdi:water-percent

My zigbee2mqtt/configuration.yaml:

homeassistant: true
mqtt:
  server: mqtt://core-mosquitto:1883
  user: addons
  password: AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX9
serial:
  port: /dev/ttyUSB0
frontend:
  port: 8099
advanced:
  homeassistant_legacy_entity_attributes: false
  legacy_api: false
  legacy_availability_payload: false
device_options:
  legacy: false
devices:
  '0xa4c1386c58f5a839':
    friendly_name: tuya_presence_reed_test1
  '0xa4c138e44cb01346':
    friendly_name: tuya_temp_hum_test1
  '0xa4c13822a30ddbc5':
    friendly_name: water_leak_sensor_test1
  '0x00124b0012ea66ca':
    friendly_name: CC2530_Weather_Station

Iā€™m new to yaml. Where could be the issue ?

does anyone have some experience how long the station will run with batteries or/and solor?

I am curious too, Aqara Zigbee Temp & Humidity sensor I use lasts more than a year, but Iā€™d like to have Wind data too, so this would be useful to know.

Using the electronic circuit Iā€™ve made : LM3940-3.3V regulator + micro UPS (in Lion 3.7V & power 4.5-8v / out 5V) + CC2530 (Router) + BME280 : 71mA. If I take out CC2530 + BME280: 11mA. So 60mA current consumption in Router mode (not PSM). So definitely will not last more than a couple of days on standalone battery

Iā€™ve made a new HA setup : VM on my laptop using CC2531 flashed as Coordinator. Same issue.
Iā€™ve tried without friendly names, same issue.
When I try the original yaml code in the first post, Iā€™m getting error for ā€œ- platform: mqttā€.
Any idea how to make the original yaml code work with new versions of HA ?

Hmm, thatā€™s honestly disappointing, was expecting ZigBee to be more efficient than stupid WiFi, especially given the fact it is just a controller and simple BME. So with wind vane and anemometer power consumption will be even worseā€¦

Previously I had, DIY solar weather station based on esp8266 BME and a lux sensor with 3800mAh cell (deep sleep for 10 mins on ESPHome). I had no problems for most of the year except in winter.

However, in cold, cloudy winter weather it was only lasting three days, it was simply not enough power of the sun to charge the battery. I even swapped my cheap solar panel from AliExpress for the 5Watt panel from Reolink but this only added few extra days. Every week or so I had to go out and remove whole setup in order to charge it up from the phone charger, which was annoying.

With Aqara temp and humidity sensor I get the same functionality with really long life, more than a year. The wind is the only problem. Lux sensor from Aqara also adds nice lux info.

Discouraging, I know and I am sorry if my reply sounds like it. It is interesting project nonetheless.

Hi sloma
As Iā€™ve mentioned in my previous post, Iā€™ve programmed the CC2530 with PTVO using ā€œRouterā€ option as low consumption mode ā€œPSMā€ was throwing errors at compilation (limited functionalities maybe due to non free license) . So maybe with ā€œPSMā€ option, the power consumption would be drastically reduced.

In the HA MQTT sensors now require a different setup: MQTT Sensor - Home Assistant

# Example configuration.yaml entry
mqtt:
  sensor:
   
      - 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"
1 Like

Thanks Doublet for this excellent post and response.
Iā€™ve tried your new code in my configuration.yaml. Still Iā€™m getting ā€œTemperature shed : Unavailableā€.
When I try {{ value_json.temperature_l1| round(1) }} in Developers Tools ā†’ Template, I get the following error ā€œUndefinedError: ā€˜value_jsonā€™ is undefinedā€.
Iā€™ve checked that the weather station values are written in the file /config/zigbee2mqtt/state.json. If I replace ā€œstate_json.temperature_l1ā€ by ā€œstate.temperature_l1ā€ or ā€œstate.json.temperature_l1ā€ I get ā€œTemperature shed : Unavailableā€
Iā€™m lacking of ideas of where could be the issue

Did you check the output via the zigbee2mqtt add on?

Go the webgui of zigbee2mqtt
Search for your CC2530 device name like 0x00124b000fe64efd
Look at state, here you should see the actual values being transmitted from the CC2530

if not, then there is another challenge. :slight_smile:

under Zigbee2MQTT addon I can see values of humidity, temperature and pression being updated both in State of the CC2530 device and in Logs.
Example of State:

{
    "device_l1": "00",
    "device_l6": "00",
    "humidity_l1": 24.7,
    "humidity_l6": 45.2,
    "l1": 24.705,
    "l6": 0,
    "l8": 3.3,
    "last_seen": "2023-05-08T23:05:39+03:00",
    "linkquality": 94,
    "pressure_l1": 92788,
    "pressure_l6": 100785,
    "state_l1": "OFF",
    "state_l3": "OFF",
    "state_l5": "OFF",
    "state_l7": "ON",
    "temperature_l1": 28.1,
    "temperature_l6": 26.5,
    "voltage_l8": 3.3,
    "action": null,
    "l10": null,
    "l11": null,
    "l12": null,
    "l13": null,
    "l14": null,
    "l15": null,
    "l16": null,
    "l2": null,
    "l3": null,
    "l4": null,
    "l5": null,
    "l7": null,
    "l9": null,
    "state_l10": null,
    "state_l11": null,
    "state_l12": null,
    "state_l13": null,
    "state_l14": null,
    "state_l15": null,
    "state_l16": null,
    "state_l2": null,
    "state_l4": null,
    "state_l6": null,
    "state_l8": null,
    "state_l9": null
}

Example of Logs:

2023-05-08 23:06:12MQTT publish: topic 'zigbee2mqtt/weather_station_CC2531', payload '{"action":null,"device_l1":"00","device_l6":"00","humidity_l1":24.7,"humidity_l6":45.2,"l1":24.66,"l10":null,"l11":null,"l12":null,"l13":null,"l14":null,"l15":null,"l16":null,"l2":null,"l3":null,"l4":null,"l5":null,"l6":0,"l7":null,"l8":3.3,"l9":null,"last_seen":"2023-05-08T23:06:12+03:00","linkquality":92,"pressure_l1":92791,"pressure_l6":100785,"state_l1":"OFF","state_l10":null,"state_l11":null,"state_l12":null,"state_l13":null,"state_l14":null,"state_l15":null,"state_l16":null,"state_l2":null,"state_l3":"OFF","state_l4":null,"state_l5":"OFF","state_l6":null,"state_l7":"ON","state_l8":null,"state_l9":null,"temperature_l1":28.1,"temperature_l6":26.5,"voltage_l8":3.3}'

Somehow the dashboard is not able to read the values of humidity_l1, temparature_l1, pressure_l1.
But the dashboard is able to read the updated value of ā€œl1ā€ which randomly takes the value of either humidity or temperature or pressure

After some investigation and reading the following post ā€™ Template variable error: 'value_json' is undefined - mqtt - #18 by TermeHansenā€™, it seems that the input json (State) is badly formatted for some entries, hence the lovelace dashboard is showing ā€œunavailableā€ in some cases. The issue is that I canā€™t find where is the bad formatting in the json Iā€™ve provided in my post above (couldnā€™t find additional space, return carriageā€¦).
So still investigating

stupid question: did you use the latest PTVO firmware?

Iā€™m using PTVO version of 7th of Feb 2023

I will see if I can find on the web an earlier version and test it

Today Iā€™ve used PTVO version 2021-12-30 to generate the Hex. Same issue of ā€œunavailableā€ sensor output in loveloace dashboard. So the issue doesnā€™t seem to be from the Sate json.

I have a Tuya temperature and humidity device. Iā€™ve paired it with my CCS2531 zigbee coordinator. Lovelace dashboard is showing its default temperature and humidity values.
Related State json :

{
    "battery": 100,
    "humidity": 38.13,
    "last_seen": "2023-05-12T18:47:16+03:00",
    "linkquality": 86,
    "temperature": 23.84,
    "voltage": 3000
}

Iā€™ve tried to configure a ā€œmanualā€ temparature sensor in configuration.yaml as follows:

mqtt:
  sensor:
      - state_topic: "zigbee2mqtt/weather_station_CC2531"
        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/weather_station_CC2531/attributes" 
        icon: mdi:thermometer-lines  
        name: "Temperature shed"
        unique_id: cc2530_temperature_l1
        
      - state_topic: "zigbee2mqtt/Tuya_T_H"
        unit_of_measurement: "Ā°C"
        value_template: "{{ value_json.temperature | round(1) }}"
        availability_topic: "zigbee2mqtt/bridge/state"
        payload_available: "online"
        payload_not_available: "offline"
        json_attributes_topic: "zigbee2mqtt/Tuya_T_H/attributes" 
        icon: mdi:thermometer-lines  
        name: "Temperature tuya"
        unique_id: temp_tuya

Lovelace dashboard is showing Temperature tuya as Unavailable.
With both PTVO and Tuya State json itā€™s not working. So it doesnā€™t seem that the issue is related to bad formatting of json.
Back to square zero for investigations ā€¦

After giving up debugging why the value_json payload is not being parsed within mqtt sensor, Iā€™ve decided to parse it using Node-Red then handle the separated outputs through yaml (not by Node-Red).
It is working now for BME280 Temp, Humidity and Pressure.

Below you may find the Node-Red export of the Flow:

[{"id":"edec0f840215002e","type":"tab","label":"Weather Station Zigbee CC2530","disabled":false,"info":"","env":[]},{"id":"f186a88e563dd4b4","type":"mqtt in","z":"edec0f840215002e","name":"","topic":"zigbee2mqtt/CC2530_Weather_Station/#","qos":"2","datatype":"auto-detect","broker":"12edb785fb5ab57c","nl":false,"rap":true,"rh":0,"inputs":0,"x":220,"y":460,"wires":[["1c0255251db1567f","6d7279bde2905cba","60f49c16166f59e9","f2f73106f88a90cb","ca7d346a5e84fbf4"]]},{"id":"9fbe852074ce5ced","type":"debug","z":"edec0f840215002e","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":360,"wires":[]},{"id":"b32f6a1ccb113f77","type":"debug","z":"edec0f840215002e","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":460,"wires":[]},{"id":"159da52485cd1702","type":"debug","z":"edec0f840215002e","name":"debug 5","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":560,"wires":[]},{"id":"1c0255251db1567f","type":"debug","z":"edec0f840215002e","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":280,"y":400,"wires":[]},{"id":"6d7279bde2905cba","type":"function","z":"edec0f840215002e","name":"function 1","func":"var p = msg.payload\nvar temp = p.temperature_l1\nvar hum = p.humidity_l1\nvar pres = p.pressure_l1\nmsg.payload=temp\n//msg.payload = hum\n//msg.payload=pres\n//msg.temp = temp\n//msg.hum= hum\n//msg.pres = pres\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":400,"wires":[["9fbe852074ce5ced","c2db247511ff6ccb"]]},{"id":"60f49c16166f59e9","type":"function","z":"edec0f840215002e","name":"function 2","func":"var p=msg.payload\nvar temp = p.temperature_l1\nvar hum = p.humidity_l1\nvar pres = p.pressure_l1\n//msg.payload=temp\nmsg.payload=hum\n//msg.payload=pres\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":500,"wires":[["b32f6a1ccb113f77","c914e17f344a640d"]]},{"id":"f2f73106f88a90cb","type":"function","z":"edec0f840215002e","name":"function 3","func":"var p = msg.payload\nvar temp = p.temperature_l1\nvar hum = p.humidity_l1\nvar pres = p.pressure_l1\n//msg.payload=temp\n//msg.payload = hum\nmsg.payload=pres\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":600,"wires":[["159da52485cd1702","febdf43d819adf59"]]},{"id":"eb1d27c9b2a62ffa","type":"debug","z":"edec0f840215002e","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":240,"y":600,"wires":[]},{"id":"c2db247511ff6ccb","type":"mqtt out","z":"edec0f840215002e","name":"Weather_Station_T","topic":"zigbee2mqtt/Weather_Station_T","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"12edb785fb5ab57c","x":670,"y":400,"wires":[]},{"id":"a49b6ce0e1b94e0b","type":"mqtt in","z":"edec0f840215002e","name":"","topic":"zigbee2mqtt/Weather_Station/#","qos":"2","datatype":"auto-detect","broker":"12edb785fb5ab57c","nl":false,"rap":true,"rh":0,"inputs":0,"x":210,"y":540,"wires":[["eb1d27c9b2a62ffa"]]},{"id":"c914e17f344a640d","type":"mqtt out","z":"edec0f840215002e","name":"Weather_Station_H","topic":"zigbee2mqtt/Weather_Station_H","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"12edb785fb5ab57c","x":670,"y":500,"wires":[]},{"id":"febdf43d819adf59","type":"mqtt out","z":"edec0f840215002e","name":"Weather_Station_P","topic":"zigbee2mqtt/Weather_Station_P","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"12edb785fb5ab57c","x":670,"y":600,"wires":[]},{"id":"ca7d346a5e84fbf4","type":"function","z":"edec0f840215002e","name":"function 4","func":"var p = msg.payload\nvar wind_v = p.l8\nmsg.payload = wind_v\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":480,"y":700,"wires":[["b932c3beca88dbdb","37f511bc4ede0b1a"]]},{"id":"37f511bc4ede0b1a","type":"mqtt out","z":"edec0f840215002e","name":"Weather_Station_Wind_V","topic":"zigbee2mqtt/Weather_Station_Wind_V","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"12edb785fb5ab57c","x":690,"y":700,"wires":[]},{"id":"b932c3beca88dbdb","type":"debug","z":"edec0f840215002e","name":"debug 6","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":640,"y":660,"wires":[]},{"id":"12edb785fb5ab57c","type":"mqtt-broker","name":"","broker":"localhost","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]

and the configuration.yaml:

homeassistant:
  packages: !include_dir_named packages

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Text to speech
tts:
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
#sensor: !include_dir_merge_list sensors


mqtt:
  sensor:
      - name: "Temperature shed"
        state_topic: 'zigbee2mqtt/Weather_Station_T'
        unit_of_measurement: "Ā°C"
        icon: mdi:thermometer-lines
        value_template: "{{value_json | round(2)}}"
        
      - name: "Humidity shed"
        state_topic: 'zigbee2mqtt/Weather_Station_H'
        unit_of_measurement: "%"
        icon: mdi:water-percent
        value_template: "{{value_json | round(2)}}"
        
      - name: "Pressure"
        state_topic: 'zigbee2mqtt/Weather_Station_P'
        unit_of_measurement: "hpa"
        icon: mdi:weight
        value_template: "{{value_json | round(0)}}"

      - name: "Wind voltage"
        state_topic: 'zigbee2mqtt/Weather_Station_Wind_V'
        unit_of_measurement: "V"
        icon: mdi:call-made
        value_template: "{{value_json | round(2)}}"

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


template:
  - sensor:
      - name: "Rainfall today"
        unit_of_measurement: "mm"
        icon: mdi:water
        state: >-
          {% set count = states('sensor.daily_rain_clicks') | int %}
          {% set mm_per_pulse = 0.30303 %}
          {% set mm = count * mm_per_pulse %}
          {{ mm|round(1, 'floor') }} 

      - name: "Absolute Humidity shed"
        unit_of_measurement: "g/mĀ³"
        icon: mdi:water
        state: >-
          {% 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 %}

      - name: "Dewpoint shed"
        unit_of_measurement: "Ā°C"
        icon: mdi:coolant-temperature
        state: >-
          {{ (log( states('sensor.humidity_shed')|int / 100 ) + 18.678 * states('sensor.temperature_shed')|float / (257.14 + states('sensor.temperature_shed')|float ) )| round (1) }}  

      - name: "WindSpeed"
        unit_of_measurement: "m/s"
        icon: mdi:weather-windy
        # m_per_pulse = (r * 2 * Pi)/2 = (0.09 * 2 * 3.14)/2 = 0.2862 m
        state: >-
          {% set count = states('sensor.CC2530_Weather_Station_l6') | int %}
          {% set m_per_pulse = 0.2826 %} 
          {% set mps = count * m_per_pulse %}
          {{ mps|round(1) }}
          
      - name: "WindForce"
        icon: mdi:wind-power
        # m_per_pulse = (r * 2 * Pi)/2 = (0.09 * 2 * 3.14)/2 = 0.2862 m
        state: "{% set wind = states('sensor.WindSpeed')|float %}
        {% set wind_round = wind|round(1) %}
        {% if wind <= 1 %}Bft: 0, Wind stil, {{wind_round}} km/h
        {% elif wind <= 5 %}Bft: 1
        , Zwak: flauwe wind, {{wind_round}} km/h
        {% elif wind <= 11 %}Bft: 2, Zwak, {{wind_round}} km/h
        {% elif wind <= 20 %}Bft: 3, Matig: lichte bries, {{wind_round}} km/h
        {% elif wind <= 28 %}Bft: 4, Matig: flauwe bries, {{wind_round}} km/h
        {% elif wind <= 39 %}Bft: 5, Vrij krachtig, {{wind_round}} km/h
        {% elif wind <= 50 %}Bft: 6, Krachtig, {{wind_round}} km/h
        {% elif wind <= 62 %}Bft: 7, Hard, {{wind_round}} km/h
        {% elif wind <= 75 %}Bft: 8, Stormachting, {{wind_round}} km/h
        {% elif wind <= 89 %}Bft: 9, Storm, {{wind_round}} km/h
        {% elif wind <= 103 %}Bft: 10, Zware storm, {{wind_round}} km/h
        {% elif wind <= 117 %}Bft: 11, Zeer zware storm, {{wind_round}} km/h
        {% else %} > 117 %}Bft: 12, Orkaan, {{wind_round}} km/h
        {%- endif %}"
        
      - name: "Beaufort"
        state: "{% set wind = states('sensor.WindSpeed')|float %}
        {% if wind <= 1 %} 0
        {% elif wind <= 5 %} 1
        {% elif wind <= 11 %} 2
        {% elif wind <= 20 %} 3
        {% elif wind <= 28 %} 4
        {% elif wind <= 39 %} 5
        {% elif wind <= 50 %} 6
        {% elif wind <= 62 %} 7
        {% elif wind <= 75 %} 8
        {% elif wind <= 89 %} 9
        {% elif wind <= 103 %} 10
        {% elif wind <= 117 %} 11
        {% else %} > 117 %} 12
        {%- endif %}"
#        entity_picture_template: "
#        {% set state = states('sensor.Beaufort') %}
#        {% set path = '/local/Beaufort/' %}
#        {% set ext = '.jpg'%}
#        {{[path,state,ext]|join('')|lower}}" 

      - name: "WindAzimuth"
        icon: mdi:windsock
        unit_of_measurement: "Ā°"
        state: >-
          {% 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 %} 295.5
          {% endif %}
        
      - name: "Wind direction"
        icon: mdi:windsock
        state: >-
          {% set degrees = states('sensor.WindAzimuth')|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] }}

Next step is to connect the rain and wind sensors to check if itā€™s working.

edit ===================

Finally, by luck, I found how to parse value_json within mqtt sensor : just comment or delete availability_topic:

mqtt:
  sensor:
      - state_topic: "zigbee2mqtt/weather_station_CC2531"
        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/weather_station_CC2531/attributes" 
        icon: mdi:thermometer-lines  
        name: "Temperature shed"
        unique_id: cc2530_temperature_l1

et voilĆ  no need to go through node-red intermediate step.
I donā€™t have an explanation why it works like this

======================

I would like to add to this great zigbee weather station AS3935 module : lightning sensor. It has an external interruption pin when a lightning is very near. It works with I2C and SPI. If it interests you, you may vote for an enhancement Iā€™ve raised to PTVO to support it https://github.com/ptvoinfo/zigbee-configurable-firmware/issues/202

1 Like

I have the same. I canā€™t login at TI. I have no business-e-mail.

did you find a solution to obtain the program?

I was able to download the TI program by using a .co.uk email. However, Iā€™m using Linux so although PTVO runs ok and creates the .hex files fine and I can load the TI programmer in wine (Linux windows emulator) it canā€™t see the hardware as Linux struggles to allow USB port access. A simple solution is to use cc-tools cc-tool download | SourceForge.net to program the device via RF04EB. If you have access to a Linux box or a virtual machine this may work for you.

I can now program my cc2530 perfectly!

1 Like