-
Notifications
You must be signed in to change notification settings - Fork 761
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
publish charge rate to MQTT #4130
base: master
Are you sure you want to change the base?
Conversation
User @jonnylangefeld had implemented some changes in order to capture the charge_rate. I think this data is crucial in being able to accurately calculate the charging efficiency, in summer for instance I can be "charging" at 7kW at home and teslamate reports 7kW, but due to cooling I'm in fact not charging as the charge_rate is 0 because the car is using all the energy for HVAC.
✅ Deploy Preview for teslamate ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your effort. Really nice first PR!
Love that you added the corresponding test as well.
@@ -120,6 +120,7 @@ defmodule TeslaMate.ImportTest do | |||
address_id: nil, | |||
cost: nil, | |||
duration_min: 70, | |||
charge_rate: decimal(123), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if 123 is a realistic charge rate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, if configured in km it would be an equivalent ~17kW
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then charge_rate
is not a self explaining variable name. duration_min
is clear, but charge_rate
is not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's the rate in distance/time et which you're effectively charging, it has the same name in the API. It's the number that gets displayed when you switch your cars battery level to distance.
@@ -43,6 +43,7 @@ defmodule TeslaMate.Vehicles.Vehicle.ChargingTest do | |||
date: _, | |||
charge_energy_added: 0.1, | |||
rated_battery_range_km: 1.61, | |||
charge_rate: 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with a charge_rate of 0 no energy would have been added, innit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If plugged into a charger and using more energy to precondition the cabin than the charger can supply, charge rate becomes 0 when charging. This is why I want to track this specifically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah understood, but I do want to introduce a separate test case for this.
@@ -54,6 +55,7 @@ defmodule TeslaMate.Vehicles.Vehicle.ChargingTest do | |||
date: _, | |||
charge_energy_added: 0.2, | |||
rated_battery_range_km: 3.22, | |||
charge_rate: 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these values should set to realisitc values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as before, charge_rate
unit is not obvious
@@ -64,6 +66,7 @@ defmodule TeslaMate.Vehicles.Vehicle.ChargingTest do | |||
date: _, | |||
charge_energy_added: 0.3, | |||
rated_battery_range_km: 4.83, | |||
charge_rate: 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these values should set to realisitc values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As before, realistic value of preconditioning lowering requirement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as before
@@ -76,6 +79,7 @@ defmodule TeslaMate.Vehicles.Vehicle.ChargingTest do | |||
date: _, | |||
charge_energy_added: 0.4, | |||
rated_battery_range_km: 6.44, | |||
charge_rate: 10, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these values should set to realisitc values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as before
@@ -316,6 +317,7 @@ defmodule TeslaMateWeb.CarControllerTest do | |||
charging_state: "Charging", | |||
charge_energy_added: "4.32", | |||
ideal_battery_range: 200, | |||
charge_rate: 123, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if 123 is a realistic charge rate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as before
@@ -263,6 +263,7 @@ defmodule TeslaMateWeb.CarControllerTest do | |||
charger_voltage: 229, | |||
charger_actual_current: 16, | |||
battery_range: 200, | |||
charge_rate: 123, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if 123 is a realistic charge rate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then charge_rate
is not a self explaining variable name. duration_min
is clear, but charge_rate
is not.
Being the variable name in the API, isn't it best to keep it the same? How would you name it better? |
Add charge_rate to logger
Is there anything I can do to improve the PR? Would you change the variable name? I used what tesla uses on https://developer.tesla.com/docs/fleet-api/endpoints/vehicle-endpoints#vehicle-data |
User @jonnylangefeld had implemented some changes in order to capture the charge_rate. I think this data is crucial in being able to accurately calculate the charging efficiency, in summer for instance I can be "charging" at 7kW at home and teslamate reports 7kW, but due to cooling I'm in fact not charging as the charge_rate is 0 because the car is using all the energy for HVAC.
I did get the changes that were done on a previous unfinished PR and I'm just getting knowledge on how the project works behind the scenes so any comments are appreciated, I'll do my best.