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

TP-Link charger: add ChargedEnergy based on get_daystat cmd #932

Merged
merged 2 commits into from
Apr 27, 2021

Conversation

thierolm
Copy link
Contributor

Charger provides charged energy based on internal daily statistic.

xxx@xxx:~/evcc/git/evcc$ ./evcc -c evcc_tplink.yaml charger -l trace
[main  ] INFO 2021/04/26 22:30:26 evcc 0.53 (fb4dde7)
[main  ] INFO 2021/04/26 22:30:26 using config file evcc_tplink.yaml
[tplink] TRACE 2021/04/26 22:30:26 recv: {"emeter":{"get_realtime":{"current":0.016668,"voltage":233.582539,"power":0,"total":0.077000,"err_code":0}}}
[tplink] TRACE 2021/04/26 22:30:26 recv: {"emeter":{"get_realtime":{"current":0.016668,"voltage":233.582539,"power":0,"total":0.077000,"err_code":0}}}
[tplink] TRACE 2021/04/26 22:30:26 recv: {"system":{"get_sysinfo":{"err_code":0,"sw_ver":"1.2.6 Build 200727 Rel.120821","hw_ver":"1.0","type":"IOT.SMARTPLUGSWITCH","model":"HS110(EU)","mac":"50:C7:BF:42:60:9B","deviceId":"80068B6B73AAD8C4A4D0F7B9AB5F8B1B1838EEAC","hwId":"45E29DA8382494D2E82688B52A0B2EB5","fwId":"00000000000000000000000000000000","oemId":"3D341ECE302C0642C99E31CE2430544B","alias":"evcc-charger","dev_name":"Wi-Fi Smart Plug With Energy Monitoring","icon_hash":"","relay_state":1,"on_time":685657,"active_mode":"schedule","feature":"TIM:ENE","updating":0,"rssi":-56,"led_off":0,"latitude":49.817090,"longitude":9.056194}}}
[tplink] TRACE 2021/04/26 22:30:26 recv: {"emeter":{"get_daystat":{"day_list":[{"year":2021,"month":4,"day":22,"energy":0},{"year":2021,"month":4,"day":23,"energy":0.016000},{"year":2021,"month":4,"day":24,"energy":0.020000},{"year":2021,"month":4,"day":25,"energy":0.005000},{"year":2021,"month":4,"day":26,"energy":0}],"err_code":0}}}
Power:         0W
Charge status: B
Enabled:       true
Charged:       0.0kWh

@thierolm
Copy link
Contributor Author

Hab' die Umsetzung jetzt doch ohne function pointer gemacht und auf energy_wh != 0 abgefragt.

} `json:"get_realtime"`
} `json:"emeter"`
}

// EmeterResponse is the TP-Link plug/outlet api emeter get_realtime get_daystat response
Copy link
Member

Choose a reason for hiding this comment

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

?

@andig
Copy link
Member

andig commented Apr 27, 2021

ChargeRater misst die Energie eines Ladevorgangs- d.h. „Ladevorgang“ wird mit Tag approximiert? Wäre nicht TotalEnergy passender als zu implementierendes API?

@thierolm
Copy link
Contributor Author

d.h. „Ladevorgang“ wird mit Tag approximiert?

Ja, das wäre bei den Pseudo Chargern ein Kompromiss, da diese nicht erkennen, wann ein EV an- bzw. abgesteckt wird.

Wäre nicht TotalEnergy passender als zu implementierendes API?

Ich hatte die Nutzung von TotalEnergy so verstanden, dass der ChargeRater sich diese beim Anstecken merkt, beim Abstecken nochmal abfragt und dann das Delta bildet:
ChargedEnergy = TotalEnergy(T-disconnect) - TotalEnergy(T-connect)

Wegen der fehlenden connect/disconnect Erkennung dann so nicht realisierbar.

@andig
Copy link
Member

andig commented Apr 27, 2021

Yep, das macht sinn. Rein damit?

@thierolm
Copy link
Contributor Author

thierolm commented Apr 27, 2021

Rein damit?

Von mir aus OK, falls @mark-sch noch ein Problem entdeckt, können wir es ja schnell agil fixen.

@andig andig merged commit 8420445 into evcc-io:master Apr 27, 2021
@thierolm thierolm deleted the enhancement/tplink-charger branch April 27, 2021 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants