~carstengrohmann/deye-mqtt-ha-plugin#2: 
Cannot get the plugin to work

I can see some error messages in the "Deye2MQTT" logs, maybe this helps you fo figure out where the problem is located:


2024-11-03 16:39:29,486 - DeyeInverterState - INFO - Reading start
2024-11-03 16:39:29,487 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3'}, range: 0202-022e]
2024-11-03 16:39:39,498 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3_battery'}, range: 024a-024f]
2024-11-03 16:39:49,506 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3'}, range: 0256-027c]
2024-11-03 16:39:59,518 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3_ups'}, range: 0284-028d]
2024-11-03 16:40:09,529 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3'}, range: 02a0-02a7]
2024-11-03 16:40:19,540 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3_timeofuse'}, range: 0092-00b1]
2024-11-03 16:40:29,551 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3_generator'}, range: 0295-029b]
2024-11-03 16:40:39,562 - DeyeInverterState - INFO - Reading registers [metrics group: {'settings', 'settings_micro'}, range: 0028-0028]
2024-11-03 16:40:49,575 - DeyeMqttClient - INFO - Logger is offline
2024-11-03 16:40:49,575 - DeyeHADiscovery - INFO - Processing events from logger: 0, SN:279xxxxxxx
2024-11-03 16:40:49,576 - DeyeDaemon - ERROR - Unexpected error during runner execution
Traceback (most recent call last):
  File "/opt/deye_inverter_mqtt/deye_daemon.py", line 53, in __invoke_action
    self.__action()
  File "/opt/deye_inverter_mqtt/deye_inverter_state.py", line 60, in read_from_logger
    processor.process(events)
  File "/opt/deye_inverter_mqtt/plugins/deye_plugin_ha_discovery.py", line 312, in process
    self.publish_status_information()
  File "/opt/deye_inverter_mqtt/plugins/deye_plugin_ha_discovery.py", line 296, in publish_status_information
    self._mqtt_client.publish(discovery_topic, payload)
AttributeError: 'DeyeMqttClient' object has no attribute 'publish'

Any help is appreciated,

Thanks.

Status
RESOLVED CLOSED
Submitter
~killamilla
Assigned to
Submitted
2 months ago
Updated
2 months ago
Labels
No labels applied.

~carstengrohmann 2 months ago

Hi,

DeyeMqttClient.publish() is available since version 2024.06.2 of deye-inverter-mqtt.

Please update to the newest release.

Regards, Carsten

~killamilla (edited) 2 months ago*

Hi Carsten

Unfortunately, it still doesn't work: errors are gone now, after I recreated the container via the docker-compose file:

services:
  deye-mqtt:
    image: ghcr.io/kbialek/deye-inverter-mqtt
    env_file:
      - config.env
    restart: unless-stopped
    volumes:
     - ./plugins:/opt/deye_inverter_mqtt/plugins:ro

But, it seems the HA plugin is not been detected anymore as the related line "DeyeHADiscovery" is missing in the logs now:

2024-11-04 20:06:46,865 - DeyeDaemon - INFO - Please help me build the list of compatible inverters. https://github.com/kbialek/deye-inverter-mqtt/issues/41
2024-11-04 20:06:46,867 - DeyeConnectorFactory - INFO - Creating Modbus/TCP Logger connector
2024-11-04 20:06:46,872 - DeyeProcessorFactory - INFO - Feature "Report metrics over MQTT": enabled
2024-11-04 20:06:46,873 - DeyeProcessorFactory - INFO - Feature "Set inverter time once online": disabled
2024-11-04 20:06:46,875 - DeyeProcessorFactory - INFO - Feature "Time-of-use configuration over MQTT": disabled
2024-11-04 20:06:46,877 - DeyeProcessorFactory - INFO - Feature "Active power regulation over MQTT": disabled
2024-11-04 20:06:47,922 - DeyeMqttClient - INFO - Successfully connected to MQTT Broker located at 172.20.30.101:1883
2024-11-04 20:07:31,932 - DeyeInverterState - INFO - Reading start
2024-11-04 20:07:31,933 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3'}, range: 0202-022e]
2024-11-04 20:07:39,349 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3_battery'}, range: 024a-024f]
2024-11-04 20:07:39,435 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3'}, range: 0256-027c]
2024-11-04 20:07:41,848 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3_ups'}, range: 0284-028d]
2024-11-04 20:07:47,789 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3'}, range: 02a0-02a7]
2024-11-04 20:07:48,081 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3_timeofuse'}, range: 0092-00b1]
2024-11-04 20:07:48,595 - DeyeInverterState - INFO - Reading registers [metrics group: {'deye_sg04lp3_generator'}, range: 0295-029b]
2024-11-04 20:07:48,802 - DeyeInverterState - INFO - Reading registers [metrics group: {'settings', 'settings_micro'}, range: 0028-0028]
2024-11-04 20:07:48,906 - DeyeMqttClient - INFO - Logger is online
2024-11-04 20:07:49,295 - DeyeInverterState - INFO - Reading completed

Any ideas what is still going wrong ?

Thanks.

~carstengrohmann 2 months ago

Hmm, Unfortunately I have no idea either, but I would:

  • set LOG_LEVEL=DEBUG in config.env and re-create the container
  • check the debug log
  • open a shell inside the container docker exec -ti deye-mqtt /bin/sh and check if the plugins directory is populated

BTW: You can frame code blocks with “~~~” to make the layout easier to read.

~killamilla 2 months ago

OK, after all it was caused due to an old deye-inverter-mqtt version. I removed the old container, cleaned up old container images and downloaded the latest version:

image: ghcr.io/kbialek/deye-inverter-mqtt:2024.11.1 

This made it working.

Now I can see homeassistant auto-discovery of the Deye topics, but there is only "PV1" topics:

dc_pv1_power
dc_pv1_voltage
dc_pv1_current

"PV2" topics are missing, although, I can see them when polling PV2 data directly via Node-Red MQTT node. So they are available, but for some reason, the HA plugin won't show them.

Do you know why that is ?

Thanks.

~carstengrohmann 2 months ago

Great news!

Please check DEYE_HA_PLUGIN_IGNORE_TOPIC_PATTERNS in config.env. The example from the README.md excludes the uptime topic as well as pv2 till pv4 as I don't need these topics.

# Topics not published to HA
# Use : as separator, supports Unix shell-style wildcards *, ?, [seq] and
# [!seq] as implemented with Python fnmatch,
DEYE_HA_PLUGIN_IGNORE_TOPIC_PATTERNS=uptime:*/pv[234]/*

Adapt the pattern in DEYE_HA_PLUGIN_IGNORE_TOPIC_PATTERNS to your needs.

~killamilla 2 months ago

That solved it, indeed. All the desired deye sensor values are available now in HA.

Thanks a lot for your outstanding support.

~carstengrohmann REPORTED CLOSED 2 months ago

Register here or Log in to comment, or comment via email.