Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024

(Note that 4.1.0 (build 4024) - 05 June 2024 remains available, but usage of this version is not recommended - particularly for Davis stations - and the included utility in this distribution for migrating to v4 is known to contain errors affecting conversion of dayfile.txt)

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

MQTT Export - Added Build 3071

From build 3044 the development baton passed to Mark Crossley. Mark has been responsible for all the Builds since. He has made the code available on GitHub. It is Mark's hope that others will join in this development, but at the very least he welcomes your ideas for future developments (see Cumulus MX Development suggestions).

Moderator: mcrossley

uncle_bob
Posts: 505
Joined: Wed 17 Aug 2011 2:58 pm
Weather Station: WeatherDuino Pro2
Operating System: 2008
Location: Canberra

Re: MQTT Export - Added Build 3071

Post by uncle_bob »

I thought I'd document my settings so no one else has to lose hair getting CumulasMX data into Home Assistant.
Mods, please feel free to move this post to a better thread if necessary.

First, my IntervalTemplate.txt looks like this:

Code: Select all

{"topics":[
    {
        "topic": "sensor/cumulusmx/interval",
        "data": "{\"time\":\"<#timehhmmss>\",\"temp\":<#temp rc=y>,\"humidity\":<#hum>,\"rain today\":<#rfall>,\"rain rate\":<#rrate>,\"pressure\":<#press>,\"windspeed\":<#wspeed>,\"windgust\":<#wgust rc=y>}",
        "retain": false
    }
]}
Then you need to setup CumulusMX/Settings/Internet Settings/MQTT with you mqtt server-name or IP address and credentials needed to connect to it. Then Set and enable the Template File: to IntervalTemplate.txt. Save the settings.

In Home Assistant:
In your /config/configuration.yaml file add the line:
mqtt: !include mqtt.yaml

Then create a file called mqtt.yaml in the config folder then add the following lines in this file:

Code: Select all

sensor:
  - name: "Weather Station Rain Rate"
    state_topic: "sensor/cumulusmx/interval"
    value_template: '{{ value_json["rain rate"] }}'
    unit_of_measurement: "mm"
  - name: "Weather Station Rain today"
    state_topic: "sensor/cumulusmx/interval"
    value_template: '{{ value_json["rain today"] }}'
    unit_of_measurement: "mm"
  - name: "Weather Station Pressure"
    state_topic: "sensor/cumulusmx/interval"
    value_template: '{{ value_json["pressure"] }}'
    unit_of_measurement: "hPa"
  - name: "Weather Station Wind Speed"
    state_topic: "sensor/cumulusmx/interval"
    value_template: '{{ value_json["windspeed"] }}'
    unit_of_measurement: "kph"
  - name: "Weather Station Wind Gust"
    state_topic: "sensor/cumulusmx/interval"
    value_template: '{{ value_json["windgust"] }}'
    unit_of_measurement: "kph"
  - name: "Weather Station Humidity"
    state_topic: "sensor/cumulusmx/interval"
    value_template: '{{ value_json["humidity"] }}'
    unit_of_measurement: "%"
  - name: "Weather_Station_Temp"
    state_topic: "sensor/cumulusmx/interval"
    value_template: '{{ value_json["temp"] }}'
    unit_of_measurement: "c"    
Then from the Developer Tools page, YAML tab, click "MANUALLY CONFIGURED MQTT ENTITIES" to reload the mqtt integration.

Now you should have the data in Home Assistant like below to use however you need:

Image

Hope this helps!
Interested in building your own Weather Station? Maybe check out the WeatherDuino Pro Project Here
Conder, Canberra Weather
Image
Nossie
Posts: 365
Joined: Tue 16 Aug 2022 8:01 pm
Weather Station: Ecowitt 2551
Operating System: Raspberry Pi5 Debian Bookworm
Location: Stewarton, East Ayrshire UK
Contact:

Re: MQTT Export - Added Build 3071

Post by Nossie »

fantastic guide,

the only things I'm now trying to do is change the Sensor header on the card - and I was wondering, does anyone know an easy way of identifying what (I'm guessing are webtags) are actually being used at any one time?


@Uncle_Bob - I'm in the process of reconfiguring this, can you tell me, did you use the mosquito addon - or did the file you create fall back on a legacy feature? I need to be able to assign the data it's own unique ID so that I can then use the data for my needs, but since your solution does not touch on the MQTT addon, I'm guessing you used an older way making my attempt to give it a unique ID redundant

For those in the same situation as me - you can just allocate a unique id as part of your code

Code: Select all

