bieniu / ha-shellies-discovery

Script that adds MQTT discovery support for Shellies devices
Apache License 2.0
290 stars 90 forks source link

error: The device name prefix will be stripped... #514

Closed 1mfaasj closed 9 months ago

1mfaasj commented 9 months ago

Describe the bug I get this error many times with a couple of shelly devices. Is this something I can fix?

Versions:

Shellies Discovery automation:

part 1

alias: shelly discovery gen2 part 1
trigger:
  - platform: homeassistant
    event: start
  - platform: time_pattern
    hours: /1
action:
  - repeat:
      for_each: "{{ device_ids }}"
      sequence:
        - service: mqtt.publish
          data:
            topic: "{{ repeat.item }}/rpc"
            payload: "{{ device_info_payload }}"
variables:
  device_info_payload: >-
    {{ {'id': 1, 'src':'shellies_discovery', 'method':'Shelly.GetConfig'} |
    to_json }}
  device_ids:
    - ShellyKeukenLampKnop

part 2:

alias: shelly discovery gen2 part 2
description: ""
trigger:
  - platform: mqtt
    topic: shellies_discovery/rpc
action:
  - service: python_script.shellies_discovery_gen2
    data:
      id: "{{ trigger.payload_json.src }}"
      device_config: "{{ trigger.payload_json.result }}"
  - service: mqtt.publish
    data:
      topic: "{{ trigger.payload_json.result.mqtt.topic_prefix }}/command"
      payload: status_update
mode: queued
max: 999

About the device: image

Debug log:

MQTT entity name starts with the device name in your config {'name': 'ShellyKeukenLampKnop Overtemperature', 'value_template': Template<template=({%if "overtemp" in value_json.get("errors",[])%}ON{%else%}OFF{%endif%}) renders=0>, 'enabled_by_default': True, 'unique_id': 'shellyplus1pm-0cdc7ef64af0-0-overtemp', 'qos': 0, 'device': {'connections': [['mac', '0C:DC:7E:F6:4A:F0']], 'name': 'ShellyKeukenLampKnop', 'model': 'Shelly Plus 1PM', 'sw_version': '20231031-152218/1.0.7-g5db02bd', 'hw_version': 'gen2 (SNSW-001P16EU)', 'manufacturer': 'Allterco Robotics', 'configuration_url': 'http://shellyplus1pm-0cdc7ef64af0.local/', 'identifiers': []}, 'origin': {'name': 'Shellies Discovery Gen2', 'sw_version': '2.22.0', 'support_url': 'https://github.com/bieniu/ha-shellies-discovery-gen2'}, 'availability': [{'topic': 'ShellyKeukenLampKnop/online', 'payload_available': 'true', 'payload_not_available': 'false'}, {'topic': 'ShellyKeukenLampKnop/status/rpc', 'value_template': Template<template=({%if value_json.mqtt.connected%}online{%else%}offline{%endif%}) renders=0>, 'payload_not_available': 'offline', 'payload_available': 'online'}], 'state_topic': 'ShellyKeukenLampKnop/status/switch:0', 'device_class': <BinarySensorDeviceClass.PROBLEM: 'problem'>, 'entity_category': <EntityCategory.DIAGNOSTIC: 'diagnostic'>, 'payload_off': 'OFF', 'payload_not_available': 'offline', 'encoding': 'utf-8', 'availability_mode': 'latest', 'force_update': False, 'payload_available': 'online', 'payload_on': 'ON'}, this is not expected. Please correct your configuration. The device name prefix will be stripped off the entity name and becomes 'Overtemperature'
bieniu commented 9 months ago

This is not a debug log, it's not even part of the log.

obraz

Please provide the entire log file.

bieniu commented 9 months ago

Your issue is related to the gen2 Shelly device (Shelly Plus 1PM), wrong repository.