savdagod / ha-addons

HA add-on repository
MIT License
4 stars 2 forks source link

Added display for solar data #3

Closed daniel-sabourin closed 1 week ago

daniel-sabourin commented 3 weeks ago

First off, thanks for this project. I'm new to Home Assistant, but it was super easy to get up and running. I have some event based triggers configured using your existing laundry + dishwasher displays.

The display was originally a Tidbyt community app, which pulled directly from one vendor's solar product. It was modified by motoridersd to be used in Home Assistant via their API.

I've cleaned up the code a bit, and modified it so the solar data is passed into the applet, rather than the applet needing to worry about pulling the data itself.

Examples

High production, lower consumption

test-ezgif com-webp-to-gif-converter

No production

test-ezgif com-webp-to-gif-converter (1)

High consumption

test-ezgif com-webp-to-gif-converter (2)

Example automation

alias: "Sense x Tidbyt "
description: ""
trigger:
  - platform: time_pattern
    seconds: "0"
condition: []
action:
  - action: tidbytassistant.push
    data:
      contenttype: custom
      customcontent: solar
      devicename:
        - office_tidbyt
      arguments: >-
        generation={{ states('sensor.energy_production') }};consumption={{
        states('sensor.energy_usage') }};
mode: single
savdagod commented 3 weeks ago

So you want this solar.star built into the addon (as in selectable in the Built-In dropdown) rather than it needing to be a custom file?

daniel-sabourin commented 3 weeks ago

Yeah, something like that. Ideally there could also be arguments for the generation/consumption entities that can be specified in the UI, rather than needing to pass them in via YAML.

IngmarStein commented 2 weeks ago

A few things: 1) why should this be bundled with the addon? You can just put the file in the respective directory and use it from there. I don't think the addon should become an app store of sorts. 2) by supplying the values instead of retrieving the entities via the HA API, you lose metadata such as units (W, kW, %, …) 3) FYI: https://github.com/tidbyt/community/tree/main/apps/hasssolar is a more complete version which also supports entities for battery SOC, EV, and energy (in addition to power).

daniel-sabourin commented 2 weeks ago
  1. why should this be bundled with the addon? You can just put the file in the respective directory and use it from there. I don't think the addon should become an app store of sorts.

Fair enough. Everyone has their own needs for the addon and by trying to support everyone you'll quickly start to bloat things. That argument could be made against the existing event notifications (like dishwasher cycle completed). Where should the line be drawn? Should there be a way to pull from the official Tidbyt apps, or from any Github repo? Or is it easy enough to copy/paste and be done with it? Forgive my ignorance as I'm new to Home Assistant and I don't know what standard practices are.

  1. by supplying the values instead of retrieving the entities via the HA API, you lose metadata such as units (W, kW, %, …)

True. For this application for monitoring residential solar production I wouldn't think it's a huge deal, but good to keep in mind.

  1. FYI: https://github.com/tidbyt/community/tree/main/apps/hasssolar is a more complete version which also supports entities for battery SOC, EV, and energy (in addition to power).

I'll have to check that out, I hadn't seen it before. I see you're a contributor, so thanks for your contributions. It looks really solid with lots visualizations.

The applet requires a Home Assistant installation reachable via the internet

That's probably problematic for a lot of people, but I would imagine it's only an issue when running through Tidbyt servers. The big draw with Home Assistant is that everything is locally hosted. Is there a way to get a similar experience/convenience that the Tidbyt app offers, but having the pulling of data happening locally on Home Assistant?

Thanks again for your feedback.

IngmarStein commented 2 weeks ago

You still need an online connection with Tidbyt Assistant. Images are pushed to the Tidbyt cloud and the display pulls them from there. If you really want to operate the display without an internet connection, you would have to use a custom firmware and send the data to it directly.

IngmarStein commented 2 weeks ago

You might find this useful if you really want to avoid using the HA API: https://github.com/tidbyt/community/pull/2783

savdagod commented 1 week ago

@daniel-sabourin I agree with @IngmarStein, custom apps are as easy as copying and pasting the code into a new .star file using the Visual Studio Code add-on then using the service to push that file. I don’t think adding this to the add-on has any real benefit. Also as stated, Tidbyt is dependent on the cloud unless you use custom firmware. This integration/add-on is not built for any custom firmwares so you’re at the mercy of Tidbyts servers. If that changes in the future, I’ll be sure to update the integration to support local pushing.