Sensors not updating MQTT server at appropriate frequency
Hello,
I've recently migrated to the fork due to lots of errors clogging up the HA log. The fork has resolved those issues, but I've got one new annoying problem. My sensors are not updating at the defined frequency; worse, they're seemingly updating at a random frequency.
Looking at my MQTT server with MQTT Explorer, I see that the Agent is online, and updating that it is online every 30 seconds, reliably. The primary sensor in question is a "monitorpowerstate" that runs on the agent and should update every 3 seconds. If this was just a case where updates are only sent when status changes, that'd be fine, but it doesn't seem to be that way. Updates are still a seemingly random time period after actual status change.
Looking at the topic in MQTT Explorer, I see update frequencies ranging from 30 minutes to 1 second
Steps I have taken so far: I have restarted my PC running HASS Agent. I have restarted HomeAssistant. I have restarted my MQTT server. I have deleted and recreated the sensor.
Any suggestions on next steps would be appreciated.
9 Replies
Help us Help Others!
To help others find answers, you can mark your question as solved via
Right click solution message -> Apps -> ✅ Mark Solution

Help us Help You!
Please don't delete messages or posts because it makes it impossible to understand what happened. If you don't want your messages to be seen then don't post here.
Please provide us with the version number of your app.
You can find it by clicking the ? at the bottom of the main page and checking under the logo that shows.We will help as soon as possible. While you're waiting you can try the following:
- Checkout the documentation. - Search here in discord for previously solved similar issues.
@Amadeo
@DrR0x
correct-apricotOP•2mo ago
I forgot to mention in the post what version I'm running. It is version 2.1.1 of the HASS.Agent_Team's fork.
Additional info: some experimenting seems to show this is only occurring with the "monitorpowerstate" sensor. Other sensors that I create update appropriately. Similarly, the media player topic is updating reliably once every 2 seconds. Changing the update frequency of my sensor to something slower (15s is what I used) doesn't change the symptoms. Not sure where to go from here, but seems like maybe an issue with actually retrieving monitor power status?
exotic-emerald•2mo ago
After last HA Core update my MQTT stop working too

correct-apricotOP•2mo ago
Just to clarify my issue, it is not a loss of connection to the MQTT server (from what I can tell). The connection is always OK/running, it just doesn't send certain sensor updates when it should.
I'll need to try to replicate that, what other sensors/commands do you have configured?
in terms of numbers
correct-apricotOP•4w ago
Thanks for the response. In terms of sensors, I've currently only got two sensors running. One that is the "MonitorPowerState" in question and a second being a test sensor (CPULoad updating every 10 seconds). I have 1 command and 1 quick action set up.
Just for additional information, it seems as though I was incorrect about it being "random", but rather that it is only sending the sensor update when the monitor power changes state. However, it's not really the monitor's power state as when I manually turn off the monitor, no update occurs (which is how I was trying to test initially). It will update when the display is turned off by the OS due to system idling. I haven't been able to confirm that it sends an update within the sensor update frequency on a power off, but it seems to do so when power turns on.
Given what I've learned since initially reporting, I'm not sure if this is an issue with the HASSagent or if it's a problem with my monitor not reporting appropriately to the OS it's power status. Frankly, it's not a big deal to me now that I know it's working as I wanted (as an indicator that the system is idle, regardless of active user), though not exactly how I expected it to work.
great
looks like the monitors connected as displayport are not properly detected when manually turned off