bieniu/ha-shellies-discovery-gen2

Some entities unavailable through MQTT for Gen2 devices

Closed this issue · 2 comments

Describe the bug

Reporting a bug where some MQTT entities that are created shows unknown status, for different Shelly Gen2 models, according to the follow description:

Shelly Plus 1PM Mini

Controls - All OK
Sensors - All OK
Events - All Unknown (but also happening for Shelly integration)
Configuration - All Unknown - Firmware, Beta Firmware, Reboot
Diagnostics - Unknown - Cloud, Wifi IP, RSSI, SSID, Uptime/Last Restart. The remaining MQTT entities are OK

Shelly Plus 2PM

Controls - All OK
Sensors - All OK
Events - All OK
Configuration - Unknown - Firmware, Beta Firmware, Reboot.
Diagnostics - Unknown - Cloud, Wifi IP, RSSI, SSID, Uptime/Last Restart. The remaining MQTT entities are OK

Shelly Pro 1PM

Controls - All OK
Sensors - All OK
Events - No Events for device
Configuration - Unknown - Firmware, Beta Firmware, Reboot
Diagnostics - Unknown - Cloud, Ethernet IP, WiFi IP, RSSI, SSID, Uptime/Last Restart. The remaining MQTT entities are OK

Shelly Pro 3EM

Sensors - All OK
Configuration - Unknown - Firmware, Beta Firmware, Reboot
Diagnostics - Unknown - Cloud, Ethernet IP, WiFi IP, RSSI, SSID, Temperature, Uptime/Last Reboot. No MQTT entity is working for this class

Shelly Plus PM Mini

Sensors - All OK
Configuration - Unknown - Firmware, Beta Firmware, Reboot
Diagnostics - Unknown - Cloud, WiFi IP, RSSI, SSID, Uptime/Last Restart. No MQTT entity is working for this class

The description above is consistent with the observer behavior for each device for each model installed

Expected behavior

Would expect that all described entities would appear with values, like it happens with Gen1 devices, and no MQTT entities should appear with Unknown status

Versions:

  • Home Assistant: 2024.1.5
  • Shellies Discovery GEN2: 2.26.0
  • Shelly device firmware: 1.10

Shellies Discovery GEN2 automation:

  alias: Shellies Discovery Gen2
  mode: queued
  max: 999
  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

Shelly device MQTT settings:

image

Debug log:

home-assistant_2024-01-25T22-33-57.523Z.log

bieniu commented

Event entities will show the state when the corresponding input is used.
The remaining entities will show the status when they receive data from the device, which is not immediate. Check if the script is properly installed on the devices (Scripts section).
I assume you have enabled entities that are disabled by default.

Thanks for your quick reply. Effectively, I've reviewed all MQTT settings for all devices doing the following:

  • Activating all MQTT entities for all Shellies devices in my HA
  • Reviewing all homeassistant entries in MQTT, deleting those indentified unknown entities and executing the script for new discovery
  • Reviewing Shellies settings for MQTT and confirming that they are connected to MQTT and checking with MQTT explorer if those entities are active and being updated
  • All the tests were done just before sending this request. 12 hours after, the entities are still not showing the content

Regarding Shellies script, this is the one that are set up in all devices. I haven't made any changes to those, as the script were put in place automatically by your script:

shellies_discovery_gen2_script_20221116

`let topic_prefix = null;
let installed_version = null;

Shelly.call("MQTT.GetConfig", {}, function (config) {
topic_prefix = config.topic_prefix;
});

function SendDeviceStatus() {
let _device_info = Shelly.getDeviceInfo();
installed_version = _device_info.ver;
Shelly.call("Shelly.GetStatus", {}, function (status) {
status.sys.installed_version = installed_version;
MQTT.publish(topic_prefix + "/status/rpc", JSON.stringify(status));
});
};

MQTT.setConnectHandler(SendDeviceStatus);
let UpdateTimer = Timer.set(30000, true, SendDeviceStatus);`

Hoep this can help.