If you want to debug this.....
- At the top level, [MQTTPublish], set retain = False. This turns retain 
off for the publication of the WeeWX data (HA sensor state)
- Make sure this is not overridden for any topic. Sections [MQTTPubish] 
[topics]["name of your topic(s)"]

- For the HA plugin section, [MQTTPublish] [[Plugins]] 
[[[MQTTHomeAssistantConfig]]] [[[[devices]]]] [[[[["id of your 
device"]]]]], set retain = False. This turns retain off for the publication 
of the device discovery/configuration data.


Assuming default values for 'discovery_topic_prefix', subscribe to the 
topic 'homeassistant/#'.
Subscribe to the "name of your topic".
Restart WeeWX

You should see some json being published here. This is the device 
discovery/configuration data. I would guess you would see message almost 
immediate, for your wind data. And about 3 minutes later, another message 
for your other data.
You should also see the data being published to "name of your topic".

Watch HA. 
After the publication of you wind data, you should see this in HA with all 
other data "not available". 
After the publication of your other data, you should see this in HA with 
the wind data "not available",

OR
make changes to the config as noted above and change the 'type' of data 
being published to "name of your topic(s)" to 'individual'.
subscribe to the topics noted above
restart WeeWX.
Again, you should see the json for the device discovery/configuration data.
You should see the data being published to "name of your topic"/#.

In HA, the data for each sensor should populate as it is published.

OR
publish the wind data to one topic and the other data to a second topic. In 
this case they both can be json. This is a bit more complicated to set up 
in MQTTPublish. If interested I can work more detailed steps.

Curious minds want to know. When using Matthew’s extension, were you using 
json or individual topics for the sensor data? What were you using to 
configure HA?

My usual advice to people is; if Matthew’s extension works for you, use it. 
It is the OG of publishing to MQTT and has proven over the years to be very 
reliable. Only if it doesn’t meet your needs move to MQTTPublish.
rich

On Wednesday, 15 July 2026 at 08:20:12 UTC-4 Rob M wrote:

> I was using matthewall's MQTT with my old weewx instance and I think 
> you're right I didn't have these problems, it just worked.  It just begs 
> the question, why would the retain flag matter at all like you say.  The 
> one thing you mentioned that I have never set with either MQTT publish 
> extensions is the expire_after.  Could it be without retain that the data 
> is expiring immediately for some reason?
>
> On Sun, Jul 12, 2026 at 6:19 PM Greg Troxel <[email protected]> wrote:
>
>> "[email protected]" <[email protected]> writes:
>>
>> > I realized that without the retain, the HA plugin had nothing to work 
>> with 
>> > because the timing on my weather data is so different depending on what 
>> it 
>> > is, my wind data is every 5 seconds and my archive period is 3 minutes 
>> so 
>> > all my other raw data from my weather station posts every 3 minutes as 
>> > well.
>>
>> This doesn't make sense to me.  Without retain, when weewx is connected
>> to the broker, and HA is connected (the normal case, should be true
>> almost always), then MQTT posts from weewx arrive at HA.  If you are
>> sending data every three minutes (because your archive interval is 3
>> minutes and you are sending archive data), then within 3 minutes of
>> starting HA the data should populate, and you should probably pick 180s
>> or 390s for expire_after.  If this doesn't work without retain, then
>> something is very broken and we should figure it out, not tell people to
>> set something which is semantically troubled.
>>
>> I have retain=False using [email protected]:matthewwall/weewx-mqtt.git and
>> my weather data in HA is stable, but goes to unavailable when my weewx
>> computer stops transmitting.
>>
>> > Because everything is so out of sync I have to use retain or it will 
>> > never get anything to work with.
>>
>> This doesn't make sense to me either.   There is no need for
>> synchronization of various entities, as long as they are all valid.
>>
>> > Also as far as the LWT, I just AI'd it and it suggested that HA enjoys
>> > having that set.
>>
>> That is incorrect; HA is not a person and does not enjoy anything!  The
>> point of the LWT, as I said earlier, is to post offline to the online
>> topic on client disconnect, so that the posting of online at connection
>> is withdrawn and the availability topic has the right semantics.  You
>> should look at the json config that MQTTPublish uses, or your own
>> config, to see if that is correct -- and see the page I referenced
>> previously.
>>
>> > I did set up MQTTPublish and the HA plugin with json because I had no
>> > reason to break out the topic individually.
>>
>> What "HA plugin"?  HA has "integrations", and something (formerly called
>> "add-ons") called "apps".  The MQTT integration is built in.
>>
>> > My raw data from my weather station on the other had posts
>> > individually.
>>
>> What do you mean "raw", and how is that happening -- if you aren't using
>> MQTTPublish?
>>
>>
>> Sending json is nice because there's one MQTT message posted.  If you
>> are sending archive data every 3 minutes (I do, but every 5), then
>> there's one message, with everything, logically consistent in time.
>>
>> With loop, whether things are in json or not, they aren't quite
>> consistent because data arrives to weewx at different times.  As long as
>> the delays are small (sub 30s?), it's not a big deal.
>>
>> If you have wind every 5s, then putting everything in json might lead to
>> a full json every 5s, retransmitting previous values for other things,
>> and ingesting them into HA again.    It would be better in my view to
>> split out wind to not be in json (or to be in a separate higher-rate
>> json) to avoid transmitting data that isn't really data.
>>
>>
>> Overall it sounds like you have found a configuration by guessing at
>> settings but that it isn't really grounded in a plan of how things
>> should be.  I encourage you to examine what is being sent on MQTT and to
>> read the HA entity configuration, in yaml if you did it yourself, or to
>> read the autoconfig json if you're doing it that way.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/weewx-user/859252d6-91b2-46fc-ad99-29405fdcb28bn%40googlegroups.com.

Reply via email to