nickknissen / hass-monta

Monta Home Assistant custom component
MIT License
21 stars 2 forks source link

Is it time to include Wallet-readings in this integration? #65

Closed Bluhme1 closed 1 month ago

Bluhme1 commented 4 months ago

Checklist

Is your feature request related to a problem? Please describe.

No

Describe the solution you'd like

Now that we can extract the number of kWh used and the cost of the latest charge, would it be an idea to include the tax-refund for the last charge transferred to the wallet also? The API has this information and I am sure the @nickknissen and/or @RogerSelwyn is able to include that. As far as I understand @cweinberger the "official" integration is late and I don't know if the idea of an "insight" API still exists. I use this integration on a daily basis and relies heavily on it to charge my car and follow the statistics. I am very happy with it - so a big thanks to you. So just wanted to add an idea to a further development, now that this is becoming the solution of the near future and maybe it is worth to go on putting an effort to it. Best Lars

Describe alternatives you've considered

none

Additional context

none

RogerSelwyn commented 4 months ago

I wish I could add it, but a recent response (after several months) on the api discussion page said that they won’t be adding access to wallet transactions for ‘commercial’ users.

For background, I buy a service via Sevadis which is hosted on Monta. Because of this I am counted as enterprise, and they won’t give me access via the api to the data I have on the portal. Monta seem worried I might start running some major operation via it. I’m a single EV charger setup.

RogerSelwyn commented 4 months ago

FYI the query I raised - https://docs.public-api.monta.com/discuss/6536a68584baa5005b95576d

Bluhme1 commented 4 months ago

OK. My feature request was meant to include the information as a consumer that I can see in the API access.

Bluhme1 commented 2 months ago

