Skip to content
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

Pseudo charger/feature sync #936

Merged
merged 5 commits into from
Apr 29, 2021

Conversation

thierolm
Copy link
Sponsor Contributor

Dieser PR führt auch für die "pseudo" Charger FritzDect und Tasmato die ChargedEnergy Funktion auf Basis des in den Steckdosen mitgeschnittenen täglichen Energieverbrauchs ein.
Damit wären dann alle evcc "pseudo" Charger Feature-mäßig in sync.

// fetch basicdevicestats
resp, err := c.execFritzDectCmd("getbasicdevicestats")
if err != nil {
return math.NaN(), err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ich geb immer 0 zurück. err zeigt an dass der Wert nicht gilt


// unmarshal devicestats
var statsresp fritzdect.Devicestats
err = xml.Unmarshal([]byte(resp), &statsresp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if err =...; err !=nil {

}

// select energy value of current day
energylst := strings.Split(statsresp.Energy.Values[1], ",")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

evergylist?

// select energy value of current day
energylst := strings.Split(statsresp.Energy.Values[1], ",")
var energy float64
energy, err = strconv.ParseFloat(energylst[0], 64)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

energy, err := ....


import "encoding/xml"

// getdevicestats command response (AHA-HTTP-Interface)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public in gross

Energy Energy `xml:"energy"`
}

type Energy struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kommentar fehlt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wirklich getbasicdevicesstats?

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// ChargedEnergy implements the api.ChargeRater interface
func (c *Tasmota) ChargedEnergy() (float64, error) {
var tStatusSNS tasmota.StatusSNSResponse
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resp -> die heissen überall sonst auch so ;)


// Execute Tasmota Status 8 command
err := c.GetJSON(c.cmdUri("Status 8"), &tStatusSNS)
if err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weg- einfach unten err zurück geben

@andig andig added the enhancement New feature or request label Apr 29, 2021

return int(1) == tStatus.Status.Power, err
return int(1) == resp.Status.Power, err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warum nicht einfach resp.Status.Power == 1 ?

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ist wohl ein "Artefact" aus der Entwicklungsphase ...

func (c *Tasmota) ChargedEnergy() (float64, error) {
var resp tasmota.StatusSNSResponse

// Execute Tasmota Status 8 command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline Kommentare immer klein. Trägt der kommentar wirklich was zum Erkenntnisgewinn bei?

@andig andig merged commit 6d63331 into evcc-io:master Apr 29, 2021
@thierolm thierolm deleted the pseudo-charger/feature-sync branch August 18, 2021 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants