I am trying to input cost of charging and the link under charges tries to take me to a url that is blank. I see the Json for charges but I don't see where to set the cost per kWh?
Also experiencing this, the 'Set Cost' link is directing to http://teslamate:3000:/charge-cost/1 which does not exist.
I don't even see the option to enter this - where in charges do you see this? I can see this is in the charging_processes table, but where does one enter the cost?
There isn't the ability to set the cost, if you check the queries you'll see there is no variable referenced. Looks like this part is a work in progress.
You can however edit the query and make a custom dashboard and hard code your cost to make it render correctly.
For example, in charging stats, you can edit the query and replace the select with this:
SELECT
COALESCE(geofence.name, CONCAT_WS(', ', COALESCE(address.name, CONCAT_WS(' ', address.road, address.house_number)), address.city)) AS location,
sum(charge_energy_added) as charge_energy_added, (sum(charge_energy_added)*0.13) as Cost
(change 0.13 to however much it costs per kwh)
The chart will now display 3 columns, including cost.
Now it shows:

Field is there for future use, up to now you need to set the costs by database query, see #185
Thanks guys I got he cost to show up using the following query under the Charging stats dashboard
SELECT
sum(charge_energy_added) as charge_energy_added, (sum(charge_energy_added)*0.11) as Cost
FROM
charging_processes
WHERE
car_id = $car_id;
Thanks. I was also able to change the query to show cost.
@JakobLichterfeld just for understanding the cost field in the table is currently the total cost for that session.
ie charged*cost/kWh. This needs to be calculated everytime based on the cost/kWh.
It will be null by default.
What is the charge_energy_used?
@JakobLichterfeld just for understanding the cost field in the table is currently the total cost for that session.
ie charged*cost/kWh. This needs to be calculated everytime based on the cost/kWh.
It will be null by default.
What is the charge_energy_used?
Yes, this is for logging the costs of the charge. Sometimes you pay per charge sometimes per kWh added. So manual input needed. The field is in the database scheme already, but the UI part to set the total cost for this charge is not yet implemented. If you want to track them anyway, you need to set it with a query, see #185
Thanks. I was also able to change the query to show cost.
@JakobLichterfeld just for understanding the cost field in the table is currently the total cost for that session.
ie charged*cost/kWh. This needs to be calculated everytime based on the cost/kWh.
It will be null by default.
What is the charge_energy_used?
I get it to show on the dashboard but it will not let me save the dashboard or the query using gafana even though I am logged in as admin? It says "This dashboard cannot be saved from Grafana's UI since it has been provisioned from another source. Copy the JSON or save it to a file below. Then you can update your dashboard in corresponding provisioning source." the source is the TeslaMate DB so the queries are in the DB as well? I have no idea how to access the DB inside a Docker :)
You save it as a new dashboard. You cant overwrite the defaults.
the source is the TeslaMate DB so the queries are in the DB as well? I have no idea how to access the DB inside a Docker :)
Yeah. If you use the docker-compose file you have set up a volume for the DB, so it is not inside the docker :)
Can someone help how this can be done if my metering is set to Time-Of-Use? The cost is different based on time it was charged. Thanks in advance.
edit: On further search found teslamateagile that seems to work nicely with teslamate. Have integrated it into teslamate's docker yaml file. I think other members have suggested another app to do this and probably this is the one. Ignore my help request. thanks.