Page 2 of 2

Re: MQTT

Posted: Wed 22 Apr 2020 6:57 am
by Vossenberg
mcrossley wrote: Tue 14 Apr 2020 12:19 pm CMX version 3.5.2 is now available which should fix the MQTT issues.
Yes it is working, and I get messages through the broker! :-) Great! This was resolved very quickly!
This is a great feature which will make home automation even nicer!

Now I realise that Home Assistant is configured with another locale. So 18.9 degrees instead of 18,9 degrees.
A conversion option would be very very interesting, as I might expect that this will happen both ways.

(Meanwhile I'll try to find a solution in Home Assistant as well)

Re: MQTT

Posted: Wed 22 Apr 2020 8:19 am
by laulau
Does someone use Domoticz ?
I would like to interface using MQTT but i'm a newbe with that :oops:

Re: MQTT

Posted: Wed 22 Apr 2020 9:05 am
by HansR
laulau wrote: Wed 22 Apr 2020 8:19 am Does someone use Domoticz ?
I would like to interface using MQTT but i'm a newbe with that :oops:
I do, but I use it only rudimentary for reading my electricity meter.
Now you set me on a track... :)

Re: MQTT

Posted: Wed 22 Apr 2020 9:18 am
by mcrossley
Vossenberg wrote: Wed 22 Apr 2020 6:57 am Now I realise that Home Assistant is configured with another locale. So 18.9 degrees instead of 18,9 degrees.
A conversion option would be very very interesting, as I might expect that this will happen both ways.
You probably should be using the <#RCxxx> versions of the tags in JSON. I'll have a version of CMX soon that accepts the dot decimal parameter (rc=y) on all decimal number tags.

Re: MQTT

Posted: Wed 22 Apr 2020 11:01 am
by Vossenberg
mcrossley wrote: Wed 22 Apr 2020 9:18 am
Vossenberg wrote: Wed 22 Apr 2020 6:57 am Now I realise that Home Assistant is configured with another locale. So 18.9 degrees instead of 18,9 degrees.
A conversion option would be very very interesting, as I might expect that this will happen both ways.
You probably should be using the <#RCxxx> versions of the tags in JSON. I'll have a version of CMX soon that accepts the dot decimal parameter (rc=y) on all decimal number tags.
Great i'll check that out after work... :-D I'll post back here with updates!

Re: MQTT

Posted: Wed 22 Apr 2020 11:10 am
by Vossenberg
Vossenberg wrote: Wed 22 Apr 2020 11:01 am
mcrossley wrote: Wed 22 Apr 2020 9:18 am
Vossenberg wrote: Wed 22 Apr 2020 6:57 am Now I realise that Home Assistant is configured with another locale. So 18.9 degrees instead of 18,9 degrees.
A conversion option would be very very interesting, as I might expect that this will happen both ways.
You probably should be using the <#RCxxx> versions of the tags in JSON. I'll have a version of CMX soon that accepts the dot decimal parameter (rc=y) on all decimal number tags.
Great i'll check that out after work... :-D I'll post back here with updates!
Indeed it works like a charm now, could not wait until after work :lol:

Re: MQTT

Posted: Mon 18 Jul 2022 2:26 am
by uncle_bob
Can someone feeding Home Assistant please help me out?
I've been trying to get my MQTT messages to turn up as entities in HA but they fail to appear. I can see the messages in HA if I use the # to listen to all messages in the HA MQTT settings page. What's the secret to make this happen? Thanks

Here's the received message in the MQTT settings page:

Message 5 received on homeassistant/cumulus at 11:50 AM:

{
"time": "11:50:42",
"temp": 13.4,
"humidity": 47,
"wgust": 13
}

QoS: 0 - Retain: false

It's got me stumped :/

Re: MQTT

Posted: Mon 18 Jul 2022 5:33 am
by Sadgit
You need to create a sensor. This is a snippet of my sensors file

Code: Select all

    
  - platform: mqtt
    name: "Weather Station Rain"
    state_topic: "tele/cumulusmx/interval"
    value_template: '{{ value_json["rain"] }}' 
    unit_of_measurement: "mm"     
  - platform: mqtt
    name: "Weather Station Pressure"
    state_topic: "tele/cumulusmx/interval"
    value_template: '{{ value_json["pressure"] }}'
    unit_of_measurement: "hPa"
  - platform: mqtt
    name: "Weather Station Wind Speed"
    state_topic: "tele/cumulusmx/interval"
    value_template: '{{ value_json["windspeed"] }}'
    unit_of_measurement: "mph"
  - platform: mqtt
    name: "Weather Station Wind Gust"
    state_topic: "tele/cumulusmx/interval"
    value_template: '{{ value_json["windgust"] }}'
    unit_of_measurement: "mph"
  - platform: mqtt
    name: "Weather Station Humidity"
    state_topic: "tele/cumulusmx/interval"
    value_template: '{{ value_json["humidity"] }}'
    unit_of_measurement: "%"

Re: MQTT

Posted: Mon 18 Jul 2022 5:52 am
by uncle_bob
Thanks Sadgit
Does that go in the configuration.yaml?

Re: MQTT

Posted: Mon 18 Jul 2022 6:13 am
by Sadgit
It does, but I split out all my sensors into a separate file. So this goes at the bottom of the configuration.yaml

sensor: !include sensor.yaml

Then in the same folder create a
sensor.yaml

The code I posted then goes directly into the sensor.yaml

If you know what I mean?

Re: MQTT

Posted: Mon 18 Jul 2022 6:56 am
by uncle_bob
Sadgit wrote: Mon 18 Jul 2022 6:13 am If you know what I mean?
Yip, I think I got what you mean.
I'm trying to get my weather station outside temp on my esp3266 esphome powered spa controller which is working but trying improvements.

Re: MQTT

Posted: Mon 18 Jul 2022 7:58 am
by uncle_bob
Thanks Sadgit.
You were on the money and it's now working. You also taught me yaml nesting. 2 for the price of 1 :-) Thanks again.

So in a nutshell, and for those following along at home, it appears that the MQTT discovery setting does not automagically add MQTT feeds into HomeAsistant like I thought it should. It's needs sensors manually added to a yaml file (configuation.yaml or broken out like Sadgit suggested above).
Not once did I see this in any documentation (but I may have missed this)!

Now to figure the rest of the #tags :D

Re: MQTT

Posted: Mon 18 Jul 2022 9:18 am
by Sadgit
happy to help. You can use MQTT explorer (if using windows) to see what is being sent by your mqtt server.

Cheers
Mark