roleoroleo / yi-hack_ha_integration

Home Assistant custom integration for Yi cameras: yi-hack-MStar, yi-hack-Allwinner, yi-hack-Allwinner-v2, yi-hack-v5 and sonoff-hack
GNU General Public License v3.0
205 stars 32 forks source link

MQTT entity name starts with the device name in your config #144

Closed fraserp closed 4 months ago

fraserp commented 5 months ago

I am seeing the following warning in the Home Assistant log:

Logger: homeassistant.components.mqtt.mixins
Source: components/mqtt/mixins.py:1370
Integration: MQTT (documentation, issues)
First occurred: 13:39:12 (55 occurrences)
Last logged: 14:00:17

MQTT entity name starts with the device name in your config {'availability_topic': 'yicam/status', 'payload_available': 'online', 'payload_not_available': 'offline', 'device': {'identifiers': ['yi-cam-c3a9'], 'manufacturer': 'YI', 'model': 'YI Hack', 'name': 'Yi Camera c3a9', 'sw_version': '0.4.1d', 'connections': []}, 'retain': True, 'icon': 'mdi:video', 'state_topic': 'yicam/camera_setting', 'command_topic': 'yicam/camera_setting/SWITCH_ON/set', 'name': 'Yi Camera c3a9 Switch Status', 'unique_id': 'yi-cam-c3a9-SWITCH_ON', 'value_template': Template<template=({{ value_json.SWITCH_ON }}) renders=0>, 'payload_on': 'yes', 'payload_off': 'no', 'qos': 0, 'optimistic': False, 'encoding': 'utf-8', 'availability_mode': 'latest', 'enabled_by_default': True}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Switch Status'
MQTT entity name starts with the device name in your config {'availability_topic': 'yicam/status', 'payload_available': 'online', 'payload_not_available': 'offline', 'device': {'identifiers': ['yi-cam-c3a9'], 'manufacturer': 'YI', 'model': 'YI Hack', 'name': 'Yi Camera c3a9', 'sw_version': '0.4.1d', 'connections': []}, 'retain': True, 'icon': 'mdi:music-note', 'state_topic': 'yicam/camera_setting', 'command_topic': 'yicam/camera_setting/SOUND_DETECTION/set', 'name': 'Yi Camera c3a9 Sound Detection', 'unique_id': 'yi-cam-c3a9-SOUND_DETECTION', 'value_template': Template<template=({{ value_json.SOUND_DETECTION }}) renders=0>, 'payload_on': 'yes', 'payload_off': 'no', 'qos': 0, 'optimistic': False, 'encoding': 'utf-8', 'availability_mode': 'latest', 'enabled_by_default': True}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Sound Detection'
MQTT entity name starts with the device name in your config {'availability_topic': 'yicam/status', 'payload_available': 'online', 'payload_not_available': 'offline', 'device': {'identifiers': ['yi-cam-c3a9'], 'manufacturer': 'YI', 'model': 'YI Hack', 'name': 'Yi Camera c3a9', 'sw_version': '0.4.1d', 'connections': []}, 'retain': True, 'icon': 'mdi:led-on', 'state_topic': 'yicam/camera_setting', 'command_topic': 'yicam/camera_setting/LED/set', 'name': 'Yi Camera c3a9 Status Led', 'unique_id': 'yi-cam-c3a9-LED', 'value_template': Template<template=({{ value_json.LED }}) renders=0>, 'payload_on': 'yes', 'payload_off': 'no', 'qos': 0, 'optimistic': False, 'encoding': 'utf-8', 'availability_mode': 'latest', 'enabled_by_default': True}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Status Led'
MQTT entity name starts with the device name in your config {'availability_topic': 'yicam/status', 'payload_available': 'online', 'payload_not_available': 'offline', 'device': {'identifiers': ['yi-cam-c3a9'], 'manufacturer': 'YI', 'model': 'YI Hack', 'name': 'Yi Camera c3a9', 'sw_version': '0.4.1d', 'connections': []}, 'retain': True, 'icon': 'mdi:remote', 'state_topic': 'yicam/camera_setting', 'command_topic': 'yicam/camera_setting/IR/set', 'name': 'Yi Camera c3a9 IR Led', 'unique_id': 'yi-cam-c3a9-IR', 'value_template': Template<template=({{ value_json.IR }}) renders=0>, 'payload_on': 'yes', 'payload_off': 'no', 'qos': 0, 'optimistic': False, 'encoding': 'utf-8', 'availability_mode': 'latest', 'enabled_by_default': True}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'IR Led'
MQTT entity name starts with the device name in your config {'availability_topic': 'yicam/status', 'payload_available': 'online', 'payload_not_available': 'offline', 'device': {'identifiers': ['yi-cam-c3a9'], 'manufacturer': 'YI', 'model': 'YI Hack', 'name': 'Yi Camera c3a9', 'sw_version': '0.4.1d', 'connections': []}, 'retain': True, 'icon': 'mdi:monitor', 'state_topic': 'yicam/camera_setting', 'command_topic': 'yicam/camera_setting/ROTATE/set', 'name': 'Yi Camera c3a9 Rotate', 'unique_id': 'yi-cam-c3a9-ROTATE', 'value_template': Template<template=({{ value_json.ROTATE }}) renders=0>, 'payload_on': 'yes', 'payload_off': 'no', 'qos': 0, 'optimistic': False, 'encoding': 'utf-8', 'availability_mode': 'latest', 'enabled_by_default': True}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Rotate'
roleoroleo commented 5 months ago

Which version are you using? This issue should be fixed here: https://github.com/roleoroleo/yi-hack_ha_integration/commit/6d84589ad676fa8588e984556368e0f05e0def95 https://github.com/roleoroleo/yi-hack_ha_integration/commit/e80326e5bf9e07ead9cb1d2eb0c79c2fbf3281b2

fraserp commented 5 months ago

0.4.8

roleoroleo commented 5 months ago

Checked my config. With the last HA (2024.1.5) and the last integration (0.4.8) I have no warning.

Are you sure that this warning is related to the yi-hack integration? Did you enable "Mqtt Advertise & Homeassistant MQTT Discovery" in the cam?

fraserp commented 5 months ago

I do indeed have "Mqtt Advertise & Homeassistant MQTT Discovery" enabled:

image

and I've been trying out some changes to the values so the current lod info that matches is:

Logger: homeassistant.components.mqtt.mixins
Source: components/mqtt/mixins.py:1370
Integration: MQTT (documentation, issues)
First occurred: 18:37:54 (80 occurrences)
Last logged: 19:00:11

MQTT entity name starts with the device name in your config {'availability_topic': 'yicam/status', 'payload_available': 'online', 'payload_not_available': 'offline', 'device': {'identifiers': ['cam-c3a9'], 'manufacturer': 'YI', 'model': 'YI Hack', 'name': 'Yi Outdoor Camera', 'sw_version': '0.4.1d', 'connections': []}, 'retain': True, 'icon': 'mdi:video', 'state_topic': 'yicam/camera_setting', 'command_topic': 'yicam/camera_setting/SWITCH_ON/set', 'name': 'Yi Outdoor Camera Switch Status', 'unique_id': 'cam-c3a9-SWITCH_ON', 'value_template': Template<template=({{ value_json.SWITCH_ON }}) renders=0>, 'payload_on': 'yes', 'payload_off': 'no', 'optimistic': False, 'availability_mode': 'latest', 'encoding': 'utf-8', 'qos': 0, 'enabled_by_default': True}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Switch Status'
MQTT entity name starts with the device name in your config {'availability_topic': 'yicam/status', 'payload_available': 'online', 'payload_not_available': 'offline', 'device': {'identifiers': ['cam-c3a9'], 'manufacturer': 'YI', 'model': 'YI Hack', 'name': 'Yi Outdoor Camera', 'sw_version': '0.4.1d', 'connections': []}, 'retain': True, 'icon': 'mdi:music-note', 'state_topic': 'yicam/camera_setting', 'command_topic': 'yicam/camera_setting/SOUND_DETECTION/set', 'name': 'Yi Outdoor Camera Sound Detection', 'unique_id': 'cam-c3a9-SOUND_DETECTION', 'value_template': Template<template=({{ value_json.SOUND_DETECTION }}) renders=0>, 'payload_on': 'yes', 'payload_off': 'no', 'optimistic': False, 'availability_mode': 'latest', 'encoding': 'utf-8', 'qos': 0, 'enabled_by_default': True}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Sound Detection'
MQTT entity name starts with the device name in your config {'availability_topic': 'yicam/status', 'payload_available': 'online', 'payload_not_available': 'offline', 'device': {'identifiers': ['cam-c3a9'], 'manufacturer': 'YI', 'model': 'YI Hack', 'name': 'Yi Outdoor Camera', 'sw_version': '0.4.1d', 'connections': []}, 'retain': True, 'icon': 'mdi:led-on', 'state_topic': 'yicam/camera_setting', 'command_topic': 'yicam/camera_setting/LED/set', 'name': 'Yi Outdoor Camera Status Led', 'unique_id': 'cam-c3a9-LED', 'value_template': Template<template=({{ value_json.LED }}) renders=0>, 'payload_on': 'yes', 'payload_off': 'no', 'optimistic': False, 'availability_mode': 'latest', 'encoding': 'utf-8', 'qos': 0, 'enabled_by_default': True}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Status Led'
MQTT entity name starts with the device name in your config {'availability_topic': 'yicam/status', 'payload_available': 'online', 'payload_not_available': 'offline', 'device': {'identifiers': ['cam-c3a9'], 'manufacturer': 'YI', 'model': 'YI Hack', 'name': 'Yi Outdoor Camera', 'sw_version': '0.4.1d', 'connections': []}, 'retain': True, 'icon': 'mdi:remote', 'state_topic': 'yicam/camera_setting', 'command_topic': 'yicam/camera_setting/IR/set', 'name': 'Yi Outdoor Camera IR Led', 'unique_id': 'cam-c3a9-IR', 'value_template': Template<template=({{ value_json.IR }}) renders=0>, 'payload_on': 'yes', 'payload_off': 'no', 'optimistic': False, 'availability_mode': 'latest', 'encoding': 'utf-8', 'qos': 0, 'enabled_by_default': True}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'IR Led'
MQTT entity name starts with the device name in your config {'availability_topic': 'yicam/status', 'payload_available': 'online', 'payload_not_available': 'offline', 'device': {'identifiers': ['cam-c3a9'], 'manufacturer': 'YI', 'model': 'YI Hack', 'name': 'Yi Outdoor Camera', 'sw_version': '0.4.1d', 'connections': []}, 'retain': True, 'icon': 'mdi:monitor', 'state_topic': 'yicam/camera_setting', 'command_topic': 'yicam/camera_setting/ROTATE/set', 'name': 'Yi Outdoor Camera Rotate', 'unique_id': 'cam-c3a9-ROTATE', 'value_template': Template<template=({{ value_json.ROTATE }}) renders=0>, 'payload_on': 'yes', 'payload_off': 'no', 'optimistic': False, 'availability_mode': 'latest', 'encoding': 'utf-8', 'qos': 0, 'enabled_by_default': True}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Rotate'
fraserp commented 5 months ago

