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

[Request] Is it possible to add "General topics" and "Inverter total topics" to MQTT Topics for Home Assistant? #1050

Closed
januszwoj opened this issue Jun 18, 2023 · 15 comments
Labels
enhancement New feature or request

Comments

@januszwoj
Copy link

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

I know that I can create entities/helpers and perform mathematical calculations to get, for example, the total sum of daily production.
But why if this data already exists in DTU and is sent via MQTT, only Home Assistant cannot see it.
Could you add these topics to: "Home Assistant MQTT Auto Discovery Parameters"?

Describe alternatives you've considered

I have no idea

Additional context

Thank you in advance and best regards.
Janusz

@januszwoj januszwoj added the enhancement New feature or request label Jun 18, 2023
@DejanBukovec
Copy link

I vote for this feature...
I think this will be simple task to do because MQTT data are already there...
Im myself manualy publish 4 configurations and simply get data to HA:
slika

@januszwoj
Copy link
Author

I vote for this feature... I think this will be simple task to do because MQTT data are already there... Im myself manualy publish 4 configurations and simply get data to HA: slika

Hi DejanBukovec
Could you write how you did it? It would certainly come in handy before they will introduce it to the firmware.
Did you send these commands using MQTT-Explorer and what did they look like?
Thanks in advance.
Janusz

@DejanBukovec
Copy link

DejanBukovec commented Jul 26, 2023

Hi,
First Im send it by MQTT Explorer BUT after every HA restart they has been lost so I need resend it... Then Im make in HA automation which trigger after start.

Down in post will be my Automation in yaml. Please replace next names with your preffered ones:
YOUR_DTU_SERIAL - With your OpenDTU serial which you can see/set in "Settings" -> "DTU Settings" -> "Serial"
YOUR_DTU_NAME - With name of your DTU
YOUR_DTU_IP - With IP of your DTU
YOUR_DTU_VERSION - With your DTU version for example v23.7.22

alias: Solar MQTT Publish
description: ""
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - service: mqtt.publish
    data:
      qos: 0
      retain: false
      topic: homeassistant/sensor/dtu_YOUR_DTU_SERIAL/dc_power/config
      payload: |-
        {
            "name":"YOUR_DTU_NAME DC Power",
            "stat_t":"solar/dc/power",
            "uniq_id":"YOUR_DTU_SERIAL_PowerDC",
            "unit_of_meas":"W",
            "dev":{"name":"YOUR_DTU_NAME","ids":"YOUR_DTU_SERIAL","cu":"http://YOUR_DTU_IP","mf":"OpenDTU","mdl":"ESP32","sw":"YOUR_DTU_VERSION"},
            "exp_aft":81,
            "dev_cla":"power",
            "stat_cla":"measurement"
        }
    alias: Solar - DTU - DC Power
  - service: mqtt.publish
    data:
      qos: 0
      retain: false
      topic: homeassistant/sensor/dtu_YOUR_DTU_SERIAL/ac_power/config
      payload: |-
        {
            "name":"YOUR_DTU_NAME AC Power",
            "stat_t":"solar/ac/power",
            "uniq_id":"YOUR_DTU_SERIAL_PowerAC",
            "unit_of_meas":"W",
            "dev":{"name":"YOUR_DTU_NAME","ids":"YOUR_DTU_SERIAL","cu":"http://YOUR_DTU_IP","mf":"OpenDTU","mdl":"ESP32","sw":"YOUR_DTU_VERSION"},
            "exp_aft":81,
            "dev_cla":"power",
            "stat_cla":"measurement"
        }
    alias: Solar - DTU - AC Power
  - service: mqtt.publish
    data:
      qos: 0
      retain: false
      topic: homeassistant/sensor/dtu_YOUR_DTU_SERIAL/ac_yieldday/config
      payload: |-
        {
            "name":"YOUR_DTU_NAME Yield Day",
            "stat_t":"solar/ac/yieldday",
            "uniq_id":"YOUR_DTU_SERIAL_YieldDay",
            "unit_of_meas":"Wh",
            "dev":{"name":"YOUR_DTU_NAME","ids":"YOUR_DTU_SERIAL","cu":"http://YOUR_DTU_IP","mf":"OpenDTU","mdl":"ESP32","sw":"YOUR_DTU_VERSION"},
            "exp_aft":81,
            "dev_cla":"energy",
            "stat_cla":"measurement"        
        }
    alias: Solar - DTU - AC Yield Day
  - service: mqtt.publish
    data:
      qos: 0
      retain: false
      topic: homeassistant/sensor/dtu_YOUR_DTU_SERIAL/ac_yieldtotal/config
      payload: |-
        {
            "name":"YOUR_DTU_NAME Yield Total",
            "stat_t":"solar/ac/yieldtotal",
            "uniq_id":"YOUR_DTU_SERIAL_YieldTotal",
            "unit_of_meas":"kWh",
            "dev":{"name":"YOUR_DTU_NAME","ids":"YOUR_DTU_SERIAL","cu":"http://YOUR_DTU_IP","mf":"OpenDTU","mdl":"ESP32","sw":"YOUR_DTU_VERSION"},
            "exp_aft":81,
            "dev_cla":"energy",
            "stat_cla":"measurement"        
        }
    alias: Solar - DTU - AC Yield Total
