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 device name is equal to entity name in your config for switch as light device. #18896

Closed
jeroen85 opened this issue Sep 7, 2023 · 3 comments
Labels
problem Something isn't working

Comments

@jeroen85
Copy link

jeroen85 commented Sep 7, 2023

What happened?

I still experience the MQTT device vs entity name warning with the latest HA (2023.9.0) and Z2M (1.33.0) versions. It only occurs with one device. A smart plug I have set up as light in Z2M.

HA Warning in logs.

2023-09-07 14:48:34.763 WARNING (MainThread) [homeassistant.components.mqtt.mixins] MQTT device name is equal to entity name in your config {'availability': [{'topic': 'zigbee2mqtt/bridge/state', 'value_template': Template<template=({{ value_json.state }}) renders=0>, 'payload_available': 'online', 'payload_not_available': 'offline'}, {'topic': 'zigbee2mqtt/Kastlicht/availability', 'value_template': Template<template=({{ value_json.state }}) renders=0>, 'payload_available': 'online', 'payload_not_available': 'offline'}], 'availability_mode': 'all', 'command_topic': 'zigbee2mqtt/Kastlicht/set', 'device': {'identifiers': ['zigbee2mqtt_0x540f57fffe91ffb6'], 'manufacturer': 'TuYa', 'model': 'Smart plug (with power monitoring by polling) (TS011F_plug_3)', 'name': 'Kastlicht', 'connections': []}, 'name': 'Kastlicht', 'object_id': 'kastlicht', 'origin': {'name': 'Zigbee2MQTT', 'sw_version': '1.33.0', 'support_url': 'https://www.zigbee2mqtt.io'}, 'payload_off': 'OFF', 'payload_on': 'ON', 'state_topic': 'zigbee2mqtt/Kastlicht', 'state_value_template': Template<template=({{ value_json.state }}) renders=0>, 'unique_id': '0x540f57fffe91ffb6_light_zigbee2mqtt', 'schema': 'basic', 'payload_available': 'online', 'optimistic': False, 'on_command_type': 'last', 'white_scale': 255, 'payload_not_available': 'offline', 'enabled_by_default': True, 'brightness_scale': 255, 'encoding': 'utf-8', 'qos': 0, 'retain': False}, this is not expected. Please correct your configuration. The entity name will be set to `null`

Config in Z2M for specific device
Conform docs

  '0x540f57fffe91ffb6':
    friendly_name: Kastlicht
    measurement_poll_interval: 30
    homeassistant:
      switch:
        type: light
        object_id: light
      light:
        name: Kastlicht
        value_template: null
        state_value_template: '{{ value_json.state }}'

MQTT info within HA

Kastlicht (light.kastlicht)
MQTT discovery data:
Topic: homeassistant/light/0x540f57fffe91ffb6/light/config
Payload
availability:
  - topic: zigbee2mqtt/bridge/state
    value_template: '{{ value_json.state }}'
  - topic: zigbee2mqtt/Kastlicht/availability
    value_template: '{{ value_json.state }}'
availability_mode: all
command_topic: zigbee2mqtt/Kastlicht/set
device:
  identifiers:
    - zigbee2mqtt_0x540f57fffe91ffb6
  manufacturer: TuYa
  model: Smart plug (with power monitoring by polling) (TS011F_plug_3)
  name: Kastlicht
name: Kastlicht
object_id: kastlicht
origin:
  name: Zigbee2MQTT
  sw_version: 1.33.0
  support_url: https://www.zigbee2mqtt.io
payload_off: 'OFF'
payload_on: 'ON'
state_topic: zigbee2mqtt/Kastlicht
state_value_template: '{{ value_json.state }}'
unique_id: 0x540f57fffe91ffb6_light_zigbee2mqtt
platform: mqtt

What did you expect to happen?

No warning after this fix f619610

How to reproduce it (minimal and precise)

No response

Zigbee2MQTT version

1.33.0

Adapter firmware version

Not relevant

Adapter

Not relevant

Debug log

No response

@jeroen85 jeroen85 added the problem Something isn't working label Sep 7, 2023
@jeroen85 jeroen85 changed the title 'MQTT device name is equal to entity name in your config' for switch as light device. MQTT device name is equal to entity name in your config for switch as light device. Sep 7, 2023
@jeroen85
Copy link
Author

jeroen85 commented Sep 7, 2023

Relates to #18445

@Drafteed
Copy link
Contributor

Drafteed commented Sep 7, 2023

Replace light name to null:

  '0x540f57fffe91ffb6':
    friendly_name: Kastlicht
    measurement_poll_interval: 30
    homeassistant:
      switch:
        type: light
        object_id: light
      light:
        name: null
        value_template: null
        state_value_template: '{{ value_json.state }}'

@jeroen85
Copy link
Author

jeroen85 commented Sep 7, 2023

Thanks, that fixed it!

@jeroen85 jeroen85 closed this as completed Sep 7, 2023
Koenkk pushed a commit to Koenkk/zigbee2mqtt.io that referenced this issue Sep 7, 2023
Update docs for switch as light configuration to prevent warning in HA.
Related to Koenkk/zigbee2mqtt#18896
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants