Page 4 of 5

Re: MQTT Export - Added Build 3071

Posted: Wed 02 Jun 2021 6:25 am
by tallasen
mcrossley wrote: Tue 25 May 2021 7:02 pm What is stopping you doing that now? Just define the template and it will work.

BTW, MQTT will get a bit of loving for the next full release. ;)
Great news, looking forward to that!!

Mqtt runing on MX is essential for me implementing sensors in Home Assistant via Mosquitto broker. :P

Re: MQTT Export - Added Build 3071

Posted: Wed 02 Jun 2021 10:05 am
by peterpc58
I think max characters in mqtt for ha is 255....

Re: MQTT Export - Added Build 3071

Posted: Wed 02 Jun 2021 12:27 pm
by tallasen
Ok, it might be so. But I still got the error "Entity is non-numeric: sensor.vp2_temp_out"

sensor looks like this:

Code: Select all

sensor:
  - platform: mqtt
    state_topic: "CumulusMX/Interval"
    name: "VP2 temp out"
    unique_id: "VP2 temp out"
    unit_of_measurement: "°C"
    icon: mdi:temperature-celsius
    value_template: "{{ value_json.tempOut }}"
Cumulus Interval tEmplate:
{"time":"<#timehhmmss>","tempOut":<#temp rc=y>,"tempIn":<#intemp rc=y>,"tempTA":<#avgtemp rc=y>,"humidity":<#hum>,"wgust10":<#wgust10 rc=y>}

Re: MQTT Export - Added Build 3071

Posted: Thu 03 Jun 2021 7:09 am
by tallasen
Now I've been running mqtt overnight without any problems. I have a guess what could trigger the error.
Cumulus sends data to Mosquitto via a readable .txt file. It looks like this right now:

Code: Select all

{"time":"<#timehhmmss>","temp":<#temp rc=y>,"tempin":<#intemp rc=y>,
"humidity":<#hum>,"wgust":<#wgust rc=y>}
I have added sensors that match the inputs above, just to start over.

Before this I've done edits and added data fields with notepad++ and saved as a .txt file in a long single line, then after some time I got this annoying "entity is non numeric" error.

Yesterday I edited the "stock" file from Cumulus MX with Sublime text, making some minor adjustments to meet my needs, and inputs were automatically shifted to a new line (a 2:nd line, see above), not a single line with all inputs. So far no errors.

Re: MQTT Export - Added Build 3071

Posted: Mon 24 Jan 2022 8:53 pm
by watsonm
Just another vote for defining multiple topics pretty please..... :?

Re: MQTT Export - Added Build 3071

Posted: Mon 24 Jan 2022 10:14 pm
by mcrossley
??? You can define as many topics as you like.

Re: MQTT Export - Added Build 3071

Posted: Tue 25 Jan 2022 9:02 am
by watsonm
Got it thanks, (missing a comma separator! ) :bash: :bash:

Re: MQTT Export - Added Build 3071

Posted: Tue 01 Feb 2022 10:30 am
by tallasen
Skärmbild 2022-01-31 154816.jpg
As soon as I add more fields to my interval.txt file from Cumulus MX , it starts to look like this. I edit the file in Sublime Text 3 with “json” as encoding.
Am I doing something wrong, why is this long line appering?

Thanks for any help or suggestions!

Code like this:

Code: Select all

{"topics":[
    {
        "topic": "CumulusMX/Interval",
        "data": "{\"time\":\"<#timehhmmss>\",\"press\":<#press rc=y>,\"temp\":<#temp rc=y>,\"tempin\":<#intemp rc=y>,\"tempavg24\":<#avgtemp rc=y>,\"apptemp\":<#apptemp rc=y>,\"tempchangeh\":<#TempChangeLastHour rc=y>,\"raintoday\":<#rfall rc=y>,\"rainmonth\":<#rmonth rc=y>,\"rainratetoday\":<#rrate rc=y>,\"humidity\":<#hum>,\"humidityin\":<#inhum>,\"avgbearing\":<#avgbearing>,\"windavg10m\":<#wspeed rc=y>,\"wgust10\":<#wgust rc=y>}",
        "retain": true
    }
]}

Re: MQTT Export - Added Build 3071

Posted: Tue 01 Feb 2022 11:07 am
by mcrossley
I'm not sure what you think is wrong? It looks like the message is being received and parsed correctly.

Re: MQTT Export - Added Build 3071

Posted: Tue 01 Feb 2022 1:23 pm
by tallasen
Hi Mark,

yes, everything works just fine.

But can you please explain why the message suddenly appears in a long, single line? It is just for convenience to have the message line by line so to say.

Re: MQTT Export - Added Build 3071

Posted: Tue 01 Feb 2022 10:17 pm
by mcrossley
It appears as one line because that is how the template is formatted, it is also the most compact format - no point to transmitting more data than you need to. You could change that however you like and put new lines and spaces between the entries so it looks like the "pretty format" in your screen shot. But computers that will be reading the data don't care about prettifying.

Re: MQTT Export - Added Build 3071

Posted: Thu 03 Feb 2022 10:37 am
by watsonm
tallasen,
As an example my DataUpdateTemplate.txt now looks like this :

{"topics": [
{
"topic": "CumulusMX-Ghost/Time",
"data":<#timehhmmss>
"retain": false
}
,
{
"topic": "CumulusMX-Ghost/Pressure",
"data":<#press>
"retain": false
}
,
**************************** LInes removed to limit output
{
"topic": "CumulusMX-Ghost/Wind_Max",
"data":<#wgust>
"retain": false
}
,
{
"topic": "CumulusMX-Ghost/Rain",
"data":<#rfall>
"retain": false
}

]}

and the output comes out like this, which I find easier to parse in my python script..

Re: MQTT Export - Added Build 3071

Posted: Sun 23 Oct 2022 7:18 am
by uncle_bob
My pressure doesn't seem to be published:

Image

My IntervalTemplate.txt looks like this:

Code: Select all

{"topics":[
    {
        "topic": "sensor/cumulusmx/interval",
        "data": "{\"time\":\"<#timehhmmss>\",\"temp\":<#temp rc=y>,\"humidity\":<#hum>,\"wgust\":<#wgust rc=y>}",\"pressure\":<#press>,\"windspeed\":<#wlatest rc=y>,
        "retain": false
    }
]}
Any idea why this might not be showing up?
Thanks Bob

Re: MQTT Export - Added Build 3071

Posted: Sun 23 Oct 2022 8:10 am
by watsonm
After wgust you have a closing squiggly bracket. }
And a quote. "
So rest of line is ignored.....

Re: MQTT Export - Added Build 3071

Posted: Sun 23 Oct 2022 8:30 am
by uncle_bob
Thank's Mike, I can now see it in mqtt explorer. Cheers!
Now just to see why it's not showing in Home Assistant.