vwt12eh8 / hassio-ecoflow

EcoFlow Portable Power Station Integration for Home Assistant
MIT License
240 stars 37 forks source link

Smart Home Panels Support #26

Open adampagot opened 2 years ago

adampagot commented 2 years ago

Is it possible to support the smart home panel? If there is anything I could do to help please let me know.

Ne0-Hack3r commented 1 year ago

@lwsrbrts - thanks for that... I had been wondering how that per circuit array worked in terms of deriving the actual Wh value... I just never got back round to digging into it...

Here is my rendition of the sensor:

  - name: SHP Circuit 1 Battery Energy
    object_id: shp_ch1_batt_energy
    unique_id: shp_ch1_batt_energy
    state_topic: "ecoflow/SHP/data"
    qos: 0
    device_class: energy
    unit_of_measurement: "Wh"
    state_class: total
    value_template: >-
      {% if value_json.params.id == 49 %}
        {% set d = value_json.params.watth[0] %}
        {% if d is defined %}
          {{d|sum|round(0)}}
        {%else%}{{this.state}}{%endif%}
      {%else%}{{this.state}}{%endif%}
    last_reset_value_template: >-
      {% if value_json.params.id == 49 %}
        {% set t = value_json.params.rtc %}
        {% if t is defined %}
          {{(as_timestamp(strptime(t,'%Y-%m-%d'))|as_datetime()).isoformat()}}
        {%else%}{{state_attr(this.state,'last_reset')}}{%endif%}
      {%else%}{{state_attr(this.state,'last_reset')}}{%endif%}

I made only slight tweaks to the dashboard YAML you provided:

views:
  - title: Circuits
    path: Circuits
    cards:
      - type: grid
        square: false
        columns: 2
        cards:
          - type: custom:mushroom-template-card
            primary: Upstairs Sub A
            secondary: >-
              {% from 'shp_dashboard.jinja' import shp_circuit_info %}
              {{ shp_circuit_info('sensor.shp_ch1_power',
              'sensor.shp_ch1_energy', 'sensor.shp_ch1_batt_energy' ) }}
            icon: mdi:numeric-1-circle
            entity: sensor.shp_ch1_power
            multiline_secondary: true
            badge_icon: |-
              {% from 'shp_dashboard.jinja' import shp_battery_icon %}
              {{ shp_battery_icon('select.shp_circuit_1_mode') }}
            fill_container: false
            layout: vertical
            icon_color: blue
            badge_color: |-
              {% from 'shp_dashboard.jinja' import shp_battery_badge %}
              {{ shp_battery_badge('select.shp_circuit_1_mode') }}
            tap_action:
              action: navigate
              navigation_path: /lovelace-energy/circuit-1

image

I am wondering where the tap action is supposed to go... Is that pointing to another custom dashboard in your setup or something within the native energy dashboard? When I tap any circuit it takes me to the primary view on my primary dashboard so I'm guessing the path is not valid...

lwsrbrts commented 1 year ago

Yes, the tap action goes to a sub-view (so it's hidden) of the same dashboard and that's where I see additional information and can control the circuit manually also. I use the same grid circuit view with all the same settings meaning I can then navigate to different circuits also - since all the code and tap actions are defined in the same grid circuit view.

image

lwsrbrts commented 1 year ago

This might answer some questions.

https://github.com/vwt12eh8/hassio-ecoflow/assets/15855642/7bc32a2b-ae87-4d71-acbb-d99591eed62f

Ne0-Hack3r commented 1 year ago

@lwsrbrts - got it! that clever... I'm still learning some of the advanced stuff you can do with dashboards... Beats the native app by miles!

ketoha commented 1 year ago

@Ne0-Hack3r can I have access to your repo please?

Ne0-Hack3r commented 1 year ago

@Ne0-Hack3r can I have access to your repo please? @ketoha done

maxisven commented 1 year ago

Hey @Ne0-Hack3r, can I have acess to your repo pls ?

Thank you very much :-)

Ne0-Hack3r commented 1 year ago

@maxisven done

maxisven commented 11 months ago

hey guys :-) Can anyone help me with install this repo ? Im newbie in homeassistant and i dont unterstand where create the folder for the cacert.pem

bluefire100 commented 11 months ago

@maxisven done

May I ask for access to your repo please, too? Thank you!

bluefire100 commented 11 months ago

Just started editing my configuration.yaml file and now have access to tested SHP items. Lots of work ahead but this has been a good breakthrough for me. @Ne0-Hack3r Could I get access to your repo?

