Closed zibous closed 1 year ago
I think this is #596. But the commit only addresses ems entities, dallas/analog follows the old scheme.
As far as i understand (i'm not using ha) the config is now generated as homeassistant/sensor/hostname/entity/config
with "~":base, "stat_t":"~/device_data"
and entities are published in base/device_data
.
What exactly is not working?
What exactly is not working?
Previous Version - shows devices:
Install version EMS-ESP-3_5_0b2
Result:
EMS-ESP-3_5_0b2 - No EMS-ESP Devices found
Switch back to Firmware: v3.4.2b5 All devices are present and working.
I'm back behind a PC now and have reproduced this. If you use a FQDN as the hostname it doesn't work. Thomas was also complaining on Discord about this. The best solution is to create a new option in the MQTT Settings called 'prefix' or something which we'll use as prefix instead of base or hostname. https://www.home-assistant.io/docs/mqtt/discovery/#discovery-topic
Could we keep it mostly compatible to v3.4.2 and use the base for discover node-id, but replace possible slashes by underscore. e.g base emsesp
keeps as is, but base: home/esp/emsesp
as in #596 is set as homeassistant/sensor/home_ems_emsesp/name/config
. Most users have a single base, so there is no change.
Maybe this could also used as prefix for entities. Is this prefix realy needed?
@proddy
The best solution is to create a new option in the MQTT Settings called 'prefix' or something which we'll use as prefix instead of base or hostname. https://www.home-assistant.io/docs/mqtt/discovery/#discovery-topic
I can not find the prefix
for the MQTT Settings, only discovery_prefix string (Optional, default: homeassistant)
, which I cannot change, because otherwise all other devices will no longer work.
EMS-ESP will create retained MQTT messages prefixed with homeassistant/ for each device
and their values (called entities). For example "EMS-ESP Thermostat".
You can view which ones have been created by going into Home Assistant's
Configuration->Integrations and select the devices under MQTT.
@zibous : This is a prefix proddy added to object_id
to make it more unique. see here
Could we keep it mostly compatible to v3.4.2 and use the base for discover node-id, but replace possible slashes by underscore. e.g base
emsesp
keeps as is, but base:home/esp/emsesp
as in #596 is set ashomeassistant/sensor/home_ems_emsesp/name/config
. Most users have a single base, so there is no change. Maybe this could also used as prefix for entities. Is this prefix realy needed?
that would work. Replace . with _ using the base. Shall I make the change?
As you like. I've already started a test, so it's half way implemented here. But i can't test with HA.
This is how it looks like with base ems/esp
Mainly in load_settings set:
// create basename from base
mqtt_basename_ = mqtt_base_;
std::replace(mqtt_basename_.begin(), mqtt_basename_.end(), '/', '_');
and use mqtt_basename_
instead of system_hostname_
everywhere.
looks good. I can test it from your repo. I have a project setup in VSC that pulls from your dev
Ok, just added analog/dallas, now compiling, will push in a few minutes to my repo.
@proddy
I think the problem is:
: The ID of the device. This is only to allow for separate topics for each device and is not used for the entity_id. The ID of the device must only consist of characters from the character class [a-zA-Z0-9_-] (alphanumerics, underscore and hyphen).
{
"~": "ems-heizung",
"uniq_id": "system_ntp_status",
"stat_t": "~/heartbeat",
"name": "NTP status",
"object_id": "ems-heizung.siebler.home_system_NTP status",
"val_tpl": "{{value_json.ntp_status}}",
"payload_on": "on",
"payload_off": "off",
"state_class": "measurement",
"dev": { "ids": ["ems-esp"] }
}
"object_id": "ems-heizung.siebler.home_system_NTP status"
I my case the object_id is not valid. Why not slugify the object_id value ems-heizungsieblerhomesystemntp-status
?
HA documentation and namings are also confusing to me. There is a object_id in the discovery topic with naming restrictions and this is not the entity. And there is an object_id in payload, this is entity and allows whitespace, etc.
Now we have the topic-node id as a single word base, topic-object_id as device_shortname
as before and payload object_id without prefix as device_EN-name
(as in v3.4). Have you tried the new dev?
@zibous try the latest dev. Michael has fixed this. The object_id and names are no longer prefixed
HA documentation and namings are also confusing to me. Yes me too...
Have you tried the new dev? sorry now testing Firmware: v3.5.0b3 and it works.
Thanks.
great. closing. do re-open if you find an issue
Bug description Version v3.4.2b5 is working.
After installing the new version, wrong topic entries are made at HA Discovery. Some are correct but most are created under the
hostname of the device
and the i can`nt see any EMS ESP Devices.
Steps to reproduce
Screenshots
Device information emsesp_info.txt