@nickknissen @RogerSelwyn Hope I`m not too impolite, but have any of you considered adding the wallet functionality. It would really be a great feature to make this integration more complete Sorry if it is asking too much

RogerSelwyn commented 2 months ago

@Bluhme1 see my last comment. The data I need isn’t available, so I wouldn’t plan to add the functionally myself.

Bluhme1 commented 2 months ago

@RogerSelwyn Sorry. You cannot of course add this functionality without access to data I wish I had the skills. Been looking into your code when you added charges but it is too difficult for me to grasp

Bluhme1 commented 2 months ago

@RogerSelwyn I am experimenting myself to include "wallet-transaction" data and as far as I can see there need to be added a few lines in the coordinater file, before sensors can be created. in this section:

async def _async_update_data(self):
    """Update data via library."""
    try:
        chargepoints = await self.client.async_get_charge_points()
        for charge_point_id, _ in chargepoints.items():
            chargepoints[charge_point_id][
                "charges"
            ] = await self.client.async_get_charges(charge_point_id)
        return chargepoints
    except MontaApiClientAuthenticationError as exception:
        raise ConfigEntryAuthFailed(exception) from exception
    except MontaApiClientError as exception:
        raise UpdateFailed(exception) from exception

Could you help me a little with these lines in coordinator. Am I on rhe right track?

If you don´t want to, it is ok. This is not a "Python-school", but it would be great to be able. to make things yourself

RogerSelwyn commented 2 months ago

At the moment the coordinator (which is retrieving all data) is returning the charge points at the root of the data returned. I think it is:

You would need to consider what the structure of data you want returned from coordinator is. For example:

Or:

Not sure which is appropriate.

Bluhme1 commented 2 months ago

@RogerSelwyn Thank you very much. I am most grateful. I think the first structure would be the best

Chargepoints CP 1 Info CP 2 Info Wallet Info

So how would the right structure be in line 39 to retrieve wallet info?

Sorry, really a newbie

RogerSelwyn commented 2 months ago

Sorry, but if you don't know how to write the Python to retrieve the data I think you are really going to struggle to do this. It isn't a matter of adding one line of code. Having looked at it again, you need to add the relevant methods in api.py first.

Bluhme1 commented 2 months ago

@RogerSelwyn You are right. I haven’t got the skills to do that, so I will leave it for now. Thank you again for your patience and kindness. I just thought it would be a great feature but of course not essential for the charging of the car. On the “nice to have” list.

Bluhme1 commented 1 month ago

@RogerSelwyn Wow. The days of miracle aren´t over yet. Thank you very much. 🥇

I don´t get a sensor for wallet transactions in my setup. Probably a minor problem. Data comes in, but no sensor created

I enclose my log:

2024-05-16 14:43:10.111 DEBUG (MainThread) [custom_components.monta.api] No token is valid, Requesting a new tokens 2024-05-16 14:43:10.194 DEBUG (MainThread) [custom_components.monta.api] [auth/token] Response header: <CIMultiDictProxy('Date': 'Thu, 16 May 2024 12:43:10 GMT', 'Content-Type': 'application/json', 'Content-Length': '265', 'Connection': 'keep-alive', 'request-id': 'a2008ee0-58a5-47a0-b1c2-84f58f88e433', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains')> 2024-05-16 14:43:10.194 DEBUG (MainThread) [custom_components.monta.api] [auth/token] Response status: 200 2024-05-16 14:43:10.194 DEBUG (MainThread) [custom_components.monta.api] [auth/token] Response body : {'applicationId': 13, 'userId': 98737, 'accessToken': '****', 'accessTokenExpirationDate': '2024-05-16T13:43:10.170743101Z', 'refreshToken': '****', 'refreshTokenExpirationDate': '2024-06-15T12:43:10.170750536Z'} 2024-05-16 14:43:10.306 DEBUG (MainThread) [custom_components.monta.api] [charge-points?page=0&perPage=10] Response header: <CIMultiDictProxy('Date': 'Thu, 16 May 2024 12:43:10 GMT', 'Content-Type': 'application/json', 'Content-Length': '700', 'Connection': 'keep-alive', 'request-id': '7f53e90d-bc93-4ff1-be88-b6829aaf4051', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains')> 2024-05-16 14:43:10.307 DEBUG (MainThread) [custom_components.monta.api] [charge-points?page=0&perPage=10] Response status: 200 2024-05-16 14:43:10.307 DEBUG (MainThread) [custom_components.monta.api] [charge-points?page=0&perPage=10] Response body : {'data': [{'id': 2560377, 'createdAt': '2022-12-07T08:38:57Z', 'updatedAt': '2024-05-16T12:42:56Z', 'serialNumber': '*****', 'name': 'Bluhme', 'visibility': 'private', 'maxKW': 22.0, 'maxKw': 22.0, 'type': 'ac', 'note': None, 'state': 'busy', 'location': {'coordinates': {'latitude': '**', 'longitude': '**'}, 'address': {'address1': '****', 'address2': '**', 'address3': '****', 'zip': '8300', 'city': 'Odder', 'country': 'Denmark'}}, 'connectors': [{'identifier': 'type2', 'name': 'Type 2'}], 'lastMeterReadingKwh': 3690.817, 'cablePluggedIn': False, 'brandName': 'Zaptec', 'modelName': 'Zaptec - Go', 'firmwareVersion': '2.3.1.2'}], 'meta': {'itemCount': 1, 'currentPage': 0, 'perPage': 10, 'totalPageCount': 1, 'totalItemCount': 1}} 2024-05-16 14:43:10.308 DEBUG (MainThread) [custom_components.monta.api] Access Token still valid, using it 2024-05-16 14:43:10.536 DEBUG (MainThread) [custom_components.monta.api] [charges?chargePointId=2560377] Response header: <CIMultiDictProxy('Date': 'Thu, 16 May 2024 12:43:10 GMT', 'Content-Type': 'application/json', 'Content-Length': '923', 'Connection': 'keep-alive', 'request-id': '|b6b662425643018b49436fb254a0c9f3.a73cf18f25a822e3.', 'Content-Encoding': 'gzip', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains')> 2024-05-16 14:43:10.536 DEBUG (MainThread) [custom_components.monta.api] [charges?chargePointId=2560377] Response status: 200 2024-05-16 14:43:10.537 DEBUG (MainThread) [custom_components.monta.api] [charges?chargePointId=2560377] Response body : {'data': [{'id': 12468969, 'chargePointId': 2560377, 'createdAt': '2024-05-16T12:42:55Z', 'updatedAt': '2024-05-16T12:42:56Z', 'cablePluggedInAt': None, 'startedAt': '2024-05-16T12:42:56Z', 'stoppedAt': None, 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': '2024-05-16T12:47:56Z', 'state': 'starting', 'consumedKwh': 0.0, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 0.0, 'cost': 0, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 0.0, 'averageRenewablePerKwh': 0.0, 'failureReason': None, 'stopReason': '', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12468601, 'chargePointId': 2560377, 'createdAt': '2024-05-16T12:33:44Z', 'updatedAt': '2024-05-16T12:38:46Z', 'cablePluggedInAt': None, 'startedAt': '2024-05-16T12:33:45Z', 'stoppedAt': '2024-05-16T12:38:46Z', 'fullyChargedAt': None, 'failedAt': '2024-05-16T12:38:46Z', 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 0.0, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 0.0, 'cost': 0, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 0.0, 'averageRenewablePerKwh': 0.0, 'failureReason': 'ChargeSessionStateError', 'stopReason': '', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12447765, 'chargePointId': 2560377, 'createdAt': '2024-05-16T01:00:00Z', 'updatedAt': '2024-05-16T02:51:33Z', 'cablePluggedInAt': '2024-05-16T01:00:00Z', 'startedAt': '2024-05-16T01:00:01Z', 'stoppedAt': '2024-05-16T02:51:27Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 15.82, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 15.824, 'cost': 8.08, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 53.2, 'averageRenewablePerKwh': 88.32, 'failureReason': None, 'stopReason': 'StoppedByUser', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12416388, 'chargePointId': 2560377, 'createdAt': '2024-05-15T11:27:41Z', 'updatedAt': '2024-05-15T11:28:30Z', 'cablePluggedInAt': '2024-05-15T11:28:30Z', 'startedAt': '2024-05-15T11:27:41Z', 'stoppedAt': '2024-05-15T11:28:30Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 0.0, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 0.0, 'cost': 0, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 0.0, 'averageRenewablePerKwh': 0.0, 'failureReason': None, 'stopReason': None, 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12414638, 'chargePointId': 2560377, 'createdAt': '2024-05-15T10:50:59Z', 'updatedAt': '2024-05-15T10:54:51Z', 'cablePluggedInAt': '2024-05-15T10:54:50Z', 'startedAt': '2024-05-15T10:50:59Z', 'stoppedAt': '2024-05-15T10:54:50Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 0.0, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 0.0, 'cost': 0, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 0.0, 'averageRenewablePerKwh': 0.0, 'failureReason': None, 'stopReason': None, 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12351423, 'chargePointId': 2560377, 'createdAt': '2024-05-13T23:00:00Z', 'updatedAt': '2024-05-14T03:20:47Z', 'cablePluggedInAt': '2024-05-13T23:00:00Z', 'startedAt': '2024-05-13T23:00:01Z', 'stoppedAt': '2024-05-14T03:20:42Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 34.96, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 34.963, 'cost': 18.06, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 47.69, 'averageRenewablePerKwh': 94.79, 'failureReason': None, 'stopReason': 'StoppedByUser', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12272321, 'chargePointId': 2560377, 'createdAt': '2024-05-12T05:00:01Z', 'updatedAt': '2024-05-12T05:05:03Z', 'cablePluggedInAt': None, 'startedAt': '2024-05-12T05:00:02Z', 'stoppedAt': '2024-05-12T05:05:03Z', 'fullyChargedAt': None, 'failedAt': '2024-05-12T05:05:03Z', 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 0.0, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 0.0, 'cost': 0, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 0.0, 'averageRenewablePerKwh': 0.0, 'failureReason': 'ChargeSessionStateError', 'stopReason': '', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12241178, 'chargePointId': 2560377, 'createdAt': '2024-05-11T07:00:01Z', 'updatedAt': '2024-05-11T08:20:16Z', 'cablePluggedInAt': '2024-05-11T07:00:01Z', 'startedAt': '2024-05-11T07:00:02Z', 'stoppedAt': '2024-05-11T08:20:12Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 3.61, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 3.607, 'cost': 1.62, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 182.72, 'averageRenewablePerKwh': 66.97, 'failureReason': None, 'stopReason': '', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12172278, 'chargePointId': 2560377, 'createdAt': '2024-05-09T11:13:59Z', 'updatedAt': '2024-05-09T12:40:57Z', 'cablePluggedInAt': '2024-05-09T11:13:59Z', 'startedAt': '2024-05-09T11:14:00Z', 'stoppedAt': '2024-05-09T12:40:53Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 9.63, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 9.626, 'cost': 3.61, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 126.56, 'averageRenewablePerKwh': 87.05, 'failureReason': None, 'stopReason': 'StoppedByUser', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12104968, 'chargePointId': 2560377, 'createdAt': '2024-05-07T23:00:00Z', 'updatedAt': '2024-05-08T00:29:03Z', 'cablePluggedInAt': '2024-05-07T23:00:00Z', 'startedAt': '2024-05-07T23:00:02Z', 'stoppedAt': '2024-05-08T00:28:59Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 9.14, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 9.141, 'cost': 9.91, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 224.4, 'averageRenewablePerKwh': 71.2, 'failureReason': None, 'stopReason': 'StoppedByUser', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}], 'meta': {'itemCount': 10, 'currentPage': 0, 'perPage': 10, 'totalPageCount': 36, 'totalItemCount': 355}} 2024-05-16 14:43:10.537 DEBUG (MainThread) [custom_components.monta.api] Access Token still valid, using it 2024-05-16 14:43:10.698 DEBUG (MainThread) [custom_components.monta.api] [wallet-transactions?fromDate=2024-05-09T12:43:10Z] Response header: <CIMultiDictProxy('Date': 'Thu, 16 May 2024 12:43:10 GMT', 'Content-Type': 'application/json', 'Content-Length': '514', 'Connection': 'keep-alive', 'request-id': '|b6b662425643018b49436fb254a0c9f3.caa25f0c816ed79a.', 'Content-Encoding': 'gzip', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains')> 2024-05-16 14:43:10.698 DEBUG (MainThread) [custom_components.monta.api] [wallet-transactions?fromDate=2024-05-09T12:43:10Z] Response status: 200 2024-05-16 14:43:10.699 DEBUG (MainThread) [custom_components.monta.api] [wallet-transactions?fromDate=2024-05-09T12:43:10Z] Response body : {'data': [{'id': 35215933, 'state': 'complete', 'note': 'Tax refund for 15.8240 kWh, total of 14.87 DKK', 'summary': 'Tax refund, ', 'fromAmount': 14.8746, 'fromCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'toAmount': 14.8746, 'toCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'exchangeRate': 1.0, 'createdAt': '2024-05-16T03:02:13Z', 'updatedAt': '2024-05-16T03:02:13Z', 'completedAt': '2024-05-16T03:02:13Z'}, {'id': 35214607, 'state': 'complete', 'note': 'Monthly subscription on 74 DKK', 'summary': 'Monthly subscription, Deleted plan', 'fromAmount': 74.0, 'fromCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'toAmount': 74.0, 'toCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'exchangeRate': 1.0, 'createdAt': '2024-05-16T02:07:21Z', 'updatedAt': '2024-05-16T02:07:21Z', 'completedAt': '2024-05-16T02:07:21Z'}, {'id': 35128603, 'state': 'complete', 'note': 'Tax refund for 34.9630 kWh, total of 32.87 DKK', 'summary': 'Tax refund, ', 'fromAmount': 32.8652, 'fromCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'toAmount': 32.8652, 'toCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'exchangeRate': 1.0, 'createdAt': '2024-05-14T03:31:43Z', 'updatedAt': '2024-05-14T03:31:43Z', 'completedAt': '2024-05-14T03:31:43Z'}, {'id': 35014787, 'state': 'complete', 'note': 'Tax refund for 3.6070 kWh, total of 3.39 DKK', 'summary': 'Tax refund, ', 'fromAmount': 3.3906, 'fromCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'toAmount': 3.3906, 'toCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'exchangeRate': 1.0, 'createdAt': '2024-05-11T08:31:00Z', 'updatedAt': '2024-05-11T08:31:00Z', 'completedAt': '2024-05-11T08:31:00Z'}, {'id': 34925406, 'state': 'complete', 'note': 'Tax refund for 9.6260 kWh, total of 9.05 DKK', 'summary': 'Tax refund, ', 'fromAmount': 9.0484, 'fromCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'toAmount': 9.0484, 'toCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'exchangeRate': 1.0, 'createdAt': '2024-05-09T12:51:19Z', 'updatedAt': '2024-05-09T12:51:19Z', 'completedAt': '2024-05-09T12:51:19Z'}], 'meta': {'itemCount': 5, 'currentPage': 0, 'perPage': 10, 'totalPageCount': 1, 'totalItemCount': 5}} 2024-05-16 14:43:10.699 DEBUG (MainThread) [custom_components.monta] Finished fetching monta data in 0.596 seconds (success: True) 2024-05-16 14:43:10.742 DEBUG (MainThread) [custom_components.monta.services] Set up services

RogerSelwyn commented 1 month ago

I can see no reason why the sensor would not be created. Sensor should be called sensor.monta_personal_wallet, it is not linked to a device because there is no such relationship.

Always worth using the <> in the GitHub toolbar to post logs, code, whatever, it makes it much easier to read.

2024-05-16 14:43:10.111 DEBUG (MainThread) [custom_components.monta.api] No token is valid, Requesting a new tokens
2024-05-16 14:43:10.194 DEBUG (MainThread) [custom_components.monta.api] [auth/token] Response header: <CIMultiDictProxy('Date': 'Thu, 16 May 2024 12:43:10 GMT', 'Content-Type': 'application/json', 'Content-Length': '265', 'Connection': 'keep-alive', 'request-id': 'a2008ee0-58a5-47a0-b1c2-84f58f88e433', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains')>
2024-05-16 14:43:10.194 DEBUG (MainThread) [custom_components.monta.api] [auth/token] Response status: 200
2024-05-16 14:43:10.194 DEBUG (MainThread) [custom_components.monta.api] [auth/token] Response body : {'applicationId': 13, 'userId': 98737, 'accessToken': '', 'accessTokenExpirationDate': '2024-05-16T13:43:10.170743101Z', 'refreshToken': '', 'refreshTokenExpirationDate': '2024-06-15T12:43:10.170750536Z'}
2024-05-16 14:43:10.306 DEBUG (MainThread) [custom_components.monta.api] [charge-points?page=0&perPage=10] Response header: <CIMultiDictProxy('Date': 'Thu, 16 May 2024 12:43:10 GMT', 'Content-Type': 'application/json', 'Content-Length': '700', 'Connection': 'keep-alive', 'request-id': '7f53e90d-bc93-4ff1-be88-b6829aaf4051', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains')>
2024-05-16 14:43:10.307 DEBUG (MainThread) [custom_components.monta.api] [charge-points?page=0&perPage=10] Response status: 200
2024-05-16 14:43:10.307 DEBUG (MainThread) [custom_components.monta.api] [charge-points?page=0&perPage=10] Response body : {'data': [{'id': 2560377, 'createdAt': '2022-12-07T08:38:57Z', 'updatedAt': '2024-05-16T12:42:56Z', 'serialNumber': '', 'name': 'Bluhme', 'visibility': 'private', 'maxKW': 22.0, 'maxKw': 22.0, 'type': 'ac', 'note': None, 'state': 'busy', 'location': {'coordinates': {'latitude': '', 'longitude': ''}, 'address': {'address1': '', 'address2': '***', 'address3': '', 'zip': '8300', 'city': 'Odder', 'country': 'Denmark'}}, 'connectors': [{'identifier': 'type2', 'name': 'Type 2'}], 'lastMeterReadingKwh': 3690.817, 'cablePluggedIn': False, 'brandName': 'Zaptec', 'modelName': 'Zaptec - Go', 'firmwareVersion': '2.3.1.2'}], 'meta': {'itemCount': 1, 'currentPage': 0, 'perPage': 10, 'totalPageCount': 1, 'totalItemCount': 1}}
2024-05-16 14:43:10.308 DEBUG (MainThread) [custom_components.monta.api] Access Token still valid, using it
2024-05-16 14:43:10.536 DEBUG (MainThread) [custom_components.monta.api] [charges?chargePointId=2560377] Response header: <CIMultiDictProxy('Date': 'Thu, 16 May 2024 12:43:10 GMT', 'Content-Type': 'application/json', 'Content-Length': '923', 'Connection': 'keep-alive', 'request-id': '|b6b662425643018b49436fb254a0c9f3.a73cf18f25a822e3.', 'Content-Encoding': 'gzip', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains')>
2024-05-16 14:43:10.536 DEBUG (MainThread) [custom_components.monta.api] [charges?chargePointId=2560377] Response status: 200
2024-05-16 14:43:10.537 DEBUG (MainThread) [custom_components.monta.api] [charges?chargePointId=2560377] Response body : {'data': [{'id': 12468969, 'chargePointId': 2560377, 'createdAt': '2024-05-16T12:42:55Z', 'updatedAt': '2024-05-16T12:42:56Z', 'cablePluggedInAt': None, 'startedAt': '2024-05-16T12:42:56Z', 'stoppedAt': None, 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': '2024-05-16T12:47:56Z', 'state': 'starting', 'consumedKwh': 0.0, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 0.0, 'cost': 0, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 0.0, 'averageRenewablePerKwh': 0.0, 'failureReason': None, 'stopReason': '', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12468601, 'chargePointId': 2560377, 'createdAt': '2024-05-16T12:33:44Z', 'updatedAt': '2024-05-16T12:38:46Z', 'cablePluggedInAt': None, 'startedAt': '2024-05-16T12:33:45Z', 'stoppedAt': '2024-05-16T12:38:46Z', 'fullyChargedAt': None, 'failedAt': '2024-05-16T12:38:46Z', 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 0.0, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 0.0, 'cost': 0, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 0.0, 'averageRenewablePerKwh': 0.0, 'failureReason': 'ChargeSessionStateError', 'stopReason': '', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12447765, 'chargePointId': 2560377, 'createdAt': '2024-05-16T01:00:00Z', 'updatedAt': '2024-05-16T02:51:33Z', 'cablePluggedInAt': '2024-05-16T01:00:00Z', 'startedAt': '2024-05-16T01:00:01Z', 'stoppedAt': '2024-05-16T02:51:27Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 15.82, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 15.824, 'cost': 8.08, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 53.2, 'averageRenewablePerKwh': 88.32, 'failureReason': None, 'stopReason': 'StoppedByUser', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12416388, 'chargePointId': 2560377, 'createdAt': '2024-05-15T11:27:41Z', 'updatedAt': '2024-05-15T11:28:30Z', 'cablePluggedInAt': '2024-05-15T11:28:30Z', 'startedAt': '2024-05-15T11:27:41Z', 'stoppedAt': '2024-05-15T11:28:30Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 0.0, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 0.0, 'cost': 0, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 0.0, 'averageRenewablePerKwh': 0.0, 'failureReason': None, 'stopReason': None, 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12414638, 'chargePointId': 2560377, 'createdAt': '2024-05-15T10:50:59Z', 'updatedAt': '2024-05-15T10:54:51Z', 'cablePluggedInAt': '2024-05-15T10:54:50Z', 'startedAt': '2024-05-15T10:50:59Z', 'stoppedAt': '2024-05-15T10:54:50Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 0.0, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 0.0, 'cost': 0, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 0.0, 'averageRenewablePerKwh': 0.0, 'failureReason': None, 'stopReason': None, 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12351423, 'chargePointId': 2560377, 'createdAt': '2024-05-13T23:00:00Z', 'updatedAt': '2024-05-14T03:20:47Z', 'cablePluggedInAt': '2024-05-13T23:00:00Z', 'startedAt': '2024-05-13T23:00:01Z', 'stoppedAt': '2024-05-14T03:20:42Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 34.96, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 34.963, 'cost': 18.06, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 47.69, 'averageRenewablePerKwh': 94.79, 'failureReason': None, 'stopReason': 'StoppedByUser', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12272321, 'chargePointId': 2560377, 'createdAt': '2024-05-12T05:00:01Z', 'updatedAt': '2024-05-12T05:05:03Z', 'cablePluggedInAt': None, 'startedAt': '2024-05-12T05:00:02Z', 'stoppedAt': '2024-05-12T05:05:03Z', 'fullyChargedAt': None, 'failedAt': '2024-05-12T05:05:03Z', 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 0.0, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 0.0, 'cost': 0, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 0.0, 'averageRenewablePerKwh': 0.0, 'failureReason': 'ChargeSessionStateError', 'stopReason': '', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12241178, 'chargePointId': 2560377, 'createdAt': '2024-05-11T07:00:01Z', 'updatedAt': '2024-05-11T08:20:16Z', 'cablePluggedInAt': '2024-05-11T07:00:01Z', 'startedAt': '2024-05-11T07:00:02Z', 'stoppedAt': '2024-05-11T08:20:12Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 3.61, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 3.607, 'cost': 1.62, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 182.72, 'averageRenewablePerKwh': 66.97, 'failureReason': None, 'stopReason': '', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12172278, 'chargePointId': 2560377, 'createdAt': '2024-05-09T11:13:59Z', 'updatedAt': '2024-05-09T12:40:57Z', 'cablePluggedInAt': '2024-05-09T11:13:59Z', 'startedAt': '2024-05-09T11:14:00Z', 'stoppedAt': '2024-05-09T12:40:53Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 9.63, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 9.626, 'cost': 3.61, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 126.56, 'averageRenewablePerKwh': 87.05, 'failureReason': None, 'stopReason': 'StoppedByUser', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}, {'id': 12104968, 'chargePointId': 2560377, 'createdAt': '2024-05-07T23:00:00Z', 'updatedAt': '2024-05-08T00:29:03Z', 'cablePluggedInAt': '2024-05-07T23:00:00Z', 'startedAt': '2024-05-07T23:00:02Z', 'stoppedAt': '2024-05-08T00:28:59Z', 'fullyChargedAt': None, 'failedAt': None, 'timeoutAt': None, 'state': 'completed', 'consumedKwh': 9.14, 'kwhLimit': None, 'startMeterKwh': 0.0, 'endMeterKwh': 9.141, 'cost': 9.91, 'price': 0, 'priceLimit': None, 'averagePricePerKwh': 0, 'averageCo2PerKwh': 224.4, 'averageRenewablePerKwh': 71.2, 'failureReason': None, 'stopReason': 'StoppedByUser', 'note': None, 'currency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'soc': None, 'socLimit': None}], 'meta': {'itemCount': 10, 'currentPage': 0, 'perPage': 10, 'totalPageCount': 36, 'totalItemCount': 355}}
2024-05-16 14:43:10.537 DEBUG (MainThread) [custom_components.monta.api] Access Token still valid, using it
2024-05-16 14:43:10.698 DEBUG (MainThread) [custom_components.monta.api] [wallet-transactions?fromDate=2024-05-09T12:43:10Z] Response header: <CIMultiDictProxy('Date': 'Thu, 16 May 2024 12:43:10 GMT', 'Content-Type': 'application/json', 'Content-Length': '514', 'Connection': 'keep-alive', 'request-id': '|b6b662425643018b49436fb254a0c9f3.caa25f0c816ed79a.', 'Content-Encoding': 'gzip', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains')>
2024-05-16 14:43:10.698 DEBUG (MainThread) [custom_components.monta.api] [wallet-transactions?fromDate=2024-05-09T12:43:10Z] Response status: 200
2024-05-16 14:43:10.699 DEBUG (MainThread) [custom_components.monta.api] [wallet-transactions?fromDate=2024-05-09T12:43:10Z] Response body : {'data': [{'id': 35215933, 'state': 'complete', 'note': 'Tax refund for 15.8240 kWh, total of 14.87 DKK', 'summary': 'Tax refund, ', 'fromAmount': 14.8746, 'fromCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'toAmount': 14.8746, 'toCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'exchangeRate': 1.0, 'createdAt': '2024-05-16T03:02:13Z', 'updatedAt': '2024-05-16T03:02:13Z', 'completedAt': '2024-05-16T03:02:13Z'}, {'id': 35214607, 'state': 'complete', 'note': 'Monthly subscription on 74 DKK', 'summary': 'Monthly subscription, Deleted plan', 'fromAmount': 74.0, 'fromCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'toAmount': 74.0, 'toCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'exchangeRate': 1.0, 'createdAt': '2024-05-16T02:07:21Z', 'updatedAt': '2024-05-16T02:07:21Z', 'completedAt': '2024-05-16T02:07:21Z'}, {'id': 35128603, 'state': 'complete', 'note': 'Tax refund for 34.9630 kWh, total of 32.87 DKK', 'summary': 'Tax refund, ', 'fromAmount': 32.8652, 'fromCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'toAmount': 32.8652, 'toCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'exchangeRate': 1.0, 'createdAt': '2024-05-14T03:31:43Z', 'updatedAt': '2024-05-14T03:31:43Z', 'completedAt': '2024-05-14T03:31:43Z'}, {'id': 35014787, 'state': 'complete', 'note': 'Tax refund for 3.6070 kWh, total of 3.39 DKK', 'summary': 'Tax refund, ', 'fromAmount': 3.3906, 'fromCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'toAmount': 3.3906, 'toCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'exchangeRate': 1.0, 'createdAt': '2024-05-11T08:31:00Z', 'updatedAt': '2024-05-11T08:31:00Z', 'completedAt': '2024-05-11T08:31:00Z'}, {'id': 34925406, 'state': 'complete', 'note': 'Tax refund for 9.6260 kWh, total of 9.05 DKK', 'summary': 'Tax refund, ', 'fromAmount': 9.0484, 'fromCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'toAmount': 9.0484, 'toCurrency': {'identifier': 'dkk', 'name': 'Danish kroner', 'decimals': 2}, 'exchangeRate': 1.0, 'createdAt': '2024-05-09T12:51:19Z', 'updatedAt': '2024-05-09T12:51:19Z', 'completedAt': '2024-05-09T12:51:19Z'}], 'meta': {'itemCount': 5, 'currentPage': 0, 'perPage': 10, 'totalPageCount': 1, 'totalItemCount': 5}}
2024-05-16 14:43:10.699 DEBUG (MainThread) [custom_components.monta] Finished fetching monta data in 0.596 seconds (success: True)
2024-05-16 14:43:10.742 DEBUG (MainThread) [custom_components.monta.services] Set up services
Bluhme1 commented 1 month ago

@RogerSelwyn OK I stand corrected. I have found the sensor. Thought it was linked to the device. And thank you for your tip concerning <>. I will do a thorough testing in the next days. But - once again - wish to express my gratitude. Closing this issue

Bluhme1 commented 1 month ago

@RogerSelwyn Been testing the last few days. It seems that the integration has stopped collecting charge data since your update May 16. The last chargeId I get is from that day. I can see logging in to the API that it has the data for the later dates.

RogerSelwyn commented 1 month ago

I'll take a look

RogerSelwyn commented 1 month ago

@RogerSelwyn Been testing the last few days. It seems that the integration has stopped collecting charge data since your update May 16. The last chargeId I get is from that day. I can see logging in to the API that it has the data for the later dates.

Is is the last_charge sensors that is wrong?

Bluhme1 commented 1 month ago

Yes.

RogerSelwyn commented 1 month ago

Probably worth commenting on the PR next time. I screwed up some sorting, should be OK with latest commit.

Bluhme1 commented 1 month ago

Works beautifully Will comment on PR next time Thank you