Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT discovery of custom entity doesn't consider type of data #1587

Closed
SSSlee opened this issue Jan 28, 2024 · 5 comments
Closed

MQTT discovery of custom entity doesn't consider type of data #1587

SSSlee opened this issue Jan 28, 2024 · 5 comments
Labels
bug Something isn't working enhancement New feature or request
Milestone

Comments

@SSSlee
Copy link

SSSlee commented Jan 28, 2024

The datatype of a customized entity isn't mentioned in the belonging MQTT Discovery:

image

Corresponding MQTT discovery:

{
"stat_t": "ems-esp/custom_data",
"val_tpl": "{{value_json['RFM200'] if value_json['RFM200'] is defined}}",
"obj_id": "custom_RFM200",
"uniq_id": "custom_RFM200",
"name": "RFM200",
"dev": {
"name": "ems-esp Custom",
"mf": "EMS-ESP",
"mdl": "Custom",
"via_device": "ems-esp",
"ids": [
"ems-esp-custom"
]
}
"avty": [
{
"t": "ems-esp/status",
"val_tpl": "{{'online' if value == 'online' else 'offline'}}"
},
{
"t": "ems-esp/custom_data",
"val_tpl": "{{'online' if value_json['RFM200'] is defined else 'offline'}}"
}
],
"avty_mode": "all"
}`

Discovery for a temperature datatype (in comparsion):

{
"uniq_id": "thermostat_dampedoutdoortemp",
"obj_id": "thermostat_dampedoutdoortemp",
"stat_t": "ems-esp/thermostat_data",
"name": "Damped outdoor temperature",
"unit_of_meas": "°C",
"val_tpl": "{{value_json.dampedoutdoortemp if value_json.dampedoutdoortemp is defined else 0}}",
"stat_cla": "measurement",
"dev_cla": "temperature",

"dev": {
"ids": [
"ems-esp-thermostat"
],
"name": "ems-esp Thermostat"
},
"avty": [
{
"t": "ems-esp/status",
"val_tpl": "{{'online' if value == 'online' else 'offline'}}"
},
{
"t": "ems-esp/thermostat_data",
"val_tpl": "{{'online' if value_json.dampedoutdoortemp is defined else 'offline'}}"
}
],
"avty_mode": "all"
}

@proddy
Copy link
Contributor

proddy commented Jan 28, 2024

looks like we need to add both "unit_of_meas" and the "stat_cla"

@proddy proddy added the bug Something isn't working label Jan 28, 2024
@proddy proddy added this to the v3.6.5 milestone Jan 28, 2024
@proddy proddy added the enhancement New feature or request label Jan 28, 2024
@proddy
Copy link
Contributor

proddy commented Feb 3, 2024

@SSSlee if you add those two manually to the discovery topic (using MQTT Explorer) does it fix your issue? Worth trying before I change the EMS-ESP code and unintentionally break something else.

@proddy
Copy link
Contributor

proddy commented Feb 10, 2024

fixed in dev13

@mattblonski
Copy link

Hi,
Noticed in v. 3.6.5 MQTT discovery of external temperature sensor for HA is missing "stat_cla" attribute. So this entity is not recored, nor cannot be added to any statistics card.
image
I added the attribute manually via MQTT Explorer and HA starts recording it.
image

@proddy
Copy link
Contributor

proddy commented Apr 24, 2024

thanks, created new bug for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants