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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MQTT entity name starts with the device name in your config

fraserp opened this issue · comments

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'

Which version are you using?
This issue should be fixed here:
6d84589
e80326e

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?

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'

Happy to provide any other diagnostic data

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

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:

  • MQTT Information Advertise
  • MQTT Link Advertise
  • MQTT Camera Settings Advertise
  • MQTT Telemetry Advertise

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

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.

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?

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.

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...

Seemed to be fixed by yi-hack-v5

Closing