sensor:
  - name: "Weather Station Rain Rate"
    state_topic: "sensor/cumulusmx/interval"
    unique_id: 'weather_station_rain_rate'
    value_template: '{{ value_json["rain rate"] }}'
    unit_of_measurement: "mm"
  - name: "Weather Station Rain today"
    state_topic: "sensor/cumulusmx/interval"
    unique_id: 'weather_station_rain_today'
    value_template: '{{ value_json["rain today"] }}'
    unit_of_measurement: "mm"
  - name: "Weather Station Pressure"
    state_topic: "sensor/cumulusmx/interval"
    unique_id: 'weather_station_pressure'
    value_template: '{{ value_json["pressure"] }}'
    unit_of_measurement: "hPa"
  - name: "Weather Station Wind Speed"
    state_topic: "sensor/cumulusmx/interval"
    unique_id: 'weather_station_wind_speed'
    value_template: '{{ value_json["windspeed"] }}'
    unit_of_measurement: "mph"
  - name: "Weather Station Wind Gust"
    state_topic: "sensor/cumulusmx/interval"
    unique_id: 'weather_station_wind_gust'
    value_template: '{{ value_json["windgust"] }}'
    unit_of_measurement: "mph"
  - name: "Weather Station Humidity"
    state_topic: "sensor/cumulusmx/interval"
    unique_id: 'weather_station_humidity'
    value_template: '{{ value_json["humidity"] }}'
    unit_of_measurement: "%"
  - name: "Weather Station Temp"
    state_topic: "sensor/cumulusmx/interval"
    unique_id: 'weather_station_temperature'
    value_template: '{{ value_json["temp"] }}'
    unit_of_measurement: "°C"
cheers,
Ian.

http://www.StewartonWeather.com
Containerised Cumulus[MX] 3.28.0 (build: 3269) ● CumulusUtils Version 6.23.0● Ecowitt 2551/WH65/T&HP/WH57/WH45/3x WH51 ● Pi 5 8GB ● Debian Bookworm ● Ubuntu Server Host
Beny44
Posts: 5
Joined: Sun 10 Jan 2016 1:23 pm
Weather Station: Davis Vantage Pro 2
Operating System: WIN 7
Location: Kladno

Re: MQTT Export - Added Build 3071

Post by Beny44 »

Hey,
I'm trying to upload data from CumulusMX to HA via MQTT.
I have set up the templates according to the post above.
Using MQTT Explore I can see that the data is going to HA, but the entities are unknown.
I don't know where the error could be.
Tnx.
You do not have the required permissions to view the files attached to this post.
paulver
Posts: 2
Joined: Wed 26 Jul 2023 8:17 pm
Weather Station: Davis Vantage Pro2
Operating System: Ubuntu Linux 22.04
Location: Towradgi, Australia

Re: MQTT Export - Added Build 3071

Post by paulver »

Beny44 wrote: Sun 16 Jul 2023 4:51 pm ..
Using MQTT Explore I can see that the data is going to HA, but the entities are unknown.
I don't know where the error could be.
Hi Beny (and all others that seem to be experiencing similar woes),

I have it working now. Details below, but a bit of an explainer.

I was suffering the same problems and trying everything to get the values to display.

I finally got it working, when I did a full reset of my efforts, following @uncle_bob's instructions verbatim, including copying and pasting his exact content, and then working from there.

My biggest discovery from the exercise, was that there must be a hidden character or syntactical error in my original "IntervalTemplate.txt" file. Similar to you, it was driving me nuts as the values would not port properly, even though they'd show up as the string in mqtt explorer.

1. Here's what my mqtt explorer output looked like when "broken":
interval-templ-broken.jpg

2. When I copied @unclebob's content for "IntervalTemplate.txt" and "mqtt.yaml", following his instructions, everything worked as hoped. (After three days of frustration and tears, there was a bit of a "yip!" and a little dance on the spot); The sensor entities started showing the values, instead of "unknown".

The biggest "ah, there's the issue" observation for me, was the format of the output value in mqtt explorer when it started working as intended. You can see in my 2nd example, that the values are colour coded and listed line by line in the right pane, with the lightning character in the left column. When it looked like this, the state values started working.

Here's what explorer shows, when everything is correct:
interval-templ-working.jpg

And here's the states view in HASS, showing the values populating for the configured sensors in mqtt.yaml
sensor-state.jpg
3. From knowing this key piece of information, I have now been tailoring my config to include additional sensor objects (see https://www.cumuluswiki.org/a/Full_list_of_Webtags). I've also formatted the IntervalTemplate.txt file to be a bit more readable and easier to edit.

I started by making a small change or addition to "IntervalTemplate.txt". I then save the file. Then, observe the explorer output to confirm content formatted as expected. If it reverted to all grey or the single string line like in my 1st screenshot above, then the addition / change had issues.
Reverse the change, check result. Rinse and repeat for each new sensor object or layout change to the file.

What my "IntervalTemplate.txt" file looks like so far:

Code: Select all

{"topics":[
    {
        "topic": "sensor/cumulusmx/interval",
        "data": "{
                  \"time\":\"<#timehhmmss>\",
                  \"temp\":<#temp rc=y>,
                  \"recenttemphr\":<#RecentOutsideTemp h=1>,
                  \"intemp\":<#intemp rc=y>,
                  \"feels like\":<#feelslike rc=y>,
                  \"humidity\":<#hum>,
                  \"inhum\":<#inhum>,
                  \"raintoday\":<#rfall>,
                  \"rainrate\":<#rrate>,
                  \"rainlasthr\":<#rhour>,
                  \"rainlst24\":<#r24hour>,
                  \"rainmnth\":<#rmonth>,
                  \"rainyear\":<#ryear>,
                  \"drydays\":<#ConsecutiveDryDays>,
                  \"pressure\":<#press>,
                  \"pressuretrendval\":<#presstrendval>,
                  \"pressuretrend3hr\":<#PressChangeLast3Hours>,
                  \"windspeed\":<#wspeed>,
                  \"windgust\":<#wgust rc=y>
                  }",
        "retain": false
    }
]}
I'm a happy HASS / Cumulus user now! I hope my findings assist others too.

