├── .vscode ├── settings.json └── tasks.json ├── eos ├── icon.png ├── logo.png ├── translations │ └── en.yaml ├── rootfs │ └── etc │ │ └── services.d │ │ └── eos │ │ ├── user │ │ └── contents.d │ │ │ └── EOS.config.json │ │ ├── finish │ │ └── run ├── README.md ├── config.yaml ├── build.yaml ├── Dockerfile ├── CHANGELOG.md └── DOCS.md ├── eos_local_build ├── icon.png ├── logo.png ├── translations │ └── en.yaml ├── rootfs │ └── etc │ │ └── services.d │ │ └── eos │ │ ├── user │ │ └── contents.d │ │ │ └── EOS.config.json │ │ ├── finish │ │ └── run ├── README.md ├── config.yaml ├── build.yaml ├── Dockerfile ├── CHANGELOG.md └── DOCS.md ├── .gitmodules ├── .github ├── dependabot.yaml └── workflows │ ├── lint.yaml │ └── builder.yaml ├── repository.yaml ├── .devcontainer.json ├── README.md ├── .gitignore ├── tests └── prognose.http └── LICENSE /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "iis.configDir": "" 3 | } -------------------------------------------------------------------------------- /eos/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duetting/ha_eos_addon/HEAD/eos/icon.png -------------------------------------------------------------------------------- /eos/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duetting/ha_eos_addon/HEAD/eos/logo.png -------------------------------------------------------------------------------- /eos_local_build/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duetting/ha_eos_addon/HEAD/eos_local_build/icon.png -------------------------------------------------------------------------------- /eos_local_build/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Duetting/ha_eos_addon/HEAD/eos_local_build/logo.png -------------------------------------------------------------------------------- /eos/translations/en.yaml: -------------------------------------------------------------------------------- 1 | network: 2 | 8503/TCP: EOS fastapi server (Not used for Ingress) 3 | # configuration: 4 | -------------------------------------------------------------------------------- /eos_local_build/translations/en.yaml: -------------------------------------------------------------------------------- 1 | network: 2 | 8503/TCP: EOS fastapi server (Not used for Ingress) 3 | # configuration: 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "eos/eos"] 2 | path = eos/eos 3 | url = https://github.com/Akkudoktor-EOS/EOS.git 4 | branch = main 5 | -------------------------------------------------------------------------------- /.github/dependabot.yaml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: weekly 7 | time: "06:00" 8 | -------------------------------------------------------------------------------- /repository.yaml: -------------------------------------------------------------------------------- 1 | # https://developers.home-assistant.io/docs/add-ons/repository#repository-configuration 2 | name: EOS Home Assistant add-on repository 3 | url: 'https://github.com/Duetting/ha_eos_addon' 4 | maintainer: Markus Dütting -------------------------------------------------------------------------------- /eos/rootfs/etc/services.d/eos/user/contents.d/EOS.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "server": { 3 | "startup_eosdash": true, 4 | "host": "0.0.0.0", 5 | "port": 8503, 6 | "eosdash_host": "0.0.0.0", 7 | "eosdash_port": 8504 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /eos_local_build/rootfs/etc/services.d/eos/user/contents.d/EOS.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "server": { 3 | "startup_eosdash": true, 4 | "host": "0.0.0.0", 5 | "port": 8503, 6 | "eosdash_host": "0.0.0.0", 7 | "eosdash_port": 8504 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "tasks": [ 4 | { 5 | "label": "Start Home Assistant", 6 | "type": "shell", 7 | "command": "supervisor_run", 8 | "group": { 9 | "kind": "test", 10 | "isDefault": true 11 | }, 12 | "presentation": { 13 | "reveal": "always", 14 | "panel": "new" 15 | }, 16 | "problemMatcher": [] 17 | } 18 | ] 19 | } -------------------------------------------------------------------------------- /eos/README.md: -------------------------------------------------------------------------------- 1 | # Home Assistant Add-on: EOS 2 | 3 | _EOS add-on._ 4 | This is just a home assistant add-on wrapper for the great work here: 5 | 6 | ![Supports aarch64 Architecture][aarch64-shield] 7 | ![Supports amd64 Architecture][amd64-shield] 8 | 9 | [aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg 10 | [amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg 11 | -------------------------------------------------------------------------------- /eos_local_build/README.md: -------------------------------------------------------------------------------- 1 | # Home Assistant Add-on: EOS 2 | 3 | _EOS local build add-on._ 4 | This is just a home assistant add-on wrapper for the great work here: 5 | 6 | ![Supports aarch64 Architecture][aarch64-shield] 7 | ![Supports amd64 Architecture][amd64-shield] 8 | 9 | [aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg 10 | [amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg 11 | -------------------------------------------------------------------------------- /eos_local_build/config.yaml: -------------------------------------------------------------------------------- 1 | # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config 2 | name: EOS local build add-on 3 | version: "1.2.3" 4 | slug: eos-lb 5 | description: Energy Optimization System add-on 6 | url: "https://github.com/Duetting/ha_eos_addon/tree/main/eos_local_build" 7 | arch: 8 | - aarch64 9 | - amd64 10 | init: false 11 | map: 12 | - share:rw 13 | - config:rw 14 | ports: 15 | 8503/tcp: 8503 16 | 8504/tcp: 8504 17 | ports_description: 18 | 8503/tcp: EOS fastapi server 19 | 8504/tcp: EOS Dashboard 20 | # options: 21 | # schema: 22 | backup_exclude: 23 | - /data/eos/cache 24 | startup: services 25 | webui: http://[HOST]:[PORT:8504] 26 | -------------------------------------------------------------------------------- /eos/config.yaml: -------------------------------------------------------------------------------- 1 | # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config 2 | name: EOS add-on 3 | version: "1.2.3" 4 | slug: eos 5 | description: Energy Optimization System add-on 6 | url: "https://github.com/Duetting/ha_eos_addon/tree/main/eos" 7 | arch: 8 | - aarch64 9 | - amd64 10 | init: false 11 | map: 12 | - share:rw 13 | - config:rw 14 | ports: 15 | 8503/tcp: 8503 16 | 8504/tcp: 8504 17 | ports_description: 18 | 8503/tcp: EOS fastapi server 19 | 8504/tcp: EOS Dashboard 20 | # options: 21 | # schema: 22 | backup_exclude: 23 | - /data/eos/cache 24 | image: "ghcr.io/duetting/{arch}-addon-eos" 25 | startup: services 26 | webui: http://[HOST]:[PORT:8504] 27 | -------------------------------------------------------------------------------- /eos/rootfs/etc/services.d/eos/finish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bashio 2 | # ============================================================================== 3 | # Take down the S6 supervision tree when example fails 4 | # s6-overlay docs: https://github.com/just-containers/s6-overlay 5 | # ============================================================================== 6 | 7 | declare APP_EXIT_CODE=${1} 8 | 9 | if [[ "${APP_EXIT_CODE}" -ne 0 ]] && [[ "${APP_EXIT_CODE}" -ne 256 ]]; then 10 | bashio::log.warning "Halt add-on with exit code ${APP_EXIT_CODE}" 11 | echo "${APP_EXIT_CODE}" > /run/s6-linux-init-container-results/exitcode 12 | exec /run/s6/basedir/bin/halt 13 | fi 14 | 15 | bashio::log.info "Service restart after closing" 16 | -------------------------------------------------------------------------------- /eos_local_build/rootfs/etc/services.d/eos/finish: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bashio 2 | # ============================================================================== 3 | # Take down the S6 supervision tree when example fails 4 | # s6-overlay docs: https://github.com/just-containers/s6-overlay 5 | # ============================================================================== 6 | 7 | declare APP_EXIT_CODE=${1} 8 | 9 | if [[ "${APP_EXIT_CODE}" -ne 0 ]] && [[ "${APP_EXIT_CODE}" -ne 256 ]]; then 10 | bashio::log.warning "Halt add-on with exit code ${APP_EXIT_CODE}" 11 | echo "${APP_EXIT_CODE}" > /run/s6-linux-init-container-results/exitcode 12 | exec /run/s6/basedir/bin/halt 13 | fi 14 | 15 | bashio::log.info "Service restart after closing" 16 | -------------------------------------------------------------------------------- /eos/build.yaml: -------------------------------------------------------------------------------- 1 | # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile 2 | # home assistant python base images don't work due to error with ninja dependency of scikit-learn 3 | build_from: 4 | aarch64: "ghcr.io/home-assistant/aarch64-base-debian:latest" 5 | amd64: "ghcr.io/home-assistant/amd64-base-debian:latest" 6 | # armhf: "ghcr.io/home-assistant/armhf-base-debian:latest" 7 | # armv7: "ghcr.io/home-assistant/armv7-base-debian:latest" 8 | # i386: "ghcr.io/home-assistant/i386-base-debian:latest" 9 | labels: 10 | org.opencontainers.image.title: "Home Assistant Add-on: EOS add-on" 11 | org.opencontainers.image.description: "Energy Optimization System add-on for home assistant." 12 | org.opencontainers.image.source: "https://github.com/Duetting/ha_eos_addon" 13 | org.opencontainers.image.licenses: "Apache License 2.0" 14 | args: 15 | TEMPIO_VERSION: "2021.09.0" 16 | -------------------------------------------------------------------------------- /eos_local_build/build.yaml: -------------------------------------------------------------------------------- 1 | # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile 2 | # home assistant python base images don't work due to error with ninja dependency of scikit-learn 3 | build_from: 4 | aarch64: "ghcr.io/home-assistant/aarch64-base-debian:latest" 5 | amd64: "ghcr.io/home-assistant/amd64-base-debian:latest" 6 | # armhf: "ghcr.io/home-assistant/armhf-base-debian:latest" 7 | # armv7: "ghcr.io/home-assistant/armv7-base-debian:latest" 8 | # i386: "ghcr.io/home-assistant/i386-base-debian:latest" 9 | labels: 10 | org.opencontainers.image.title: "Home Assistant Add-on: EOS local build add-on" 11 | org.opencontainers.image.description: "Energy Optimization System add-on for home assistant." 12 | org.opencontainers.image.source: "https://github.com/Duetting/ha_eos_addon" 13 | org.opencontainers.image.licenses: "Apache License 2.0" 14 | args: 15 | TEMPIO_VERSION: "2021.09.0" 16 | -------------------------------------------------------------------------------- /eos_local_build/Dockerfile: -------------------------------------------------------------------------------- 1 | # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile 2 | ARG BUILD_FROM 3 | FROM $BUILD_FROM 4 | 5 | # Execute during the build of the image 6 | ARG TEMPIO_VERSION BUILD_ARCH 7 | RUN \ 8 | curl -sSLf -o /usr/bin/tempio \ 9 | "https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}" 10 | 11 | # Copy root filesystem 12 | COPY rootfs / 13 | 14 | RUN apt-get update 15 | RUN apt-get install -y python3 python3-pip python3-venv moreutils git 16 | 17 | ENV VIRTUAL_ENV="/opt/venv" 18 | RUN python3 -m venv ${VIRTUAL_ENV} 19 | ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" 20 | 21 | ENV EOS_DIR="/opt/eos" 22 | 23 | RUN adduser --system --no-create-home eos \ 24 | && mkdir -p "${EOS_DIR}" \ 25 | && chown eos "${EOS_DIR}" 26 | 27 | RUN git clone https://github.com/Akkudoktor-EOS/EOS.git ${EOS_DIR} 28 | 29 | WORKDIR ${EOS_DIR} 30 | 31 | RUN pip install -Ur requirements.txt 32 | 33 | RUN pip install -e . 34 | 35 | # use s6-overlay as init system 36 | WORKDIR / 37 | ENTRYPOINT ["/init"] -------------------------------------------------------------------------------- /eos/Dockerfile: -------------------------------------------------------------------------------- 1 | # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-dockerfile 2 | ARG BUILD_FROM 3 | FROM $BUILD_FROM 4 | 5 | # Execute during the build of the image 6 | ARG TEMPIO_VERSION BUILD_ARCH 7 | RUN \ 8 | curl -sSLf -o /usr/bin/tempio \ 9 | "https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}" 10 | 11 | # Copy root filesystem 12 | COPY rootfs / 13 | 14 | RUN apt-get update 15 | RUN apt-get install -y python3 python3-pip python3-venv moreutils 16 | 17 | ENV VIRTUAL_ENV="/opt/venv" 18 | RUN python3 -m venv ${VIRTUAL_ENV} 19 | ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" 20 | 21 | ENV EOS_DIR="/opt/eos" 22 | 23 | WORKDIR ${EOS_DIR} 24 | 25 | RUN adduser --system --no-create-home eos \ 26 | && mkdir -p "${EOS_DIR}" \ 27 | && chown eos "${EOS_DIR}" 28 | 29 | COPY eos/requirements.txt . 30 | 31 | RUN pip install -Ur requirements.txt 32 | 33 | COPY eos/src ./src 34 | COPY eos/pyproject.toml . 35 | 36 | RUN pip install -e . 37 | 38 | # use s6-overlay as init system 39 | WORKDIR / 40 | ENTRYPOINT ["/init"] -------------------------------------------------------------------------------- /.github/workflows/lint.yaml: -------------------------------------------------------------------------------- 1 | name: Lint 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - develop 8 | pull_request: 9 | branches: 10 | - main 11 | - develop 12 | schedule: 13 | - cron: "0 0 * * *" 14 | 15 | jobs: 16 | find: 17 | name: Find add-ons 18 | runs-on: ubuntu-latest 19 | outputs: 20 | addons: ${{ steps.addons.outputs.addons_list }} 21 | steps: 22 | - name: ⤵️ Check out code from GitHub 23 | uses: actions/checkout@v4.2.2 24 | with: 25 | submodules: recursive 26 | 27 | - name: 🔍 Find add-on directories 28 | id: addons 29 | uses: home-assistant/actions/helpers/find-addons@master 30 | 31 | lint: 32 | name: Lint add-on ${{ matrix.path }} 33 | runs-on: ubuntu-latest 34 | needs: find 35 | strategy: 36 | matrix: 37 | path: ${{ fromJson(needs.find.outputs.addons) }} 38 | steps: 39 | - name: ⤵️ Check out code from GitHub 40 | uses: actions/checkout@v4.2.2 41 | with: 42 | submodules: recursive 43 | 44 | - name: 🚀 Run Home Assistant Add-on Lint 45 | uses: frenck/action-addon-linter@v2.18 46 | with: 47 | path: "./${{ matrix.path }}" 48 | -------------------------------------------------------------------------------- /.devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "EOS Home Assistant add-on repository", 3 | "image": "ghcr.io/home-assistant/devcontainer:addons-a3e692f", 4 | "appPort": [ 5 | "7123:8123", 6 | "7357:4357" 7 | ], 8 | "postStartCommand": "bash devcontainer_bootstrap", 9 | "runArgs": [ 10 | "-e", 11 | "GIT_EDITOR=code --wait", 12 | "--privileged" 13 | ], 14 | "containerEnv": { 15 | "WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}" 16 | }, 17 | "features": { 18 | "ghcr.io/devcontainers/features/python": "latest" 19 | }, 20 | "customizations": { 21 | "vscode": { 22 | "extensions": [ 23 | "timonwong.shellcheck", 24 | "esbenp.prettier-vscode", 25 | "humao.rest-client" 26 | ], 27 | "settings": { 28 | "terminal.integrated.profiles.linux": { 29 | "zsh": { 30 | "path": "/usr/bin/zsh" 31 | } 32 | }, 33 | "terminal.integrated.defaultProfile.linux": "zsh", 34 | "editor.formatOnPaste": false, 35 | "editor.formatOnSave": true, 36 | "editor.formatOnType": true, 37 | "files.trimTrailingWhitespace": true 38 | } 39 | } 40 | }, 41 | "mounts": [ 42 | "type=volume,target=/var/lib/docker", 43 | "type=volume,target=/mnt/supervisor" 44 | ] 45 | } -------------------------------------------------------------------------------- /eos_local_build/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## 1.2.3 4 | 5 | - Change IP listen addreess for server and EOSdash to 0.0.0.0 and add default config 6 | 7 | ## 1.2.2 8 | 9 | - Add info about usage of new "recorder.get_statistics" action, which makes the usage of SQL sensors obsolete 10 | 11 | ## 1.2.1 12 | 13 | - EOS (non local build) version update 14 | 15 | ## 1.2 16 | 17 | - Add info about breaking change for config and optimization payload 18 | 19 | ## 1.1.6 20 | 21 | - Add git client 22 | 23 | ## 1.1.5 24 | 25 | - Readd build.yaml 26 | 27 | ## 1.1.4 28 | 29 | - Bump version due to duplicated slug of local build version 30 | 31 | ## 1.1.3 32 | 33 | - Bump version for Github builder Action 34 | 35 | ## 1.1.2 36 | 37 | - Add eos dashboard (default 8504) to configuration 38 | 39 | ## 1.1.1 40 | 41 | - updated documentation for new EOS version 42 | Important: naming changes in the EOS optimize call requires reconfiguration of the optimize automation call !!! 43 | 44 | ## 1.1.0 45 | 46 | - update EOS version 02.03.2025 47 | 48 | ## 1.0.12 49 | 50 | - remove apparmor profile 51 | 52 | ## 1.0.11 53 | 54 | - armv7 is also not working up to now 55 | 56 | ## 1.0.10 57 | 58 | - Missing execute permission on s6 scripts. 59 | 60 | ## 1.0.9 61 | 62 | - local installation worked, remote doesn't. Maybe apparmor profile is not correctly applied? 63 | 64 | ## 1.0.8 65 | 66 | - armhf is also not supported 67 | 68 | ## 1.0.7 69 | 70 | - Wrong comments in README.md's 71 | 72 | ## 1.0.6 73 | 74 | - docker image URL has to be lowercase 75 | 76 | ## 1.0.5 77 | 78 | - URL for submodules is stored in the config and .gitmodules 79 | 80 | ## 1.0.4 81 | 82 | - submodules need to use https not ssh url's 83 | 84 | ## 1.0.3 85 | 86 | - Updated to newest EOS upstream version 87 | 88 | ## 1.0.2 89 | 90 | - i386 is not supported 91 | 92 | ## 1.0.1 93 | 94 | - Fix Github Actions checkouts with submodules 95 | 96 | ## 1.0.0 97 | 98 | - Initial release 99 | -------------------------------------------------------------------------------- /eos/rootfs/etc/services.d/eos/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/with-contenv bashio 2 | # ============================================================================== 3 | # Start the eos service 4 | # s6-overlay docs: https://github.com/just-containers/s6-overlay 5 | # ============================================================================== 6 | 7 | # Add your code here 8 | 9 | if [ ! -d /data/eos/cache ]; then 10 | bashio::log.info "Creating /data/eos/cache" 11 | mkdir -p "/data/eos/cache" 12 | fi 13 | chown -R eos "/data/eos/cache" 14 | if [ ! -d /opt/eos/cache ]; then 15 | ln -s "/data/eos/cache" "/opt/eos/cache" 16 | fi 17 | 18 | if [ ! -d /share/eos/output ]; then 19 | bashio::log.info "Creating /share/eos/output" 20 | mkdir -p "/share/eos/output" 21 | fi 22 | chown -R eos "/share/eos/output" 23 | if [ ! -d /opt/eos/output ]; then 24 | ln -s "/share/eos/output" "/opt/eos/output" 25 | fi 26 | 27 | if [ ! -d /config/eos ]; then 28 | bashio::log.info "Creating /config/eos" 29 | mkdir -p "/config/eos" 30 | fi 31 | chown -R eos "/config/eos" 32 | 33 | if [ ! -f /config/eos/EOS.config.json ]; then 34 | bashio::log.info "Creating /config/eos/EOS.config.json" 35 | cp /etc/services.d/eos/user/contents.d/EOS.config.json /config/eos/EOS.config.json 36 | else 37 | bashio::log.info "Use existing /config/eos/EOS.config.json" 38 | fi 39 | chown eos "/config/eos/EOS.config.json" 40 | if [ ! -f /opt/eos/EOS.config.json ]; then 41 | ln -s "/config/eos/EOS.config.json" "/opt/eos/EOS.config.json" 42 | fi 43 | 44 | bashio::log.info "Update listen IP address in EOS.config.json" 45 | jq '.server.host = "0.0.0.0"' "/config/eos/EOS.config.json" | sponge "/config/eos/EOS.config.json" 46 | jq '.server.eosdash_host = "0.0.0.0"' "/config/eos/EOS.config.json" | sponge "/config/eos/EOS.config.json" 47 | 48 | bashio::log.info "Current EOS.config.json content" 49 | jq "." "/config/eos/EOS.config.json" 50 | 51 | ## Run your program 52 | bashio::log.info "Start EOS fastapi server" 53 | cd /opt/eos || exit 54 | exec python3 src/akkudoktoreos/server/eos.py 55 | -------------------------------------------------------------------------------- /eos_local_build/rootfs/etc/services.d/eos/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/with-contenv bashio 2 | # ============================================================================== 3 | # Start the eos service 4 | # s6-overlay docs: https://github.com/just-containers/s6-overlay 5 | # ============================================================================== 6 | 7 | # Add your code here 8 | 9 | if [ ! -d /data/eos/cache ]; then 10 | bashio::log.info "Creating /data/eos/cache" 11 | mkdir -p "/data/eos/cache" 12 | fi 13 | chown -R eos "/data/eos/cache" 14 | if [ ! -d /opt/eos/cache ]; then 15 | ln -s "/data/eos/cache" "/opt/eos/cache" 16 | fi 17 | 18 | if [ ! -d /share/eos/output ]; then 19 | bashio::log.info "Creating /share/eos/output" 20 | mkdir -p "/share/eos/output" 21 | fi 22 | chown -R eos "/share/eos/output" 23 | if [ ! -d /opt/eos/output ]; then 24 | ln -s "/share/eos/output" "/opt/eos/output" 25 | fi 26 | 27 | if [ ! -d /config/eos ]; then 28 | bashio::log.info "Creating /config/eos" 29 | mkdir -p "/config/eos" 30 | fi 31 | chown -R eos "/config/eos" 32 | 33 | if [ ! -f /config/eos/EOS.config.json ]; then 34 | bashio::log.info "Creating /config/eos/EOS.config.json" 35 | cp /etc/services.d/eos/user/contents.d/EOS.config.json /config/eos/EOS.config.json 36 | else 37 | bashio::log.info "Use existing /config/eos/EOS.config.json" 38 | fi 39 | chown eos "/config/eos/EOS.config.json" 40 | if [ ! -f /opt/eos/EOS.config.json ]; then 41 | ln -s "/config/eos/EOS.config.json" "/opt/eos/EOS.config.json" 42 | fi 43 | 44 | bashio::log.info "Update listen IP address in EOS.config.json" 45 | jq '.server.host = "0.0.0.0"' "/config/eos/EOS.config.json" | sponge "/config/eos/EOS.config.json" 46 | jq '.server.eosdash_host = "0.0.0.0"' "/config/eos/EOS.config.json" | sponge "/config/eos/EOS.config.json" 47 | 48 | bashio::log.info "Current EOS.config.json content" 49 | jq "." "/config/eos/EOS.config.json" 50 | 51 | ## Run your program 52 | bashio::log.info "Start EOS fastapi server" 53 | cd /opt/eos || exit 54 | exec python3 src/akkudoktoreos/server/eos.py 55 | -------------------------------------------------------------------------------- /eos/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ## 1.2.3 4 | 5 | - Change IP listen addreess for server and EOSdash to 0.0.0.0 and add default config 6 | 7 | ## 1.2.2 8 | 9 | - Add info about usage of new "recorder.get_statistics" action, which makes the usage of SQL sensors obsolete 10 | 11 | ## 1.2.1 12 | 13 | - EOS (non local build) version update 14 | 15 | ## 1.2 16 | 17 | - Add info about breaking change for config and optimization payload 18 | 19 | ## 1.1.6 20 | 21 | - Add git client 22 | 23 | ## 1.1.5 24 | 25 | - Updated s6 run script to only create links when the target doesn't already exist 26 | 27 | ## 1.1.4 28 | 29 | - Bump version due to duplicated slug of local build version 30 | 31 | ## 1.1.3 32 | 33 | - Bump version for Github builder Action 34 | 35 | ## 1.1.2 36 | 37 | - Add eos dashboard (default 8504) to configuration 38 | 39 | ## 1.1.1 40 | 41 | - updated documentation for new EOS version 42 | Important: naming changes in the EOS optimize call requires reconfiguration of the optimize automation call !!! 43 | 44 | ## 1.1.0 45 | 46 | - update EOS version 02.03.2025 47 | 48 | ## 1.0.12 49 | 50 | - remove apparmor profile 51 | 52 | ## 1.0.11 53 | 54 | - armv7 is also not working up to now 55 | 56 | ## 1.0.10 57 | 58 | - Missing execute permission on s6 scripts. 59 | 60 | ## 1.0.9 61 | 62 | - local installation worked, remote doesn't. Maybe apparmor profile is not correctly applied? 63 | 64 | ## 1.0.8 65 | 66 | - armhf is also not supported 67 | 68 | ## 1.0.7 69 | 70 | - Wrong comments in README.md's 71 | 72 | ## 1.0.6 73 | 74 | - docker image URL has to be lowercase 75 | 76 | ## 1.0.5 77 | 78 | - URL for submodules is stored in the config and .gitmodules 79 | 80 | ## 1.0.4 81 | 82 | - submodules need to use https not ssh url's 83 | 84 | ## 1.0.3 85 | 86 | - Updated to newest EOS upstream version 87 | 88 | ## 1.0.2 89 | 90 | - i386 is not supported 91 | 92 | ## 1.0.1 93 | 94 | - Fix Github Actions checkouts with submodules 95 | 96 | ## 1.0.0 97 | 98 | - Initial release 99 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Home Assistant EOS addons repository 2 | 3 | Home Assistant EOS addons 4 | 5 | [![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2FDuetting%2Fha_eos_addon) 6 | 7 | ## Add-ons 8 | 9 | This repository contains the following add-ons 10 | 11 | - **[EOS add-on](./eos/README.md)** 12 | This is just a home assistant add-on wrapper for the great work here: 13 | 14 | ![Supports aarch64 Architecture][aarch64-shield] 15 | ![Supports amd64 Architecture][amd64-shield] 16 | 17 | - **[EOS local build add-on](./eos_local_build/README.md)** 18 | This is just a home assistant add-on wrapper which will be built locally for the great work here: 19 | 20 | ![Supports aarch64 Architecture][aarch64-shield] 21 | ![Supports amd64 Architecture][amd64-shield] 22 | 23 | 41 | 42 | ## Contribution 43 | 44 | Currently the most work in this repo is updating the EOS source code and check if the changes still work with the documentation. 45 | To do this the following steps are important: 46 | 47 | - update eos: `git submodule update --remote --recursive` 48 | - Run the vscode task `Start Home Assistant` 49 | - this takes up to 10 mins 50 | - if you see for a while on the onboading screen an issue with DNS just wait longer 51 | - After setting up the devloperment homeassitant instance install the Addon `EOS add-on` 52 | - Start the addon 53 | - After starting go to the folder `tests` 54 | - Run the request in `prognose.http` 55 | - The result should be a 200 OK and should contain anything that is refered in the `DOCS.md` 56 | - after sucessfull update increase the version number in `eos/config.yaml` and add an appropriate entry to the `eos/CHANGELOG.md` 57 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # UV 98 | # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | #uv.lock 102 | 103 | # poetry 104 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 105 | # This is especially recommended for binary packages to ensure reproducibility, and is more 106 | # commonly ignored for libraries. 107 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 108 | #poetry.lock 109 | 110 | # pdm 111 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 112 | #pdm.lock 113 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 114 | # in version control. 115 | # https://pdm.fming.dev/latest/usage/project/#working-with-version-control 116 | .pdm.toml 117 | .pdm-python 118 | .pdm-build/ 119 | 120 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 121 | __pypackages__/ 122 | 123 | # Celery stuff 124 | celerybeat-schedule 125 | celerybeat.pid 126 | 127 | # SageMath parsed files 128 | *.sage.py 129 | 130 | # Environments 131 | .env 132 | .venv 133 | env/ 134 | venv/ 135 | ENV/ 136 | env.bak/ 137 | venv.bak/ 138 | 139 | # Spyder project settings 140 | .spyderproject 141 | .spyproject 142 | 143 | # Rope project settings 144 | .ropeproject 145 | 146 | # mkdocs documentation 147 | /site 148 | 149 | # mypy 150 | .mypy_cache/ 151 | .dmypy.json 152 | dmypy.json 153 | 154 | # Pyre type checker 155 | .pyre/ 156 | 157 | # pytype static type analyzer 158 | .pytype/ 159 | 160 | # Cython debug symbols 161 | cython_debug/ 162 | 163 | # PyCharm 164 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 165 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 166 | # and can be added to the global gitignore or merged into this file. For a more nuclear 167 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 168 | #.idea/ 169 | 170 | # PyPI configuration file 171 | .pypirc 172 | -------------------------------------------------------------------------------- /.github/workflows/builder.yaml: -------------------------------------------------------------------------------- 1 | name: Builder 2 | 3 | env: 4 | BUILD_ARGS: "--test" 5 | MONITORED_FILES: "build.yaml config.yaml Dockerfile rootfs" 6 | 7 | on: 8 | push: 9 | branches: 10 | - main 11 | - develop 12 | pull_request: 13 | branches: 14 | - main 15 | - develop 16 | 17 | jobs: 18 | init: 19 | runs-on: ubuntu-latest 20 | name: Initialize builds 21 | outputs: 22 | changed_addons: ${{ steps.changed_addons.outputs.addons }} 23 | changed: ${{ steps.changed_addons.outputs.changed }} 24 | steps: 25 | - name: Check out the repository 26 | uses: actions/checkout@v4.2.2 27 | with: 28 | submodules: recursive 29 | 30 | - name: Get changed files 31 | id: changed_files 32 | uses: jitterbit/get-changed-files@v1 33 | 34 | - name: Find add-on directories 35 | id: addons 36 | uses: home-assistant/actions/helpers/find-addons@master 37 | 38 | - name: Get changed add-ons 39 | id: changed_addons 40 | run: | 41 | declare -a changed_addons 42 | for addon in ${{ steps.addons.outputs.addons }}; do 43 | if [[ "${{ steps.changed_files.outputs.all }}" =~ $addon ]]; then 44 | for file in ${{ env.MONITORED_FILES }}; do 45 | if [[ "${{ steps.changed_files.outputs.all }}" =~ $addon/$file ]]; then 46 | if [[ ! "${changed_addons[@]}" =~ $addon ]]; then 47 | changed_addons+=("\"${addon}\","); 48 | fi 49 | fi 50 | done 51 | fi 52 | done 53 | 54 | changed=$(echo ${changed_addons[@]} | rev | cut -c 2- | rev) 55 | 56 | if [[ -n ${changed} ]]; then 57 | echo "Changed add-ons: $changed"; 58 | echo "changed=true" >> $GITHUB_OUTPUT; 59 | echo "addons=[$changed]" >> $GITHUB_OUTPUT; 60 | else 61 | echo "No add-on had any monitored files changed (${{ env.MONITORED_FILES }})"; 62 | fi 63 | build: 64 | needs: init 65 | runs-on: ubuntu-latest 66 | if: needs.init.outputs.changed == 'true' 67 | name: Build ${{ matrix.arch }} ${{ matrix.addon }} add-on 68 | strategy: 69 | matrix: 70 | addon: ${{ fromJson(needs.init.outputs.changed_addons) }} 71 | arch: ["aarch64", "amd64", "armhf", "armv7", "i386"] 72 | permissions: 73 | contents: read 74 | packages: write 75 | 76 | steps: 77 | - name: Check out repository 78 | uses: actions/checkout@v4.2.2 79 | with: 80 | submodules: recursive 81 | 82 | - name: Get information 83 | id: info 84 | uses: home-assistant/actions/helpers/info@master 85 | with: 86 | path: "./${{ matrix.addon }}" 87 | 88 | - name: Check if add-on should be built 89 | id: check 90 | run: | 91 | if [[ "${{ steps.info.outputs.image }}" == "null" ]]; then 92 | echo "Image property is not defined, skipping build" 93 | echo "build_arch=false" >> $GITHUB_OUTPUT; 94 | elif [[ "${{ steps.info.outputs.architectures }}" =~ ${{ matrix.arch }} ]]; then 95 | echo "build_arch=true" >> $GITHUB_OUTPUT; 96 | echo "image=$(echo ${{ steps.info.outputs.image }} | cut -d'/' -f3)" >> $GITHUB_OUTPUT; 97 | if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then 98 | echo "BUILD_ARGS=" >> $GITHUB_ENV; 99 | fi 100 | else 101 | echo "${{ matrix.arch }} is not a valid arch for ${{ matrix.addon }}, skipping build"; 102 | echo "build_arch=false" >> $GITHUB_OUTPUT; 103 | fi 104 | 105 | - name: Login to GitHub Container Registry 106 | if: env.BUILD_ARGS != '--test' 107 | uses: docker/login-action@v3.4.0 108 | with: 109 | registry: ghcr.io 110 | username: ${{ github.repository_owner }} 111 | password: ${{ secrets.GITHUB_TOKEN }} 112 | 113 | - name: Build ${{ matrix.addon }} add-on 114 | if: steps.check.outputs.build_arch == 'true' 115 | uses: home-assistant/builder@2025.03.0 116 | with: 117 | args: | 118 | ${{ env.BUILD_ARGS }} \ 119 | --${{ matrix.arch }} \ 120 | --target /data/${{ matrix.addon }} \ 121 | --image "${{ steps.check.outputs.image }}" \ 122 | --docker-hub "ghcr.io/${{ github.repository_owner }}" \ 123 | --addon 124 | -------------------------------------------------------------------------------- /tests/prognose.http: -------------------------------------------------------------------------------- 1 | POST http://localhost:8503/optimize 2 | content-type: application/json 3 | 4 | { 5 | "ems": { 6 | "preis_euro_pro_wh_akku": 0.0001, 7 | "einspeiseverguetung_euro_pro_wh": 0.0000624, 8 | "gesamtlast": [ 9 | 676.71, 10 | 876.19, 11 | 527.13, 12 | 468.88, 13 | 531.38, 14 | 517.95, 15 | 483.15, 16 | 472.28, 17 | 1011.68, 18 | 995.00, 19 | 1053.07, 20 | 1063.91, 21 | 1320.56, 22 | 1132.03, 23 | 1163.67, 24 | 1176.82, 25 | 1216.22, 26 | 1103.78, 27 | 1129.12, 28 | 1178.71, 29 | 1050.98, 30 | 988.56, 31 | 912.38, 32 | 704.61, 33 | 516.37, 34 | 868.05, 35 | 694.34, 36 | 608.79, 37 | 556.31, 38 | 488.89, 39 | 506.91, 40 | 804.89, 41 | 1141.98, 42 | 1056.97, 43 | 992.46, 44 | 1155.99, 45 | 827.01, 46 | 1257.98, 47 | 1232.67, 48 | 871.26, 49 | 860.88, 50 | 1158.03, 51 | 1222.72, 52 | 1221.04, 53 | 949.99, 54 | 987.01, 55 | 733.99, 56 | 592.97 57 | ], 58 | "pv_prognose_wh": [ 59 | 676.71, 60 | 876.19, 61 | 527.13, 62 | 468.88, 63 | 531.38, 64 | 517.95, 65 | 483.15, 66 | 472.28, 67 | 1011.68, 68 | 995.00, 69 | 1053.07, 70 | 1063.91, 71 | 1320.56, 72 | 1132.03, 73 | 1163.67, 74 | 1176.82, 75 | 1216.22, 76 | 1103.78, 77 | 1129.12, 78 | 1178.71, 79 | 1050.98, 80 | 988.56, 81 | 912.38, 82 | 704.61, 83 | 516.37, 84 | 868.05, 85 | 694.34, 86 | 608.79, 87 | 556.31, 88 | 488.89, 89 | 506.91, 90 | 804.89, 91 | 1141.98, 92 | 1056.97, 93 | 992.46, 94 | 1155.99, 95 | 827.01, 96 | 1257.98, 97 | 1232.67, 98 | 871.26, 99 | 860.88, 100 | 1158.03, 101 | 1222.72, 102 | 1221.04, 103 | 949.99, 104 | 987.01, 105 | 733.99, 106 | 592.97 107 | ], 108 | "strompreis_euro_pro_wh": [ 109 | 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19, 110 | 20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35, 111 | 36,37,38,39,40,41,42,43,44,45,46,47,48 112 | ] 113 | }, 114 | "pv_akku": { 115 | "capacity_wh": 9700, 116 | "max_charge_power_w": 4000, 117 | "initial_soc_percentage": 50, 118 | "min_soc_percentage": 15 119 | }, 120 | "inverter": { 121 | "max_power_wh": 8500 122 | }, 123 | "eauto": { 124 | "capacity_wh": 27000, 125 | "charging_efficiency": 0.90, 126 | "discharging_efficiency": 0.95, 127 | "max_charge_power_w": 7360, 128 | "initial_soc_percentage": 50, 129 | "min_soc_percentage": 0 130 | }, 131 | 132 | "dishwasher": { 133 | "consumption_wh": 1500, 134 | "duration_h": 3 135 | }, 136 | "temperature_forecast": [ 137 | 18.3, 138 | 17.8, 139 | 16.9, 140 | 16.2, 141 | 15.6, 142 | 15.1, 143 | 14.6, 144 | 14.2, 145 | 14.3, 146 | 14.8, 147 | 15.7, 148 | 16.7, 149 | 17.4, 150 | 18.0, 151 | 18.6, 152 | 19.2, 153 | 19.1, 154 | 18.7, 155 | 18.5, 156 | 17.7, 157 | 16.2, 158 | 14.6, 159 | 13.6, 160 | 13.0, 161 | 12.6, 162 | 12.2, 163 | 11.7, 164 | 11.6, 165 | 11.3, 166 | 11.0, 167 | 10.7, 168 | 10.2, 169 | 11.4, 170 | 14.4, 171 | 16.4, 172 | 18.3, 173 | 19.5, 174 | 20.7, 175 | 21.9, 176 | 22.7, 177 | 23.1, 178 | 23.1, 179 | 22.8, 180 | 21.8, 181 | 20.2, 182 | 19.1, 183 | 18.0, 184 | 17.4 185 | ], 186 | "start_solution": null 187 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /eos/DOCS.md: -------------------------------------------------------------------------------- 1 | # Home Assistant EOS Add-on: 2 | 3 | ## Important note about upgrade to version 1.2 4 | 5 | **Due to various changes in the configuration file and the payload for the optimize call you need to adapt your automation and recreate your config!!!** 6 | 7 | See below for the updated example. 8 | 9 | **Only install one variant of the EOS addon, they would definitely interfere in the used ports and would share the same config file and output folder!** 10 | 11 | ## How to use 12 | 13 | ### Comfortable way 14 | 15 | Use [EOS Connect](https://github.com/ohAnd/EOS_connect) and configure it. 16 | 17 | The result will be a nice UI and a MQTT Enties that you can use to automate your home. Please read the docs of eos connect for more information. 18 | 19 | ### Manual way 20 | 21 | **Since Home Assistant version 2025.6 there is a new action available called "recorder.get_statistics", which makes the long term statistics available in e.g. automations. 22 | This means that the SQL sensors are not necessary anymore which makes the manual setup process a lot easier.** 23 | 24 | This add-on makes the [EOS web server](https://github.com/Akkudoktor-EOS/EOS) available as Home Assistant add-on at the defined port (default 8503). 25 | 26 | [Swagger API documentation](https://petstore3.swagger.io/?url=https://raw.githubusercontent.com/Akkudoktor-EOS/EOS/refs/heads/main/docs/akkudoktoreos/openapi.json) 27 | 28 | The optimization call can be used with the following rest command in the home assistant configuration.yaml: 29 | 30 | ```yaml 31 | rest_command: 32 | eos_optimize: 33 | url: http://localhost:8503/optimize 34 | method: POST 35 | content_type: application/json 36 | timeout: 120 37 | payload: "{{ payload }}" 38 | ``` 39 | 40 | and the following automation: 41 | 42 | ```yaml 43 | alias: EOS Prognose 44 | description: "" 45 | triggers: 46 | - trigger: time_pattern 47 | hours: /1 48 | minutes: "5" 49 | id: Stunde 50 | - trigger: homeassistant 51 | event: start 52 | id: Start 53 | conditions: [] 54 | actions: 55 | - if: 56 | - condition: trigger 57 | id: 58 | - Start 59 | then: 60 | - delay: 61 | hours: 0 62 | minutes: 2 63 | seconds: 0 64 | - action: recorder.get_statistics 65 | data: 66 | period: hour 67 | types: 68 | - state 69 | statistic_ids: 70 | - sensor.energie_ungesteuert_pro_stunde 71 | start_time: "{{ today_at() }}" 72 | response_variable: energie_ungesteuert_heute 73 | - action: recorder.get_statistics 74 | data: 75 | period: hour 76 | types: 77 | - state 78 | statistic_ids: 79 | - sensor.energie_ungesteuert_pro_stunde 80 | start_time: "{{ today_at() - timedelta(days=2) }}" 81 | end_time: "{{ today_at() }}" 82 | response_variable: energie_ungesteuert_historie 83 | - action: recorder.get_statistics 84 | data: 85 | period: hour 86 | types: 87 | - state 88 | statistic_ids: 89 | - sensor.energie_ungesteuert_pro_stunde 90 | start_time: "{{ today_at() - timedelta(days=7) }}" 91 | end_time: "{{ today_at() - timedelta(days=5) }}" 92 | response_variable: energie_ungesteuert_letzte_woche 93 | - action: python_script.hass_entities 94 | data: 95 | action: set_attributes 96 | entity_id: binary_sensor.eos_prognose 97 | attributes: 98 | - energie_ungesteuert_heute: >- 99 | {{ 100 | energie_ungesteuert_heute['statistics']['sensor.energie_ungesteuert_pro_stunde']| 101 | map(attribute='state') | list }} 102 | - energie_ungesteuert_historie: >- 103 | {{ 104 | energie_ungesteuert_historie['statistics']['sensor.energie_ungesteuert_pro_stunde']| 105 | map(attribute='state') | list }} 106 | - energie_ungesteuert_letzte_woche: >- 107 | {{ 108 | energie_ungesteuert_letzte_woche['statistics']['sensor.energie_ungesteuert_pro_stunde']| 109 | map(attribute='state') | list }} 110 | - variables: 111 | payload: |- 112 | { 113 | "ems": { 114 | "preis_euro_pro_wh_akku": 0.0001, 115 | "einspeiseverguetung_euro_pro_wh": 0.0000624, 116 | "gesamtlast": [ 117 | {{ ( state_attr('binary_sensor.eos_prognose', 'energie_ungesteuert_heute') 118 | + state_attr('binary_sensor.eos_prognose', 'energie_ungesteuert_letzte_woche')[ 119 | state_attr('binary_sensor.eos_prognose', 'energie_ungesteuert_heute')| length:48] 120 | + state_attr('binary_sensor.eos_prognose', 'energie_ungesteuert_historie')[ 121 | state_attr('binary_sensor.eos_prognose', 'energie_ungesteuert_letzte_woche')| length:48]) 122 | | join (', ') }} 123 | ], 124 | "pv_prognose_wh": [ 125 | {% for key, value in state_attr('sensor.energy_production_today_2', 126 | 'wh_period').items() -%} {{ value }}{%- if true %}, {% endif -%} {%- endfor 127 | %} {% for key, value in state_attr('sensor.energy_production_tomorrow_2', 128 | 'wh_period').items() -%} {{ value }}{%- if not loop.last %}, {% endif -%} 129 | {%- endfor %} 130 | ], 131 | "strompreis_euro_pro_wh": [ 132 | {% for value in state_attr('sensor.tibber_prices', 'today')[0:24] | 133 | map(attribute='total') -%} {{ value / 1000.0 }}{%- if true %}, {% endif -%} 134 | {%- endfor %}{%- if state_attr('sensor.tibber_prices', 'today') | length == 23 %}{{states('sensor.tibber_prices')| float(0) / 1000.0}}, {% endif -%} {%- if state_attr('sensor.tibber_prices', 'tomorrow') is none 135 | or state_attr('sensor.tibber_prices', 'tomorrow') | length == 0 %} {% for 136 | value in state_attr('sensor.epex_spot_data_net_price', 'data')[48:72] | 137 | map(attribute='price_per_kwh') -%} {{ value / 1000.0 }}{%- if not loop.last %}, {% 138 | endif -%} {%- endfor %} {%- else -%} {% for value in 139 | state_attr('sensor.tibber_prices', 'tomorrow')[0:24] | map(attribute='total') -%} 140 | {{ value / 1000.0 }}{%- if not loop.last %}, {% endif -%} {%- endfor %}{%- if state_attr('sensor.tibber_prices', 'tomorrow') | length == 23 %}, {{states('sensor.tibber_prices')| float(0) / 1000.0}}{% endif -%} {% 141 | endif %} 142 | ] 143 | }, 144 | "pv_akku": { 145 | "device_id": "battery1", 146 | "capacity_wh": 9700, 147 | "max_charge_power_w": 4000, 148 | "initial_soc_percentage": {{ states('sensor.scb_battery_soc') | int }}, 149 | "min_soc_percentage": 15 150 | }, 151 | "inverter": { 152 | "device_id": "inverter1", 153 | "max_power_wh": 8500, 154 | "battery_id": "battery1" 155 | }, 156 | "eauto": { 157 | "device_id": "ev1", 158 | "capacity_wh": 27000, 159 | "charging_efficiency": 0.90, 160 | "discharging_efficiency": 0.95, 161 | "max_charge_power_w": 7360, 162 | "initial_soc_percentage": {{ states('sensor.car_soc') | int }}, 163 | "min_soc_percentage": 0 164 | }, 165 | "dishwasher": { 166 | "device_id": "dishwasher1", 167 | "consumption_wh": 1500, 168 | "duration_h": 3 169 | }, 170 | "temperature_forecast": [ 171 | {{ state_attr('sensor.temperatur_vorschau', 'forecast') | map(attribute='temperature') | list | join (', ') }} 172 | ], 173 | "start_solution": null 174 | } 175 | - action: rest_command.eos_optimize 176 | data: 177 | payload: "{{ payload }}" 178 | response_variable: response 179 | - if: 180 | - condition: template 181 | value_template: "{{ response['status'] == 200 }}" 182 | then: 183 | - action: python_script.hass_entities 184 | data: 185 | action: set_state_attributes 186 | entity_id: binary_sensor.eos_prognose 187 | state: "on" 188 | attributes: 189 | - error: "" 190 | - ac_charge: "{{ response['content']['ac_charge'] }}" 191 | - dc_charge: "{{ response['content']['dc_charge'] }}" 192 | - discharge_allowed: "{{ response['content']['discharge_allowed'] }}" 193 | - eautocharge_hours_float: "{{ response['content']['eautocharge_hours_float'] }}" 194 | - result: "{{ response['content']['result'] }}" 195 | - eauto_obj: "{{ response['content']['eauto_obj'] }}" 196 | - start_solution: "{{ response['content']['start_solution'] }}" 197 | - washingstart: "{{ response['content']['washingstart'] }}" 198 | - action: automation.trigger 199 | target: 200 | entity_id: automation.hausakku_entladung_erlaubt 201 | data: 202 | skip_condition: true 203 | else: 204 | - action: python_script.hass_entities 205 | data: 206 | action: set_state_attributes 207 | entity_id: binary_sensor.eos_prognose 208 | state: "off" 209 | attributes: 210 | - error: "{{ response['returncode'] }}" 211 | - ac_charge: "" 212 | - dc_charge: "" 213 | - discharge_allowed: "" 214 | - eautocharge_hours_float: "" 215 | - result: "" 216 | - eauto_obj: "" 217 | - start_solution: "" 218 | - washingstart: "" 219 | mode: single 220 | ``` 221 | 222 | The sent payload does need to be adapted to your setup. 223 | 224 | 1. "gesamtlast": I'm using a template entity to calculate the power usage of all "uncontrolled" devices (so without wallbox, heating rod, washing machine, dryer, dishwasher) in W. Then an integration helper on top of it to calculate the Wh and a utility meter which resets every hour. This is used in the automation above to get the corresponding power usage per hour of the same two weekdays from last week (48 values). 225 | 2. "pv_prognose_wh": I'm using the [Open-Meteo Solar Forecast](https://github.com/rany2/ha-open-meteo-solar-forecast) HACS integration, which provides the estimated PV power per hour for today (sensor.energy_production_today_2) and tomorrow (sensor.energy_production_tomorrow_2). 226 | 3. "strompreis_euro_pro_wh": I'm using the tibber api with the sensor definition from here: . If the values for tomorrow aren't yet available, I'm using values from the [EPEX spot integration]. 227 | 4. The SOC entity from my PV battery is named "sensor.scb_battery_soc". 228 | 5. The SOC entity from my electric car is named "sensor.car_soc". 229 | 6. Another template sensor delivers the temperature forecast for today and tomorrow per hour, with the help of the [OpenWeatherMap integration](https://www.home-assistant.io/integrations/openweathermap/): 230 | 231 | ```yaml 232 | template: 233 | - trigger: 234 | - trigger: time_pattern 235 | hours: /1 236 | action: 237 | - action: weather.get_forecasts 238 | data: 239 | type: hourly 240 | target: 241 | area_id: system 242 | response_variable: hourly 243 | sensor: 244 | - name: Temperatur Vorschau 245 | unique_id: temperature_forecast 246 | state: "{{ hourly['weather.openweathermap'].forecast[0].temperature }}" 247 | unit_of_measurement: °C 248 | attributes: 249 | forecast: "{{ hourly['weather.openweathermap'].forecast }}" 250 | ``` 251 | 252 | To save the result for later usage (in at least the automation which dis-/allows discharging the PV battery = automation.hausakku_entladung_erlaubt), I used an empty template binary sensor: 253 | 254 | ```yaml 255 | template: 256 | - binary_sensor: 257 | - unique_id: eos_prognose 258 | name: EOS Prognose 259 | device_class: occupancy 260 | state: "" 261 | ``` 262 | 263 | and the python script [hass_entities](https://github.com/pmazz/ps_hassio_entities). The installation through HACS of that script didn't work for me anymore (incompatibility with HACS version >= 2.0). I had to manually download the script and register it in my configuration.yaml. 264 | 265 | This setup isn't easy to replicate, but there is a lot of information needed for a good decision and I'm quite happy with it up to now. 266 | 267 | ## Configuration 268 | 269 | The config file for EOS is stored in the home assistant config in the /config/eos/EOS.config.json file and can be adapted there. The folder and file is created, when the add-on was at least started once. The add-on needs to be restarted for the changes to have an effect. 270 | 271 | ## Visualization Result PDF 272 | 273 | The visualization results PDF file is stored under /share/eos/visualization_results.pdf. 274 | -------------------------------------------------------------------------------- /eos_local_build/DOCS.md: -------------------------------------------------------------------------------- 1 | # Home Assistant EOS local build Add-on: 2 | 3 | ## Important note about upgrade to version 1.2 4 | 5 | **Due to various changes in the configuration file and the payload for the optimize call you need to adapt your automation and recreate your config!!!** 6 | 7 | See below for the updated example. 8 | 9 | **Only install one variant of the EOS addon, they would definitely interfere in the used ports and would share the same config file and output folder!** 10 | 11 | ## How to use 12 | 13 | ### Comfortable way 14 | 15 | Use [EOS Connect](https://github.com/ohAnd/EOS_connect) and configure it. 16 | 17 | The result will be a nice UI and a MQTT Enties that you can use to automate your home. Please read the docs of eos connect for more information. 18 | 19 | ### Manual way 20 | 21 | **Since Home Assistant version 2025.6 there is a new action available called "recorder.get_statistics", which makes the long term statistics available in e.g. automations. 22 | This means that the SQL sensors are not necessary anymore which makes the manual setup process a lot easier.** 23 | 24 | This add-on makes the [EOS web server](https://github.com/Akkudoktor-EOS/EOS) available as Home Assistant add-on at the defined port (default 8503). 25 | 26 | [Swagger API documentation](https://petstore3.swagger.io/?url=https://raw.githubusercontent.com/Akkudoktor-EOS/EOS/refs/heads/main/docs/akkudoktoreos/openapi.json) 27 | 28 | The optimization call can be used with the following rest command in the home assistant configuration.yaml: 29 | 30 | ```yaml 31 | rest_command: 32 | eos_optimize: 33 | url: http://localhost:8503/optimize 34 | method: POST 35 | content_type: application/json 36 | timeout: 120 37 | payload: "{{ payload }}" 38 | ``` 39 | 40 | and the following automation: 41 | 42 | ```yaml 43 | alias: EOS Prognose 44 | description: "" 45 | triggers: 46 | - trigger: time_pattern 47 | hours: /1 48 | minutes: "5" 49 | id: Stunde 50 | - trigger: homeassistant 51 | event: start 52 | id: Start 53 | conditions: [] 54 | actions: 55 | - if: 56 | - condition: trigger 57 | id: 58 | - Start 59 | then: 60 | - delay: 61 | hours: 0 62 | minutes: 2 63 | seconds: 0 64 | - action: recorder.get_statistics 65 | data: 66 | period: hour 67 | types: 68 | - state 69 | statistic_ids: 70 | - sensor.energie_ungesteuert_pro_stunde 71 | start_time: "{{ today_at() }}" 72 | response_variable: energie_ungesteuert_heute 73 | - action: recorder.get_statistics 74 | data: 75 | period: hour 76 | types: 77 | - state 78 | statistic_ids: 79 | - sensor.energie_ungesteuert_pro_stunde 80 | start_time: "{{ today_at() - timedelta(days=2) }}" 81 | end_time: "{{ today_at() }}" 82 | response_variable: energie_ungesteuert_historie 83 | - action: recorder.get_statistics 84 | data: 85 | period: hour 86 | types: 87 | - state 88 | statistic_ids: 89 | - sensor.energie_ungesteuert_pro_stunde 90 | start_time: "{{ today_at() - timedelta(days=7) }}" 91 | end_time: "{{ today_at() - timedelta(days=5) }}" 92 | response_variable: energie_ungesteuert_letzte_woche 93 | - action: python_script.hass_entities 94 | data: 95 | action: set_attributes 96 | entity_id: binary_sensor.eos_prognose 97 | attributes: 98 | - energie_ungesteuert_heute: >- 99 | {{ 100 | energie_ungesteuert_heute['statistics']['sensor.energie_ungesteuert_pro_stunde']| 101 | map(attribute='state') | list }} 102 | - energie_ungesteuert_historie: >- 103 | {{ 104 | energie_ungesteuert_historie['statistics']['sensor.energie_ungesteuert_pro_stunde']| 105 | map(attribute='state') | list }} 106 | - energie_ungesteuert_letzte_woche: >- 107 | {{ 108 | energie_ungesteuert_letzte_woche['statistics']['sensor.energie_ungesteuert_pro_stunde']| 109 | map(attribute='state') | list }} 110 | - variables: 111 | payload: |- 112 | { 113 | "ems": { 114 | "preis_euro_pro_wh_akku": 0.0001, 115 | "einspeiseverguetung_euro_pro_wh": 0.0000624, 116 | "gesamtlast": [ 117 | {{ ( state_attr('binary_sensor.eos_prognose', 'energie_ungesteuert_heute') 118 | + state_attr('binary_sensor.eos_prognose', 'energie_ungesteuert_letzte_woche')[ 119 | state_attr('binary_sensor.eos_prognose', 'energie_ungesteuert_heute')| length:48] 120 | + state_attr('binary_sensor.eos_prognose', 'energie_ungesteuert_historie')[ 121 | state_attr('binary_sensor.eos_prognose', 'energie_ungesteuert_letzte_woche')| length:48]) 122 | | join (', ') }} 123 | ], 124 | "pv_prognose_wh": [ 125 | {% for key, value in state_attr('sensor.energy_production_today_2', 126 | 'wh_period').items() -%} {{ value }}{%- if true %}, {% endif -%} {%- endfor 127 | %} {% for key, value in state_attr('sensor.energy_production_tomorrow_2', 128 | 'wh_period').items() -%} {{ value }}{%- if not loop.last %}, {% endif -%} 129 | {%- endfor %} 130 | ], 131 | "strompreis_euro_pro_wh": [ 132 | {% for value in state_attr('sensor.tibber_prices', 'today')[0:24] | 133 | map(attribute='total') -%} {{ value / 1000.0 }}{%- if true %}, {% endif -%} 134 | {%- endfor %}{%- if state_attr('sensor.tibber_prices', 'today') | length == 23 %}{{states('sensor.tibber_prices')| float(0) / 1000.0}}, {% endif -%} {%- if state_attr('sensor.tibber_prices', 'tomorrow') is none 135 | or state_attr('sensor.tibber_prices', 'tomorrow') | length == 0 %} {% for 136 | value in state_attr('sensor.epex_spot_data_net_price', 'data')[48:72] | 137 | map(attribute='price_per_kwh') -%} {{ value / 1000.0 }}{%- if not loop.last %}, {% 138 | endif -%} {%- endfor %} {%- else -%} {% for value in 139 | state_attr('sensor.tibber_prices', 'tomorrow')[0:24] | map(attribute='total') -%} 140 | {{ value / 1000.0 }}{%- if not loop.last %}, {% endif -%} {%- endfor %}{%- if state_attr('sensor.tibber_prices', 'tomorrow') | length == 23 %}, {{states('sensor.tibber_prices')| float(0) / 1000.0}}{% endif -%} {% 141 | endif %} 142 | ] 143 | }, 144 | "pv_akku": { 145 | "device_id": "battery1", 146 | "capacity_wh": 9700, 147 | "max_charge_power_w": 4000, 148 | "initial_soc_percentage": {{ states('sensor.scb_battery_soc') | int }}, 149 | "min_soc_percentage": 15 150 | }, 151 | "inverter": { 152 | "device_id": "inverter1", 153 | "max_power_wh": 8500, 154 | "battery_id": "battery1" 155 | }, 156 | "eauto": { 157 | "device_id": "ev1", 158 | "capacity_wh": 27000, 159 | "charging_efficiency": 0.90, 160 | "discharging_efficiency": 0.95, 161 | "max_charge_power_w": 7360, 162 | "initial_soc_percentage": {{ states('sensor.car_soc') | int }}, 163 | "min_soc_percentage": 0 164 | }, 165 | "dishwasher": { 166 | "device_id": "dishwasher1", 167 | "consumption_wh": 1500, 168 | "duration_h": 3 169 | }, 170 | "temperature_forecast": [ 171 | {{ state_attr('sensor.temperatur_vorschau', 'forecast') | map(attribute='temperature') | list | join (', ') }} 172 | ], 173 | "start_solution": null 174 | } 175 | - action: rest_command.eos_optimize 176 | data: 177 | payload: "{{ payload }}" 178 | response_variable: response 179 | - if: 180 | - condition: template 181 | value_template: "{{ response['status'] == 200 }}" 182 | then: 183 | - action: python_script.hass_entities 184 | data: 185 | action: set_state_attributes 186 | entity_id: binary_sensor.eos_prognose 187 | state: "on" 188 | attributes: 189 | - error: "" 190 | - ac_charge: "{{ response['content']['ac_charge'] }}" 191 | - dc_charge: "{{ response['content']['dc_charge'] }}" 192 | - discharge_allowed: "{{ response['content']['discharge_allowed'] }}" 193 | - eautocharge_hours_float: "{{ response['content']['eautocharge_hours_float'] }}" 194 | - result: "{{ response['content']['result'] }}" 195 | - eauto_obj: "{{ response['content']['eauto_obj'] }}" 196 | - start_solution: "{{ response['content']['start_solution'] }}" 197 | - washingstart: "{{ response['content']['washingstart'] }}" 198 | - action: automation.trigger 199 | target: 200 | entity_id: automation.hausakku_entladung_erlaubt 201 | data: 202 | skip_condition: true 203 | else: 204 | - action: python_script.hass_entities 205 | data: 206 | action: set_state_attributes 207 | entity_id: binary_sensor.eos_prognose 208 | state: "off" 209 | attributes: 210 | - error: "{{ response['returncode'] }}" 211 | - ac_charge: "" 212 | - dc_charge: "" 213 | - discharge_allowed: "" 214 | - eautocharge_hours_float: "" 215 | - result: "" 216 | - eauto_obj: "" 217 | - start_solution: "" 218 | - washingstart: "" 219 | mode: single 220 | ``` 221 | 222 | The sent payload does need to be adapted to your setup. 223 | 224 | 1. "gesamtlast": I'm using a template entity to calculate the power usage of all "uncontrolled" devices (so without wallbox, heating rod, washing machine, dryer, dishwasher) in W. Then an integration helper on top of it to calculate the Wh and a utility meter which resets every hour. This is used in the automation above to get the corresponding power usage per hour of the same two weekdays from last week (48 values). 225 | 2. "pv_prognose_wh": I'm using the [Open-Meteo Solar Forecast](https://github.com/rany2/ha-open-meteo-solar-forecast) HACS integration, which provides the estimated PV power per hour for today (sensor.energy_production_today_2) and tomorrow (sensor.energy_production_tomorrow_2). 226 | 3. "strompreis_euro_pro_wh": I'm using the tibber api with the sensor definition from here: . If the values for tomorrow aren't yet available, I'm using values from the [EPEX spot integration]. 227 | 4. The SOC entity from my PV battery is named "sensor.scb_battery_soc". 228 | 5. The SOC entity from my electric car is named "sensor.car_soc". 229 | 6. Another template sensor delivers the temperature forecast for today and tomorrow per hour, with the help of the [OpenWeatherMap integration](https://www.home-assistant.io/integrations/openweathermap/): 230 | 231 | ```yaml 232 | template: 233 | - trigger: 234 | - trigger: time_pattern 235 | hours: /1 236 | action: 237 | - action: weather.get_forecasts 238 | data: 239 | type: hourly 240 | target: 241 | area_id: system 242 | response_variable: hourly 243 | sensor: 244 | - name: Temperatur Vorschau 245 | unique_id: temperature_forecast 246 | state: "{{ hourly['weather.openweathermap'].forecast[0].temperature }}" 247 | unit_of_measurement: °C 248 | attributes: 249 | forecast: "{{ hourly['weather.openweathermap'].forecast }}" 250 | ``` 251 | 252 | To save the result for later usage (in at least the automation which dis-/allows discharging the PV battery = automation.hausakku_entladung_erlaubt), I used an empty template binary sensor: 253 | 254 | ```yaml 255 | template: 256 | - binary_sensor: 257 | - unique_id: eos_prognose 258 | name: EOS Prognose 259 | device_class: occupancy 260 | state: "" 261 | ``` 262 | 263 | and the python script [hass_entities](https://github.com/pmazz/ps_hassio_entities). The installation through HACS of that script didn't work for me anymore (incompatibility with HACS version >= 2.0). I had to manually download the script and register it in my configuration.yaml. 264 | 265 | This setup isn't easy to replicate, but there is a lot of information needed for a good decision and I'm quite happy with it up to now. 266 | 267 | ## Configuration 268 | 269 | The config file for EOS is stored in the home assistant config in the /config/eos/EOS.config.json file and can be adapted there. The folder and file is created, when the add-on was at least started once. The add-on needs to be restarted for the changes to have an effect. 270 | 271 | ## Visualization Result PDF 272 | 273 | The visualization results PDF file is stored under /share/eos/visualization_results.pdf. 274 | --------------------------------------------------------------------------------