sleevezipper / hass-workstation-service

Provide useful sensors and services from your workstation to Home Assistant.
Apache License 2.0
613 stars 54 forks source link

Received message on illegal discovery topic #96

Open iankaufmann opened 3 years ago

iankaufmann commented 3 years ago

I have been running Home Assistant OS and the official MQTT addon for a while now and without Auto-Discovery. I always liked to define my own entities in the past, and had no trouble getting HASS Workstation Service working with manually defined entities.

However, I've recently turned on Auto-Discovery on the MQTT broker (for use with another integration), and ever since, my logs have been filled with thousands of warnings like this:

Received message on illegal discovery topic 'homeassistant/sensor/WORKSTATION/Session State/config' Received message on illegal discovery topic 'homeassistant/sensor/WORKSTATION/CPU Usage/config' Received message on illegal discovery topic 'homeassistant/sensor/WORKSTATION/Last Active/config' Received message on illegal discovery topic 'homeassistant/sensor/WORKSTATION/RAM Usage/config' Received message on illegal discovery topic 'homeassistant/sensor/WORKSTATION/Current User/config'

Could also be what is going on here: https://github.com/sleevezipper/hass-workstation-service/issues/95

I'm not sure what the MQTT integration isn't liking about the format of these discovery topics: https://github.com/home-assistant/core/blob/a5eb2ac7b77e8c0df541cad0bb461585932325df/homeassistant/components/mqtt/discovery.py#L102

sleevezipper commented 3 years ago

Thanks for creating an issue. I think it may be because there's spaces in your sensor names. This was an issue in an older version but it should be fixed at this point. What version are you running?

iankaufmann commented 3 years ago

Thanks for getting back to me!

Looks like I am on the latest build: hass-workstation-service-1.0.0.40823

If a quick and easy fix is to just add underscores to all of the sensor names, then I could just do that. I know that spaces are discouraged in MQTT but it does work, unless there is something different about /config topics specifically?

Like I said, I have all of these sensors defined manually, and they all work fine.

I only noticed this when enabling autodiscovery.

cogneato commented 3 years ago

I am getting this in my logs too. I have deleted the sensors, yet these still appear? Is there somewhere else I need to remove something?

2021-08-17 07:52:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Received message on illegal discovery topic 'homeassistant/sensor/DESKTOP-Q3VHR9S/Last Active/config'
2021-08-17 07:52:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Received message on illegal discovery topic 'homeassistant/sensor/DESKTOP-Q3VHR9S/Desktop Memory/config'
2021-08-17 07:52:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Received message on illegal discovery topic 'homeassistant/sensor/DESKTOP-Q3VHR9S/Desktop CPU/config'
cogneato commented 3 years ago

After finding the error present even when hass workstation was not active, I cleared the mosquitto.db and am no longer seeing these messages. 👍

raidnet-ms commented 2 years ago

After finding the error present even when hass workstation was not active, I cleared the mosquitto.db and am no longer seeing these messages. 👍

Hi, how did you manage to clear the db?

ewelin34 commented 2 years ago

I just had this issue as well, for those who are reading through it and not totally sure how to clear the mosquitto.db. Grab a copy of mqtt explorer: https://mqtt-explorer.com/ Since I had deleted these sensors long ago, I just went in and deleted the topics in question.