Skip to content

Fix some evcc issues #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{{- $url := .Info.RepositoryURL }}
{{ if .Versions -}}
<a name="unreleased"></a>
## [Unreleased]

{{ if .Unreleased.CommitGroups -}}
{{ range .Unreleased.CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]{{ else }}{{ .Tag.Name }}{{ end }} - {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}
{{ range .Commits -}}
- {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts
{{ range .RevertCommits -}}
- {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .MergeCommits -}}
### Pull Requests
{{ range .MergeCommits -}}
- {{ .Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}
{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}

{{- if .Versions }}
[Unreleased]: {{ .Info.RepositoryURL }}/compare/{{ $latest := index .Versions 0 }}{{ $latest.Tag.Name }}...HEAD
{{ range .Versions -}}
{{ if .Tag.Previous -}}
[{{ .Tag.Name }}]: {{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}
{{ end -}}
{{ end -}}
{{ end -}}
54 changes: 54 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/happytobi/warp
options:
tag_filter_pattern: '^v[0-9]+\.[0-9]+\.[0-9]+$'
sort: "date"

commits:
filters:
Type:
- feat
- fix
- perf
- refactor
- chore
- ci
- docs

commit_groups:
title_maps:
chore: Chores
ci: Continous Integration
docs: Documentation
feat: Features
fix: Bug Fixes
perf: Performance Improvements
refactor: Code Refactoring

header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject

refs:
actions:
- Closes
- closes
- Fixes
- fixes
- Resolves
- resolves

issues:
prefix:
- #

notes:
keywords:
- BREAKING CHANGE
23 changes: 20 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,41 @@ jobs:
release:
name: Create Release
runs-on: 'ubuntu-latest'
needs: test
needs:
env:
GITCHGLOG_VERSION: "0.15.4"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Build
run: |
export VERSION="${GITHUB_REF##*/}"
make release

- name: Install git-chglog
shell: bash
run: |
mkdir -p tmpdir
( cd tmpdir ;
wget https://github.com/git-chglog/git-chglog/releases/download/v${GITCHGLOG_VERSION}/git-chglog_${GITCHGLOG_VERSION}_linux_amd64.tar.gz
tar -tf git-chglog_*
tar -xvf git-chglog_* git-chglog
)
mkdir -p ~/.local/bin/
mv tmpdir/git-chglog ~/.local/bin/git-chglog
rm -rf tmpdir

- name: Release Notes
run: |
git log $(git describe HEAD~ --tags --abbrev=0)..HEAD --pretty='format:* %h %s%n * %an <%ae>' --no-merges >> ".github/RELEASE-TEMPLATE.md"
ls -alitr
~/.local/bin/git-chglog --template ./.chglog/RELEASE.tpl.md -o .github/RELEASE-TEMPLATE.md
cat .github/RELEASE-TEMPLATE.md

- name: Release with Notes
uses: softprops/action-gh-release@v2
with:
Expand Down
31 changes: 19 additions & 12 deletions pkg/cmd/evcc/evcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@ func Enable(cmd *cobra.Command, args []string) error {
return err
}

//validate passed user
// validate passed user
userFilter, _ := cmd.Flags().GetString("user")
if len(userFilter) == 0 {
userFilter, _ = cmd.InheritedFlags().GetString("username")
//use fallback from middleware
userFilter = request.Username
}

userTag := nfc.UserTag{}
Expand All @@ -116,17 +117,23 @@ func Enable(cmd *cobra.Command, args []string) error {

evseService := evse.NewEvseService(request)

current := 0
if strings.EqualFold(enable, "true") {
current = 6000
}
current, err := evseService.CurrentChargePower()
if err != nil {
return err
}

if err := evseService.SetExternalCurrent(current); err != nil {
return err
}
if err := evseService.SetExternalCurrent(current.Current); err != nil {
return err
}

if err := nfcTagService.StartCharging(userTag); err != nil {
return err
if err := nfcTagService.StartCharging(userTag); err != nil {
return err
}
} else {
if err := nfcTagService.StopCharging(); err != nil {
return err
}
}

fmt.Print(enable)
Expand All @@ -144,11 +151,11 @@ func MaxCurrent(cmd *cobra.Command, args []string) error {
return err
}

fmt.Print(currentAmpere)

//change 16 -> 16000
currentAmpere = (currentAmpere * 1e3)

fmt.Print(currentAmpere)

evseService := evse.NewEvseService(request)
return evseService.SetExternalCurrent(currentAmpere)
}