roleoroleo / sonoff-hack

Custom firmware for Sonoff GK-200MP2B camera
GNU General Public License v3.0
203 stars 48 forks source link

Discovered entities with a name that starts with the device name #152

Closed DeadlySin2 closed 6 months ago

DeadlySin2 commented 1 year ago

After the update to 2023.8.0 i get a warning:

Some MQTT entities have an entity name that starts with the device name. This is not expected. To avoid a duplicate name the device name prefix is stripped of the entity name as a work-a-round. Please inform the maintainer of the software application that supplies the affected entities to fix this issue.

List of affected entities:

switch.livingroom_cam_motion_detection select.livingroom_cam_sensitivity select.livingroom_cam_ir binary_sensor.livingroom_cam_motion camera.livingroom_cam_image switch.livingroom_cam_switch_on switch.livingroom_cam_local_record switch.livingroom_cam_rotate

Will it be fixed in later releases?

darkxst commented 1 year ago

Its probably a bug, I don't think device name should in the entity names already.

can you "download diagnostics" from the mqtt device page for your camera and attach to this issue.

DeadlySin2 commented 1 year ago

config_entry-mqtt-467bbd8aaf33487b44d85ab0925677cb.json.txt I have attached it to this post. It is not a bug - everything works fine. This is just a warning that it will causse a problem in version 2024.2.0

darkxst commented 1 year ago

i meant a bug in the generated discovery messages.

As a workaround you can probably delete the HA Discovery "Name" prefix setting on the mqtt page in sonoff hack.

roleoroleo commented 1 year ago

The workaround should work. Probably the final fix is in mqtt-sonoff.c:

    if (mqtt_sonoff_conf.ha_name_prefix) {
        sprintf(dname, "%s %s", mqtt_sonoff_conf.ha_name_prefix, *suffix);
    } else {
        strcpy(dname, *suffix);
    }

Remove the 1st sprintf.

darkxst commented 1 year ago

Remove the 1st sprintf.

Yes, that looks the correct fix to me

github-actions[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.