Happy to provide any other diagnostic data

roleoroleo commented 5 months ago

If you use this integration, you don't need to enable "Mqtt Advertise & Homeassistant MQTT Discovery". Disable it and check if the warning disappears.

fraserp commented 5 months ago

Disabled, saved, clear logs and restarted camera and HA - still seeing the error.

The other MQTT optios are also enabled on that y-hack sub-page:

Assuming these are all fine? Any other settings I should be concerned with?

roleoroleo commented 5 months ago

Please, try to disable all MQTT features in "Mqtt Advertise & Homeassistant MQTT Discovery" page. I need to understand if the problem is related to this feature or to to the integration.

fraserp commented 5 months ago

That appears to have solved it. Now not seeing the warning for my yi-cam. So it is indeed caused by one/multiple of the MQTT advertise options.

Interestingly it says 'name': 'Yi Outdoor Camera' in the warning too, but the only place that exists is in the HA announce, which I disabled as you requested - but it was still erroring at that point as as an experiment I changed that value to "'name': 'Yi Outdoor Camer4'" and the error still said 'name': 'Yi Outdoor Camera' - so I presume its reading this value from the internal data and not one of the fields I can edit?

roleoroleo commented 5 months ago

That appears to have solved it. Now not seeing the warning for my yi-cam. So it is indeed caused by one/multiple of the MQTT advertise options.

There is already a pr related to this problem: https://github.com/alienatedsec/yi-hack-v5/pull/327/files Maybe you could try to edit the files manually and check if the warning disappears.

so I presume its reading this value from the internal data

Probably yes.

fraserp commented 5 months ago

I've created a custom build on the yi-hack-v5 firmware, but can't get it to the device remotely so need to climb a ladder and manually get it onto the SD card... which I don't have time to do at present. (I have also created a feature request for a remote way to do this via the interface). There is also a bug in the firmware updater at present too. So I will try a manual update in the near future when I get time, bear with...

fraserp commented 4 months ago

Seemed to be fixed by yi-hack-v5

Closing