diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0f5ab73d83..c61573b9e5 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -2,7 +2,7 @@ // README at: https://github.com/devcontainers/templates/tree/main/src/go { "name": "evcc", - "image": "mcr.microsoft.com/devcontainers/go", + "image": "mcr.microsoft.com/devcontainers/go:2-1.25-bookworm", "features": { "ghcr.io/devcontainers/features/docker-outside-of-docker:1": { "moby": false, diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..254224b3c1 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Automatically resolve conflicts in .github/workflows by keeping the current branch's version (ours) +.github/workflows/* merge=ours diff --git a/.github/workflows/_claude-issue-triage.yml_ b/.github/workflows/_claude-issue-triage.yml_ index 233418b1d6..2144318185 100644 --- a/.github/workflows/_claude-issue-triage.yml_ +++ b/.github/workflows/_claude-issue-triage.yml_ @@ -6,7 +6,7 @@ on: jobs: triage-issue: - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04 timeout-minutes: 10 permissions: contents: read diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index fe5a5ea109..a3cc43295f 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -10,7 +10,7 @@ on: jobs: clean: name: Clean - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04 permissions: contents: read @@ -50,7 +50,7 @@ jobs: build: name: Build - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04 permissions: contents: read @@ -88,7 +88,7 @@ jobs: test: name: Test - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04 permissions: contents: read @@ -119,7 +119,7 @@ jobs: lint: name: Lint - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04 permissions: contents: read @@ -161,7 +161,7 @@ jobs: permissions: contents: read actions: write - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 @@ -203,7 +203,7 @@ jobs: integration: name: Integration - runs-on: depot-ubuntu-24.04-arm-32 + runs-on: ubuntu-24.04 permissions: contents: read diff --git a/.github/workflows/docs-issue.yml b/.github/workflows/docs-issue.yml index 377e2762c7..0250942b8b 100644 --- a/.github/workflows/docs-issue.yml +++ b/.github/workflows/docs-issue.yml @@ -10,7 +10,7 @@ on: jobs: check-label-and-create-issue: - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04 if: github.event.pull_request.merged == true && github.event.pull_request.base.repo.full_name == github.event.pull_request.head.repo.full_name steps: - name: Check for 'needs documentation' label diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml deleted file mode 100644 index 1df5d9df3d..0000000000 --- a/.github/workflows/documentation.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Deploy updated templates - -on: - schedule: - - cron: "0 2 * * *" # same time as nightly is triggered - release: - types: [created] - workflow_dispatch: - -jobs: - docupdate: - name: Deploy updated templates - runs-on: depot-ubuntu-24.04-arm - - permissions: - contents: read - - steps: - - uses: actions/checkout@v6 - with: - persist-credentials: false - - - uses: actions/setup-go@v6 - with: - go-version-file: go.mod - id: go - - - name: Build docs - run: make install docs - - - name: Deploy to docs repo - uses: peaceiris/actions-gh-pages@v4 - with: - personal_token: ${{ secrets.DOCS_DEPLOY_TOKEN }} - publish_dir: ./templates/docs - external_repository: evcc-io/docs - publish_branch: main - destination_dir: ${{ github.event_name == 'release' && 'templates/release' || github.event_name == 'schedule' && 'templates/nightly' || 'templates/unknown_trigger' }} - allow_empty_commit: false - commit_message: ${{ github.event_name == 'release' && 'Templates update for release' || github.event_name == 'schedule' && 'Templates update for nightly' || 'Templates update unknown trigger' }} - if: success() - - openapi: - name: Deploy OpenAPI spec - runs-on: depot-ubuntu-24.04-arm - - permissions: - contents: read - - # run on release or manual trigger, but not on schedule - if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' - - steps: - - uses: actions/checkout@v6 - with: - persist-credentials: false - - - name: Prepare OpenAPI spec - run: | - mkdir -p ./openapi-deploy - cp ./server/openapi.yaml ./openapi-deploy/openapi.yaml - - - name: Deploy OpenAPI spec to docs repo - uses: peaceiris/actions-gh-pages@v4 - with: - personal_token: ${{ secrets.DOCS_DEPLOY_TOKEN }} - publish_dir: ./openapi-deploy - external_repository: evcc-io/docs - publish_branch: main - destination_dir: static - allow_empty_commit: false - commit_message: Update OpenAPI spec - keep_files: true - if: success() diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index ae749d82de..d56ac11bac 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -1,63 +1,68 @@ name: Nightly Build permissions: contents: read + packages: write on: schedule: # runs on the default branch: master - - cron: "0 2 * * *" # run at 2 AM UTC + - cron: "10 20 * * *" # run at 6:10 AM workflow_dispatch: jobs: - check_date: - runs-on: depot-ubuntu-24.04-arm - name: Check latest commit - - permissions: - contents: read - outputs: - should_run: ${{ steps.should_run.outputs.should_run }} - steps: - - uses: actions/checkout@v6 - with: - persist-credentials: false - - name: print latest_commit - run: echo ${{ github.sha }} - - - id: should_run - continue-on-error: true - name: check latest commit is less than a day - if: ${{ github.event_name == 'schedule' }} - run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "should_run=false" >> $GITHUB_OUTPUT - - call-build-workflow: - name: Call Build - needs: check_date - if: | - ${{ needs.check_date.outputs.should_run != 'false' }} - && startsWith(github.ref, 'refs/heads/master') - && ! contains(github.head_ref, 'refs/heads/chore/') - uses: evcc-io/evcc/.github/workflows/default.yml@master - permissions: - contents: read - actions: write + # check_date: + # runs-on: ubuntu-latest + # name: Check latest commit + # outputs: + # should_run: ${{ steps.should_run.outputs.should_run }} + # steps: + # - uses: actions/checkout@v4 + # - name: print latest_commit + # run: echo ${{ github.sha }} + + # - id: should_run + # continue-on-error: true + # name: check latest commit is less than a day + # if: ${{ github.event_name == 'schedule' }} + # run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "should_run=false" >> $GITHUB_OUTPUT + + # call-build-workflow: + # name: Call Build + # needs: check_date + # if: | + # ${{ needs.check_date.outputs.should_run != 'false' }} + # && startsWith(github.ref, 'refs/heads/master') + # && ! contains(github.head_ref, 'refs/heads/chore/') + # uses: evcc-io/evcc/.github/workflows/default.yml@master docker: name: Publish Docker :nightly - needs: - - call-build-workflow - runs-on: depot-ubuntu-24.04-arm + # needs: + # - call-build-workflow + runs-on: ubuntu-latest permissions: contents: read actions: read + packages: write steps: - uses: actions/checkout@v6 with: - ref: refs/heads/master # force master + ref: refs/heads/evcc-master # force master fetch-depth: 0 persist-credentials: false + - name: Set up Git + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + + - name: Merge our master branch into evcc-master for building + run: | + git merge origin/master --no-commit --no-ff || true + git reset -- .github/workflows + git commit -m "merge from evcc/master" + - name: Get dist from cache uses: actions/cache/restore@v5 id: cache-dist @@ -68,8 +73,9 @@ jobs: - name: Login uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Setup Buildx uses: docker/setup-buildx-action@v3 @@ -78,7 +84,7 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: evcc/evcc + images: ghcr.io/jeffborg/evcc tags: | type=raw,value=nightly type=raw,value=nightly.{{date 'YYYYMMDD'}}-{{sha}} @@ -93,93 +99,17 @@ jobs: cache-from: type=gha cache-to: type=gha,mode=max - - name: Delete old nightly.* tags - run: | - old_tags=$(curl -s "https://hub.docker.com/v2/repositories/evcc/evcc/tags/?page_size=100" | jq -r '.results | map(select(.name | startswith("nightly."))) | sort_by(.last_updated) | reverse | .[1:] | .[].name') - for tag in $old_tags; do - echo "Deleting tag: $tag" - curl -s -H "Authorization: Bearer ${{ secrets.DOCKER_PASS }}" -X DELETE "https://hub.docker.com/v2/repositories/evcc/evcc/tags/$tag/" - done - - hassio: - name: Hassio Addon :nightly - needs: - - docker - runs-on: depot-ubuntu-24.04-arm - - permissions: - contents: read - - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - repository: evcc-io/hassio-addon - token: ${{ secrets.HASSIO_DEPLOY_TOKEN }} - path: ./hassio - - - name: Update version - run: | - current_date=$(date +%Y%m%d) - short_sha=$(echo "${{ github.sha }}" | cut -c 1-7) - sed -i -e "s/version:.*/version: nightly.${current_date}-${short_sha}/" ./hassio/evcc-nightly/config.yaml - - - name: Push - run: | - cd ./hassio - git add . - git config user.name github-actions - git config user.email github-actions@github.com - git commit -am "Mirror evcc nightly release" - git push - - apt: - name: Publish APT nightly - needs: - - call-build-workflow - runs-on: depot-ubuntu-24.04-arm - - permissions: - contents: read - actions: read - - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - persist-credentials: false - - - uses: actions/setup-go@v6 - with: - go-version-file: go.mod - id: go - - - name: Patch ASN1 - run: make patch-asn1-sudo - - - name: Get dist from cache - uses: actions/cache/restore@v5 - id: cache-dist - with: - path: dist - key: ${{ runner.os }}-${{ github.sha }}-dist - - - name: Create nightly build - uses: goreleaser/goreleaser-action@v6 - with: - version: '~> v2' - args: --snapshot -f .goreleaser-nightly.yml --clean + - name: Delete old nightly.* tags from GHCR env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - uses: actions/setup-python@v6 - with: - python-version: 3.12 + GHCR_USERNAME: ${{ github.actor }} + GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Or use a PAT with 'write:packages' scope + run: | + repo="ghcr.io/jeffborg/evcc" + tags=$(curl -s -H "Authorization: Bearer $GHCR_TOKEN" "https://api.github.com/users/jeffborg/packages/container/evcc/versions" | jq -r '.[] | select(.metadata.container.tags[] | startswith("nightly.")) | {id: .id, updated_at: .updated_at} | @base64') - - name: Install Cloudsmith CLI - run: pip install --upgrade cloudsmith-cli + sorted_tags=$(echo "$tags" | base64 --decode | jq -s 'sort_by(.updated_at) | reverse | .[2:]') - - name: Publish .deb to Cloudsmith - env: - CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} - run: make apt-nightly + for tag in $(echo "$sorted_tags" | jq -r '.[].id'); do + echo "Deleting tag ID: $tag" + curl -s -X DELETE -H "Authorization: Bearer $GHCR_TOKEN" "https://api.github.com/users/jeffborg/packages/container/evcc/versions/$tag" + done diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 98aac6c762..9c464262f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,7 +11,7 @@ on: jobs: call-build-workflow: if: startsWith(github.ref, 'refs/tags') - uses: evcc-io/evcc/.github/workflows/default.yml@master + uses: jeffborg/evcc/.github/workflows/default.yml@master permissions: contents: read actions: write @@ -20,9 +20,10 @@ jobs: name: Publish Docker :release needs: - call-build-workflow - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04 permissions: contents: read + packages: write steps: - uses: actions/checkout@v6 @@ -33,8 +34,9 @@ jobs: - name: Login uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_PASS }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Setup Buildx uses: docker/setup-buildx-action@v3 @@ -44,7 +46,7 @@ jobs: uses: docker/metadata-action@v5 with: images: | - evcc/evcc + ghcr.io/jeffborg/evcc - name: Publish uses: docker/build-push-action@v6 @@ -55,118 +57,3 @@ jobs: build-args: | RELEASE=1 tags: ${{ steps.meta.outputs.tags }} - - apt: - name: Github & APT - needs: - - call-build-workflow - runs-on: depot-ubuntu-24.04-arm - - permissions: - contents: write - actions: read - - steps: - - uses: actions/checkout@v6 - with: - fetch-depth: 0 - persist-credentials: false - - - name: Setup Go - uses: actions/setup-go@v6 - with: - go-version-file: go.mod - id: go - - - name: Patch ASN1 - run: make patch-asn1-sudo - - - name: Get dist from cache - uses: actions/cache/restore@v5 - id: cache-dist - with: - path: dist - key: ${{ runner.os }}-${{ github.sha }}-dist - - # gokrazy image - # - name: Prepare Image - # run: | - # make prepare-image - # sed -i -e 's#-ld.*$#& -X github.com/evcc-io/evcc/server/updater.Password=${{ secrets.IMAGE_PASS }}#' buildflags/github.com/evcc-io/evcc/buildflags.txt - # mkdir /home/runner/.config/gokrazy - # echo ${{ secrets.IMAGE_PASS }}> /home/runner/.config/gokrazy/http-password.txt - - # - name: Build Image - # run: make image - - # - name: Build Root Filesystem - # run: make image-rootfs - - - name: Create Github Release - uses: goreleaser/goreleaser-action@v6 - with: - version: '~> v2' - args: release --clean - env: - # use RELEASE_DEPLOY_TOKEN for access to evcc-io/homebrew-tap - GITHUB_TOKEN: ${{ secrets.RELEASE_DEPLOY_TOKEN }} - - - uses: actions/setup-python@v6 - with: - python-version: 3.12 - - - name: Install Cloudsmith CLI - run: pip install --upgrade cloudsmith-cli - - - name: Publish .deb to Cloudsmith - env: - CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} - run: make apt-release - - demo: - name: Demo - needs: - - docker - runs-on: depot-ubuntu-24.04-arm - - permissions: - contents: read - - env: - FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} - steps: - - uses: actions/checkout@v6 - with: - persist-credentials: false - - uses: superfly/flyctl-actions/setup-flyctl@master - - run: flyctl deploy --local-only --config packaging/fly.toml - - hassio: - name: Hassio Addon - needs: - - docker - runs-on: depot-ubuntu-24.04-arm - - permissions: - contents: read - - steps: - - name: Checkout - uses: actions/checkout@master - with: - repository: evcc-io/hassio-addon - token: ${{ secrets.HASSIO_DEPLOY_TOKEN }} - path: ./hassio - - - name: Update version - run: | - sed -i -e s#version.*#version\:\ $(echo ${{ github.ref }} | sed -e s#refs/tags/##)# ./hassio/evcc/config.yaml - - - name: Push - run: | - cd ./hassio - git add . - git config user.name github-actions - git config user.email github-actions@github.com - git commit -am "Mirror evcc release" - git push diff --git a/.github/workflows/schema.yml b/.github/workflows/schema.yml index 4b11c97f3a..19aa9e3e3a 100644 --- a/.github/workflows/schema.yml +++ b/.github/workflows/schema.yml @@ -12,7 +12,7 @@ on: jobs: build: - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04 permissions: contents: read diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml index f08a3bf479..291bd4180e 100644 --- a/.github/workflows/stale.yaml +++ b/.github/workflows/stale.yaml @@ -13,7 +13,7 @@ jobs: contents: read issues: write pull-requests: write - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04 steps: - uses: actions/stale@v10 id: stale diff --git a/.github/workflows/sync-tags-pr.yml b/.github/workflows/sync-tags-pr.yml new file mode 100644 index 0000000000..6bb1ab2e70 --- /dev/null +++ b/.github/workflows/sync-tags-pr.yml @@ -0,0 +1,61 @@ +name: Sync taggs Finalize Tagging + +on: + pull_request: + types: + - closed + workflow_dispatch: # Allows manual trigger of the workflow + +jobs: + finalize: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Fetch all branches and tags + token: ${{ secrets.EVCC_PAT }} + + - name: Set up Git + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + + - name: Get merged branch name + id: get-branch + run: echo "BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV + + - name: Validate branch name + id: validate-branch + run: | + # Extract the tag name from the branch name + TAG_NAME=$(echo "${{ env.BRANCH }}" | sed 's/tag-//') + + # Check if the tag name matches the expected pattern + if [[ ! "$TAG_NAME" =~ ^0\.[0-9]+\.[0-9]+$ ]]; then + echo "Branch name does not match the expected pattern. Skipping tag creation." + exit 1 + else + echo "Valid branch name: $TAG_NAME Saving for next step" + echo "BRANCH=$TAG_NAME" >> $GITHUB_OUTPUT + fi + continue-on-error: true + + - name: Tag the merged branch + if: success() && steps.validate-branch.outcome == 'success' + run: | + # Checkout the branch that was merged + git checkout "${{ env.BRANCH }}" + + # Create the new tag + NEW_TAG="${{ steps.validate-branch.outputs.BRANCH }}.0" + + # Tag the branch + git tag "${NEW_TAG}" + + # Push the tag to the repository + git push origin "${NEW_TAG}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/sync-tags.yml b/.github/workflows/sync-tags.yml new file mode 100644 index 0000000000..3ebc51a37d --- /dev/null +++ b/.github/workflows/sync-tags.yml @@ -0,0 +1,98 @@ +name: Sync Missing Tags + +on: + schedule: + # Runs daily at 6am + - cron: "0 20 * * *" + workflow_dispatch: # Allows manual trigger + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Fetch all branches and tags + token: ${{ secrets.EVCC_PAT }} + + - name: Set up Git + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + + - name: Add public repo as remote + run: | + git remote add public https://github.com/evcc-io/evcc.git + + - name: Fetch tags from the public repo + run: | + git fetch public --tags + + - name: Get all tags from the public repo + id: get-public-tags + run: | + git tag -l | grep -E '^0\.[0-9]+\.[0-9]+$' > public_tags.txt + echo "Public tags:" + cat public_tags.txt + + - name: Get existing tags in the repo + id: get-existing-tags + run: | + git tag -l | grep -E '^0\.[0-9]+\.[0-9]+\.0$' > existing_tags.txt + echo "Existing tags:" + cat existing_tags.txt + + - name: Sync missing tags + run: | + # Define the starting tag + START_TAG="0.130.7" + + # Convert version to numeric format for comparison + tag_to_numeric() { + echo "$1" | sed 's/\./_/g' | awk -F'_' '{ printf("%d%03d%03d", $1, $2, $3) }' + } + + START_NUMERIC=$(tag_to_numeric $START_TAG) + + # Read tags from files + PUBLIC_TAGS=$(cat public_tags.txt) + EXISTING_TAGS=$(cat existing_tags.txt) + + for TAG in $PUBLIC_TAGS; do + # Convert the current tag to numeric format + TAG_NUMERIC=$(tag_to_numeric $TAG) + + # Check if the tag is greater than the starting tag + if [ "$TAG_NUMERIC" -gt "$START_NUMERIC" ]; then + # Generate the new tag name with .0 suffix + NEW_TAG="${TAG}.0" + + # Check if the tag already exists + if ! echo "$EXISTING_TAGS" | grep -q "^${NEW_TAG}$"; then + echo "Processing new tag: $NEW_TAG" + + # Create a new branch for the tag + git checkout -b "tag-${TAG}" ${TAG} + + # Attempt to merge the master branch into the new branch + git merge master --no-edit || { + # If there's a merge conflict, create a pull request + echo "Merge conflict detected for tag ${TAG}. Creating pull request." + git push origin "tag-${TAG}" + gh pr create --title "Resolve merge conflict for tag ${NEW_TAG}" --body "A merge conflict was detected while syncing tag ${NEW_TAG}. Please resolve the conflict in this PR." --head master --base "tag-${TAG}" + continue + } + # Tag the branch with .0 appended to the original tag name + git tag "${NEW_TAG}" + + # Push the new branch and tag to your repository + git push origin "tag-${TAG}" + git push origin "${NEW_TAG}" + fi + fi + done + + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml new file mode 100644 index 0000000000..ba4231a0e0 --- /dev/null +++ b/.github/workflows/sync-upstream.yml @@ -0,0 +1,44 @@ +name: Sync evcc master Repo Branch + +on: + schedule: + # Run the workflow daily at 6am + - cron: "0 20 * * *" + workflow_dispatch: # Allows manual trigger of the workflow + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout the repository + uses: actions/checkout@v3 + with: + # Fetch all branches + fetch-depth: 0 + token: ${{ secrets.EVCC_PAT }} + + - name: Set up Git + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + + - name: Add public repo as remote + run: | + git remote add public https://github.com/evcc-io/evcc.git + + - name: Fetch master branch from public repo + run: | + git fetch public master + + - name: Checkout evcc-master branch + run: | + git checkout evcc-master + + - name: Merge master branch from public repo into evcc-master + run: | + git merge public/master --no-edit + + - name: Push changes to evcc-master + run: | + git push origin evcc-master diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 6074e416ec..df876ae5ee 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -10,7 +10,7 @@ on: jobs: brandupdate: name: Deploy data to website - runs-on: depot-ubuntu-24.04-arm + runs-on: ubuntu-24.04 permissions: contents: read diff --git a/core/loadpoint_effective.go b/core/loadpoint_effective.go index 49d1b74612..4bf620313a 100644 --- a/core/loadpoint_effective.go +++ b/core/loadpoint_effective.go @@ -224,9 +224,9 @@ func (lp *Loadpoint) EffectiveMaxPower() float64 { lp.RLock() defer lp.RUnlock() - if circuitMaxPower := circuitMaxPower(lp.circuit); circuitMaxPower > 0 { - return min(lp.effectiveMaxPower(), circuitMaxPower) - } + // if circuitMaxPower := circuitMaxPower(lp.circuit); circuitMaxPower > 0 { + // return min(lp.effectiveMaxPower(), circuitMaxPower) + // } return lp.effectiveMaxPower() } diff --git a/core/loadpoint_plan.go b/core/loadpoint_plan.go index 13513f33ae..194b7d1c15 100644 --- a/core/loadpoint_plan.go +++ b/core/loadpoint_plan.go @@ -12,6 +12,11 @@ import ( "github.com/evcc-io/evcc/tariff" ) +const ( + smallSlotDuration = 4 * time.Minute // small planner slot duration we might ignore + smallGapDuration = 15 * time.Minute // small gap duration between planner slots we might ignore +) + // TODO planActive is not guarded by mutex // setPlanActive updates plan active flag @@ -184,15 +189,15 @@ func (lp *Loadpoint) plannerActive() (active bool) { // TODO check when schedule is implemented lp.log.DEBUG.Println("plan: continuing after target time") return true - case lp.clock.Now().Before(lp.planSlotEnd) && !lp.planSlotEnd.IsZero(): - // don't stop an already running slot if goal was not met - lp.log.DEBUG.Printf("plan: continuing until end of slot at %s", lp.planSlotEnd.Round(time.Second).Local()) - return true - case requiredDuration < tariff.SlotDuration: + // case lp.clock.Now().Before(lp.planSlotEnd) && !lp.planSlotEnd.IsZero(): + // don't stop an already running slot if goal was not met + // lp.log.DEBUG.Printf("plan: continuing until end of slot at %s", lp.planSlotEnd.Round(time.Second).Local()) + // return active + case requiredDuration < smallSlotDuration: lp.log.DEBUG.Printf("plan: continuing for remaining %v", requiredDuration.Round(time.Second)) return true - case lp.clock.Until(planStart) < tariff.SlotDuration: - lp.log.DEBUG.Printf("plan: avoid re-start within %v, continuing for remaining %v", tariff.SlotDuration, lp.clock.Until(planStart).Round(time.Second)) + case lp.clock.Until(planStart) < smallGapDuration: + lp.log.DEBUG.Printf("plan: avoid re-start within %v, continuing for remaining %v", smallGapDuration, lp.clock.Until(planStart).Round(time.Second)) return true } } diff --git a/core/site.go b/core/site.go index 6ce1a57445..f078bfba30 100644 --- a/core/site.go +++ b/core/site.go @@ -1009,7 +1009,7 @@ func (site *Site) update(lp updater) { ) } - site.log.WARN.Println("planner:", msg) + site.log.INFO.Println("planner:", msg) } // update battery after reading meters to ensure that (modbus) connection is open