All what follows assumes your HA MQTT broker is configured properly and is receiving messages in the correct topics.

Instead of modifying your configuration.yaml file directly, add this to it instead.

homeassistant:
  packages: !include_dir_named packages

Then download my YAML config gist for the Smart Home Panel from: https://gist.github.com/lwsrbrts/8d6a77b4306f284cd193635e5722ffcd

Some of the data access methods and set controls in the config were determined by @Ne0-Hack3r so I won't take credit for those.

Create a folder in the same location as your configuration.yaml file called packages

Then place the gist file as a .yaml extension in the packages folder.

From that configuration, I've created the following dashboards in HA - where you can also see some controls.

image

image

Trying your solution and adding to "Energy dashboard" I got 2 error messages:

Any hint what to do?

regareds

lwsrbrts commented 11 months ago

Statitics not defined happens because nothing is being populated, that's because you're selecting the wrong entities in the individual items section for the energy dashboard.

The sensors at the top of the gist are the ones you need to use in the individual items area of the energy dashboard. So these (I've highlighted the names of the sensors) are what you add to the dashboard.

image

And that gives you these in the dashboard config...

image

Which starts showing these in time:

image

bluefire100 commented 11 months ago

Unfortunately the entities you mentioned do not appear, saying I cannot select them. I only can choose from this 2 (for all 10 circuits). In the config file at "packages" directory they are as shown in your screenshot.

Error (1)
lwsrbrts commented 11 months ago

I would check that you have data actually populating in MQTT - have you set up the MQTT bridge to ecoflow? The primary source of data is MQTT, that information is pushed through other sensors to make up the entities that you can place on the energy dashboard.

I don't know your skill level with Home Assistant or MQTT but please be aware that this Ecoflow integration (hassio-ecoflow) does not provide any Smart Home Panels data. That all comes from a connection (a bridge) to Ecoflow's own MQTT server which pulls the SHP data locally (to your MQTT server) and the YAML above pulls that data from your MQTT server to put it in to HA sensors. This "issue", among others in this repository has just turned in to a discussion area. @Ne0-Hack3r has done a great job of summarising everything needed to get the MQTT bridge set up and configure the dashboards etc. but that information is in his own private repo, which I'm sure he'll give you access to.

bluefire100 commented 11 months ago

Thx, now I know why it's not working. My HA skills are not good enough to do this by myself. I have to wait, until https://github.com/Ne0-Hack3r has finished the integration in Cassio EcoFlow cloud.

lwsrbrts commented 11 months ago

This repo belongs to someone else, it jsut so happens that this is where we all started discussing Smart Home Panel data.

@Ne0-Hack3r 's repo will give you all the information needed to set up the bridge connection but the pre-requisite is that you must have MQTT configured in HA already.

If you've not done that yet - watch this YouTube video to get it configured: https://www.youtube.com/watch?v=dqTn-Gk4Qeo&pp=ygUEbXF0dA%3D%3D

bluefire100 commented 11 months ago

This repo belongs to someone else, it jsut so happens that this is where we all started discussing Smart Home Panel data.

@Ne0-Hack3r 's repo will give you all the information needed to set up the bridge connection but the pre-requisite is that you must have MQTT configured in HA already.

If you've not done that yet - watch this YouTube video to get it configured: https://www.youtube.com/watch?v=dqTn-Gk4Qeo&pp=ygUEbXF0dA%3D%3D

NeO-Hack3r was asking a few days ago in the [hassio-ecoflow-cloud] repo if he should integrate SHP into hassio-ecoflow cloud integration

Div
lwsrbrts commented 11 months ago

Ah ok. Yeah, I've been keeping my eye on that repo too. You do have options though if you can't wait.

Ne0-Hack3r commented 11 months ago

bluefire100

@bluefire100 - done

Ne0-Hack3r commented 11 months ago

@bluefire100

I recently updated the YAML package for SHP integration. It has several additional items as well as added automations for doing various advanced things like manipulating the automations inside SHP itself. Be careful if you're just starting out as some of this stuff can do unexpected things and the SHP is controlling actual electrical circuits, etc.

image

The most current version of my package uses the names above for the cumulative energy sensors.

Ne0-Hack3r commented 11 months ago

Ah ok. Yeah, I've been keeping my eye on that repo too. You do have options though if you can't wait.

@lwsrbrts @bluefire100

I've heard nothing from the author of that repo. I'd be happy to help but I'm going to need some guidance from them to streamline the process. I've never written a full grown HA integration so I'll trade what I know about the SHP for some hand holding in that area. I have played with the cloud integration but I've already got packages for everything is provides and have steadily moved everything to local control (using a modified hasso integration or my own hacks/packages). The SHP is the only thing left on my list that still required the cloud MQTT server because it has no TCP access and BLE access requires manual enabling (Iot button) and even if that worked I don't feel like reverse engineering all the byte stream data/settings at this point.

legrandjeremy commented 9 months ago

hi All,

I'm very interested to implement my SPH in HomeAssistant. @Ne0-Hack3r Can you please give me access to your repo ? 🙏

Many thanks

Ne0-Hack3r commented 9 months ago

legrandjeremy

@legrandjeremy - done

fakeshemp01 commented 9 months ago

@Ne0-Hack3r

Great work. I really wanted to wait until formal integration was done, but I am a child at heart waiting on Christmas Eve with excited trepidation.

That said, @Ne0-Hack3r , may I have access also please?

Being that I have two Smart Home Panels, would you have any consideration or concerns? Please and thank you!

legrandjeremy commented 9 months ago

legrandjeremy

@legrandjeremy - done

Many Thanks @Ne0-Hack3r and congrats for this amazing work. I integrated my Smart Home Panel, it's a pleasure to see all actions and data inside HomeAssistant !

Ne0-Hack3r commented 8 months ago

@fakeshemp01 - DONE

For 2 x SHP, be sure to setup your mosquito.conf such that you have and SHP1 and SHP2 for the local prefix of the topics mapped to the serial number based topics for each SHP and then make 2 copies of the YAML package (for SHP1 and SHP2) in each package copy replace all instances of "SHP" with "SHP1" and "shp" with "shp1" (or SHP2/shp2). That is what I did to support 2 DPs and I think it should work for 2 x SHP (though I have not tried it).

fakeshemp01 commented 8 months ago

@fakeshemp01 - DONE

For 2 x SHP, be sure to setup your mosquito.conf such that you have and SHP1 and SHP2 for the local prefix of the topics mapped to the serial number based topics for each SHP and then make 2 copies of the YAML package (for SHP1 and SHP2) in each package copy replace all instances of "SHP" with "SHP1" and "shp" with "shp1" (or SHP2/shp2). That is what I did to support 2 DPs and I think it should work for 2 x SHP (though I have not tried it).

@Ne0-Hack3r - Thank you!

mdelrossi commented 7 months ago

@Ne0-Hack3r

I'd like access to the SHP repo

Ne0-Hack3r commented 7 months ago

@mdelrossi invite sent

mdelrossi commented 7 months ago

@Ne0-Hack3r

Thank you

Thomptronics commented 7 months ago

@Ne0-Hack3r Love to get access to your repo if I could. Thanks.

Ne0-Hack3r commented 7 months ago

@Thomptronics - done!

Thomptronics commented 7 months ago

@Ne0-Hack3r Thanks. Looking forward to playing with this today.

And... just after I got your invite I saw this: EcoFlow Developer Platform

Looks like we now have a way to make some more official (and reliable) integrations!

lwsrbrts commented 7 months ago

Not gonna lie. That is some very good and very welcome news from Ecoflow. I believe that @Ne0-Hack3r was aware of this in a beta program of sorts but now that we have official documentation and an official method of interacting with our devices we are, as you say, very likely to get some official Home Assistant integrations, but it is a bit of a shame that it's cloud-based.

Ne0-Hack3r commented 7 months ago

@lwsrbrts

The SHP support needs things like current per circuit power readings to be exposed but that is supposed to happen this month, hopefully. Better to have an officially supported API but still disappointing that no local access exists, beyond manually enabled BLE, for SHP and that they keep closing the TCP port for DP.

julrich1 commented 6 months ago

I've enrolled in the developer program and it looks pretty straight forward but they don't have any Smart Home Panel 2 docs yet. Does anyone have the commands available?

julrich1 commented 6 months ago

@Ne0-Hack3r could I also get access to your repo please?

Ne0-Hack3r commented 6 months ago

I've enrolled in the developer program and it looks pretty straight forward but they don't have any Smart Home Panel 2 docs yet. Does anyone have the commands available?

SHP2 and DPU are supposed to happen in Q2. It looks like some of the preliminary structure is there and you can pull sensor data but there is no documentation and it does not appear access to modify settings has been opened up yet. The data for both on the public MQTT side is encoded making it a rather involved process to try to reverse-engineer so waiting for the official support in the API.

Ne0-Hack3r commented 6 months ago

@julrich1

Invite sent

jrseliga commented 6 months ago

@Ne0-Hack3r may I have access to the repository as well?

Ne0-Hack3r commented 6 months ago

@jrseliga

Sure thing... invite sent!

theneochan commented 6 months ago

Hello, please can I get access?

Want to control charging based on Octopus Agile.

carfnann commented 6 months ago

lwsrbrts many thanks for what you have shared! I have been able to add my SHP to HA. thanks very much

can I ask you if you can share you dashboard yaml ? I have added the jinja part but I would love to have the same look and field and features as you.

thanks

carfnann commented 6 months ago

@Ne0-Hack3r may I ask you to invite me as well? Please

lwsrbrts commented 6 months ago

lwsrbrts many thanks for what you have shared! I have been able to add my SHP to HA. thanks very much

can I ask you if you can share you dashboard yaml ? I have added the jinja part but I would love to have the same look and field and features as you.

thanks

I believe it's pretty much all here - well, the centre bit is. If you need something else, let me know what bit specifically.

https://gist.github.com/lwsrbrts/03a697d23a0cdf6fa46898b54dbdf44c

Should give you this: image

Thanks

carfnann commented 6 months ago

lwsrbrts many thanks for what you have shared! I have been able to add my SHP to HA. thanks very much can I ask you if you can share you dashboard yaml ? I have added the jinja part but I would love to have the same look and field and features as you. thanks

I believe it's pretty much all here - well, the centre bit is. If you need something else, let me know what bit specifically.

https://gist.github.com/lwsrbrts/03a697d23a0cdf6fa46898b54dbdf44c

Should give you this: image

Thanks

I have integrated this part, but I'm missing the left and right part of your dashboard. and especially how you managed to click on a circuit and have the dedicated page for it (for left and right part ;) ).

lwsrbrts commented 6 months ago

I've updated the gist to include the raw configuration of that entire dashboard including the sub-views (the individual circuits). I use apexcharts card extensively and it is highly likely there are some custom sensors that aren't defined for you. If you need the yaml for those, let me know the names of the sensors that are missing for you and i'll dig them out of my config.

https://gist.github.com/lwsrbrts/03a697d23a0cdf6fa46898b54dbdf44c

carfnann commented 6 months ago

I've updated the gist to include the raw configuration of that entire dashboard including the sub-views (the individual circuits). I use apexcharts card extensively and it is highly likely there are some custom sensors that aren't defined for you. If you need the yaml for those, let me know the names of the sensors that are missing for you and i'll dig them out of my config.

https://gist.github.com/lwsrbrts/03a697d23a0cdf6fa46898b54dbdf44c

a million time : THANK YOU !!!

theneochan commented 5 months ago

Hello, if anyone has to time to help me I would very much appreciate it. I'm hoping to control my SHP charging and discharging to make the most of variable electricity tariff.

I'm completely new to MQTT. I've go through this thread and tried to follow the tips from lwsrbrts

I have all the SHP entities now in HA but they are all unavailable. I suspect MQTT is not connecting to Ecoflow but I have no idea how to test that.

I have a file \share\mosquitto\mosquitto.conf only adding my ecoflow username, password and SHP serial number to the code I coppied from here. Screenshot 2024-04-08 221931

I have added

homeassistant: packages: !include_dir_named packages

to my main configuration.yaml file and added yaml file in /packages

As I say I think this part has worked as it has created all the unavailable entities in HA.

Many thanks,

lwsrbrts commented 4 months ago

@theneochan - sorry for the delay here. You're never going to get that file to work. The "code" that you've copied down is a PowerShell script which is used to generate the actual mosquitto.conf file that you need. So the first thing you'll need to do is delete that mosquitto.conf file because it will never work.

To run the PowerShell script and generate the actual mosquitto.conf file, you will need to install PowerShell 7 - it looks like you're using Windows 11 so this is pretty straightforward.

Once you have PowerShell 7 installed, open it and you'll be sitting at a command prompt. Copy the code in to a file and call it something you'll remember, like config_generator.ps1. - the last three letters matter.

Inside PowerShell, you will need to change directory to where config_generator.ps1 is. Then simply type in the first few letters and press tab on your keyboard to autocomplete the filename. Then press Enter and the script will run.

As an example, this is what I might do... image

The output from the script will be some text. You want to copy this text, completely as it is and paste it in to the mosquitto.conf file that is located in the /share/mosquitto folder of Home Assistant.