I do admit, I still have no idea what the "rc=y" in some sensor objects is for though. Maybe someone can shed some light on this?
You do not have the required permissions to view the files attached to this post.
Last edited by paulver on Thu 27 Jul 2023 4:10 am, edited 1 time in total.
User avatar
HansR
Posts: 6091
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bookworm
Location: Wagenborgen (NL)
Contact:

Re: MQTT Export - Added Build 3071

Post by HansR »

paulver wrote: Thu 27 Jul 2023 4:04 am I do admit, I still have no idea what the "rc=y" in some sensor objects is for though. Maybe someone can shed some light on this?
The Wiki Webtag page will help you and will lead to the parameters page where you will find that the RC does the setting for the decimal separator.
(check out the pages content and origin, start at the initial Webtags page).
Last edited by HansR on Thu 27 Jul 2023 8:49 am, edited 1 time in total.
Hans

https://meteo-wagenborgen.nl
CMX build 4023+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
Beny44
Posts: 5
Joined: Sun 10 Jan 2016 1:23 pm
Weather Station: Davis Vantage Pro 2
Operating System: WIN 7
Location: Kladno

Re: MQTT Export - Added Build 3071

Post by Beny44 »

Thank you for your advice.
I went the other way and send the data to Node Red in HA and I can see it from there.
But the problem is in the decimal separator, both in NR and your way.
paulver
Posts: 2
Joined: Wed 26 Jul 2023 8:17 pm
Weather Station: Davis Vantage Pro2
Operating System: Ubuntu Linux 22.04
Location: Towradgi, Australia

Re: MQTT Export - Added Build 3071

Post by paulver »

HansR wrote: Thu 27 Jul 2023 7:38 am
The Wiki Webtag page will help you and will lead to the parameters page where you will find that the RC does the setting for the decimal separator.
(check out the pages content and origin, start at the initial Webtags page).
Ah. thank you for this.
uncle_bob
Posts: 505
Joined: Wed 17 Aug 2011 2:58 pm
Weather Station: WeatherDuino Pro2
Operating System: 2008
Location: Canberra

Re: MQTT Export - Added Build 3071

Post by uncle_bob »

paulver wrote: Thu 27 Jul 2023 4:04 am
I finally got it working, when I did a full reset of my efforts, following @uncle_bob's instructions verbatim, including copying and pasting his exact content, and then working from there.
Great to see that helped! I've actually had to go thru and re-read it due to mucking up my template lol. I like how you formatted the template. I might even have to pinch yours :-)

Could you do me/us a favor and post up your mqtt.yaml too? I'm lazy and a crappy typist :mrgreen:
Interested in building your own Weather Station? Maybe check out the WeatherDuino Pro Project Here
Conder, Canberra Weather
Image
Rayj44
Posts: 6
Joined: Mon 07 Apr 2014 6:50 pm
Weather Station: Davis VP2 and WLL
Operating System: Raspberry Pi
Location: Longridge, Lancashire.
Contact:

Re: MQTT Export - Added Build 3071

Post by Rayj44 »

A great big thankyou to uncle bob for his tutorial. I've used CumulusMX on a RPi since it's beginning, but I'm new to HA, which I can't quite get my head round. I struggled for days to get CMX working with HA, but thanks to uncle bob, it all seems to be working now.

Thanks again.

Ray, G3NKL
WDB
Posts: 1
Joined: Sat 06 Jan 2024 5:25 pm
Weather Station: Davis Vantage Pro 2
Operating System: Linux Raspberry Pi

Re: MQTT Export - Added Build 3071

Post by WDB »

Thanks to this thread I have finally gotten my weather station data into Home Assistant. Thanks everybody, I was having a hard time with unknown sensor data in HA.
tallasen
Posts: 19
Joined: Sat 22 Jun 2013 7:55 am
Weather Station: Davis Vantage Pro2 Plus Wireless
Operating System: Windows 11 on Proxmox PVE
Location: Nora, Sweden

Re: MQTT Export - Added Build 3071

Post by tallasen »

Any idea why in Home Assistant this error occurs, but all my sensors is working properly?

Also, I have been struggeling to get the new template with multiple topics to work without any success... Has anyone got a valid code that's working? :ugeek:
Skärmbild 2024-01-11 105513.png
You do not have the required permissions to view the files attached to this post.
Post Reply