mode: single

@januszwoj
Copy link
Author

Hi DejanBukovec
Thank you very much. Everything works great.
I noticed only one problem, for sure in my case:
"name":"YOUR_DTU_NAME Yield Day",
"stat_t":"solar/ac/yieldday",
"uniq_id":"YOUR_DTU_SERIAL_YieldDay",
"unit_of_meas":"kWh", <----- in my case it should be "Wh"

Besides, it's great.
Thanks again.
Regards Janusz

@DejanBukovec
Copy link

You are correct. I dont use this entity so didn't figure out that is wrong...
Im edit previous post and fix mistake...

@AzraelsDisk
Copy link

vote 👍

@stefan123t
Copy link
Contributor

@januszwoj I am not sure whether I understand your Feature Request correctly:

You want us to add several total values to the future MQTT Topics on our list in #759 ?

  • dtu/total/dc/power (solar/dc/power)
  • dtu/total/ac/power (solar/ac/power)
  • dtu/total/ac/yieldday (solar/ac/yieldday)
  • dtu/total/ac/yieldtotal (solar/ac/yieldtotal)

Can you please review the list of MQTT Topics which are available, especially the Inverter Total Topics ?

@DejanBukovec what does your Home Assistant YAML actually do:

Does this setup a Dashboard Item with the four values or does it somehow calculate those and publish them back to the MQTT server ?

Why is the Home-Assistant Auto Discovery option not used / enough for your purpose of setting up a dashboard item ?

@DejanBukovec
Copy link

It is old issue and don't remember what exactly is wrong but:
HA Auto Discovery has been enabled. It is create most MQTT topics but not ones which Im write on comment. I don't know if this has been fixed in last year...

@stefan123t
Copy link
Contributor

stefan123t commented Jul 11, 2024

i understood from other issues you are using AhoyDTU at the moment and can not test / verify this anymore.

Let us wait for the OP @januszwoj to reply to his issue.

@tbnobody may choose to keep this open or handle it with other MQTT topics requested in #759

@AzraelsDisk
Copy link

AzraelsDisk commented Jul 11, 2024 via email

@stefan123t
Copy link
Contributor

My problem is, that for each inverter the values are reported… but the current overall power is missing.. at the web fronted it is shown but not on mqtt

removed mail reply gibberish ;)

@AzraelsDisk yes this is correct the total values are sent via /api/livedata/status but not via mqtt.

Hence I have linked this issue with #759 add additional MQTT topics.

@tbnobody has to decide if we need to keep this open as a reminder too.

@januszwoj
Copy link
Author

Hi @stefan123t
I am currently using OpenDTU v24.3.22.
If automation the above automation provided by @DejanBukovec is disabled, after starting HA it does not see the values ​​of these four parameters, and it appears as follows:

Zrzut ekranu 2024-07-12 120815

After applying the above automation - which is launched only at HA startup, it looks like this:

Zrzut ekranu 2024-07-12 115915

This automation unlocks these values ​​so that HA can see them.
Unfortunately, I don't know anything about the MQTT protocol, but there must be something in the settings of these four parameters that are not automatically recognized by HA after it is launched.
Regards Janusz

@stefan123t
Copy link
Contributor

IMHO they are either not implemented in the Home Assistant Auto-Discovery one-off routine,
or they are not sent in general. I would expect the former.

@tbnobody
Copy link
Owner

tbnobody commented Oct 3, 2024

Implemented in 2fb0260

@tbnobody tbnobody closed this as completed Oct 3, 2024
Copy link

github-actions bot commented Nov 3, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants