maorcc / citymind_water_meter

Home Assistant Integration with cp.city-mind.com, an Israeli water meters reading service
Apache License 2.0
41 stars 2 forks source link

Cannot add the integration - getting unknown error message #70

Closed drorya1 closed 3 months ago

drorya1 commented 4 months ago

Integration stopped working I removed the integration and added it again . While it is installed in HACS , when I try to add it to Integration I get "unknown error occurred" I validated and this is the exact same PWD used in https://rym-pro.com/#/

chrome_FRNRVTu6dp

elad-bar commented 4 months ago

Do you have logs to share (debug log level)? Did you remove it from HA or HACS? Did you restart the HA in between?

Thanks

drorya1 commented 4 months ago

There are no logs as apparently the integration is installed on Hacs but is not installed as integartion. I added the debug to logger but could not find anything related to it . I have removed it from HACS and from Integration as well as removed old integration which was still there ( by removing the directory from custom components ) Next step would be to restore a backup to see if this is solved . I rebooted in between

On Sun, Jun 2, 2024, 18:05 Elad Bar @.***> wrote:

Do you have logs to share (debug log level)? Did you remove it from HA or HACS? Did you restart the HA in between?

Thanks

— Reply to this email directly, view it on GitHub https://github.com/maorcc/citymind_water_meter/issues/70#issuecomment-2143891807, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATBF5GZCO5JHEJOBGCIYOCTZFMYELAVCNFSM6AAAAABIVEEGOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTHA4TCOBQG4 . You are receiving this because you authored the thread.Message ID: @.***>

eyalcha commented 4 months ago

@elad-bar Don't know if it is the same issue, but I fail to connect

image
elad-bar commented 4 months ago

Without logs I cannot assist

elad-bar commented 4 months ago

Please follow the next steps and share the resilt:

Please note that integration name is citymind not read your meter pro, in addition, please state you HA version

Thanks

elad-bar commented 4 months ago

@eyalcha you have tried to set up read your meter pro which is official integration based on this repo but still WIP

Please report the issue in HA core repo.

Thanks

arnonsha commented 4 months ago

addon also doesn't load for me.

image

In core log file I see the following: 2024-06-02 21:32:00.767 ERROR (MainThread) [custom_components.citymind_water_meter] Failed to load CityMind, error: , line: 36

drorya1 commented 4 months ago

Just to mention I just rolled back to 30May backup and it seems to be working now. I suspect something with the update might be buggy . I will share more feedback if I see that there are errors or malfunction .

On Sun, Jun 2, 2024, 21:41 arnonsha @.***> wrote:

addon also doesn't load for me.

image.png (view on web) https://github.com/maorcc/citymind_water_meter/assets/35176391/872e660b-959b-4d68-b195-6a187f457e1c

In core log file I see the following: 2024-06-02 21:32:00.767 ERROR (MainThread) [custom_components.citymind_water_meter] Failed to load CityMind, error: , line: 36

— Reply to this email directly, view it on GitHub https://github.com/maorcc/citymind_water_meter/issues/70#issuecomment-2143982161, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATBF5G6WRNN3ZJZRMOMLUNDZFNRN5AVCNFSM6AAAAABIVEEGOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBTHE4DEMJWGE . You are receiving this because you authored the thread.Message ID: @.***>

elad-bar commented 4 months ago

@arnonsha did you set debug log level? Did you follow the steps for clean install?

@drorya1 I guess you are on v2.0.15 now, is that correct? Can you enable debug logs (from logger component not ui) and upgrade again? You can revert to previous versions using hacs (redownloaf) no need to restore backup

Thanks

mikeage commented 4 months ago

With v3.0.3, I was also getting a mostly blank print (2024-06-03 11:25:08.358 ERROR (MainThread) [custom_components.citymind_water_meter] Failed to load CityMind, error: , line: 36 )

By adding a bit of debug when the exception is thrown, I got this:

2024-06-03 11:25:08.358 ERROR (MainThread) [custom_components.citymind_water_meter] Failed to load CityMind, error: , line: 36
2024-06-03 11:25:08.358 ERROR (MainThread) [custom_components.citymind_water_meter] exc_type: <class 'cryptography.fernet.InvalidToken'>
2024-06-03 11:25:08.358 ERROR (MainThread) [custom_components.citymind_water_meter] exc_obj:
2024-06-03 11:25:08.359 ERROR (MainThread) [custom_components.citymind_water_meter] tb: <traceback object at 0x7f959bc89f80>
2024-06-03 11:25:08.359 ERROR (MainThread) [custom_components.citymind_water_meter]
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/cryptography/fernet.py", line 130, in _verify_signature
    h.verify(data[-32:])
cryptography.exceptions.InvalidSignature: Signature did not match digest.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/citymind_water_meter/__init__.py", line 36, in async_setup_entry
    await PasswordManager.decrypt(hass, entry_config, entry.entry_id)
  File "/config/custom_components/citymind_water_meter/managers/password_manager.py", line 62, in decrypt
    password_decrypted = instance._decrypt(password)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/citymind_water_meter/managers/password_manager.py", line 128, in _decrypt
    data = self._crypto.decrypt(data.encode()).decode()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/cryptography/fernet.py", line 89, in decrypt
    return self._decrypt_data(data, timestamp, time_info)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/cryptography/fernet.py", line 148, in _decrypt_data
    self._verify_signature(data)
  File "/usr/local/lib/python3.12/site-packages/cryptography/fernet.py", line 132, in _verify_signature
    raise InvalidToken
cryptography.fernet.InvalidToken

For now, I've reverted to v2.0.15

elad-bar commented 4 months ago

will update documentation and make it clearer

It means that encryption key was modified from outside the code, Please remove the integration and re-add it to make it work again.

if still not working, remove the integration (from devices & service not hacs) again, in /config/.storage directory remove files contains citymind, restart and set up integration again

mikeage commented 4 months ago

I'm afraid that wasn't enough. I updated again to 3.0.3, removed the integration, deleted these two files:

.storage/.citymind_water_meter
.storage/citymind_water_meter.9b1ce813b6d085b692e806fa39d61bec.config.json

And then tried adding it again. Failed with:

2024-06-03 11:51:52.801 INFO (MainThread) [custom_components.citymind_water_meter.managers.flow_manager] Config flow started, Step: user, Input: None
2024-06-03 11:52:03.740 INFO (MainThread) [custom_components.citymind_water_meter.managers.flow_manager] Config flow started, Step: user, Input: {'email': 'XXXXX', 'password': 'XXXXX'}
2024-06-03 11:52:03.740 INFO (MainThread) [custom_components.citymind_water_meter.managers.config_manager] loaded: None
2024-06-03 11:52:03.741 INFO (MainThread) [custom_components.citymind_water_meter.managers.config_manager] default_configuration: {'meters': {}}
2024-06-03 11:52:03.741 INFO (MainThread) [custom_components.citymind_water_meter.managers.config_manager] adding meters
2024-06-03 11:52:03.741 INFO (MainThread) [custom_components.citymind_water_meter.managers.config_manager] updated
  File "/config/custom_components/citymind_water_meter/config_flow.py", line 36, in async_step_user
  File "/config/custom_components/citymind_water_meter/managers/flow_manager.py", line 69, in async_step
drorya1 commented 4 months ago

@Elad bar Indeed I am on 2.0.15 tried to update to 3.0.3 and the integration does not work Unfortunately I cannot roll back see attached clip I will try to delete mannually

On Sun, Jun 2, 2024 at 11:58 PM Elad Bar @.***> wrote:

@arnonsha https://github.com/arnonsha did you set debug log level? Did you follow the steps for clean install?

@drorya1 https://github.com/drorya1 I guess you are on v2.0.15 now, is that correct? Can you enable debug logs (from logger component not ui) and upgrade again? You can revert to previous versions using hacs (redownloaf) no need to restore backup

Thanks

— Reply to this email directly, view it on GitHub https://github.com/maorcc/citymind_water_meter/issues/70#issuecomment-2144018652, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATBF5G2VDHR4BRZXXYRUXODZFOBP7AVCNFSM6AAAAABIVEEGOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBUGAYTQNRVGI . You are receiving this because you were mentioned.Message ID: @.***>

drorya1 commented 4 months ago

config_entry-hacs-4f0fd37a37158caccbd39a15b513591b.json

https://github.com/maorcc/citymind_water_meter/assets/79847067/6a096637-d0cf-49c3-a39c-2a82cdd95d40

drorya1 commented 4 months ago

@elad-bar Reverting back to 2.0.15 restores the service

Arielgordon123 commented 4 months ago

It's happened to me too when upgrading from 2.0.15 to 3.0.3

elad-bar commented 4 months ago

Did you try what I wrote above?

drorya1 commented 4 months ago

I added all the info from the HA after the update . Rolled back to 2.0.15 and it started working again. If U need additional feedback please state what is needed ?

On Fri, Jun 7, 2024 at 7:03 PM Elad Bar @.***> wrote:

Did you try what I wrote above?

— Reply to this email directly, view it on GitHub https://github.com/maorcc/citymind_water_meter/issues/70#issuecomment-2155124835, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATBF5G4EJH46GGLZDQDDI2LZGHKUFAVCNFSM6AAAAABIVEEGOCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVGEZDIOBTGU . You are receiving this because you were mentioned.Message ID: @.***>

Fannangir commented 4 months ago

I see the same issue in 3.0.4. Reinstalled the integration (after removing and adding again from HACS) solved the issue.

elad-bar commented 3 months ago

is it still relevant?

thanks

arnonsha commented 3 months ago

I removed and reinstalled. Solved my problem I also see that the meter name now also contains the full name and not just the meter number which is very helpful (I have few meters)

Fannangir commented 3 months ago

Issue solved by reinstalling the integration. Thank you very much.

mikeage commented 3 months ago

I can also confirm that removing and reinstalling was required, but fixed the issue for me as well. Just doing a "reload" or even "(re-)configure" after upgrading to 3.0.5 was insufficient.

elad-bar commented 3 months ago

thanks, @mikeage next time i will conduct testing for the scenario of upgrading before releasing

drorya1 commented 3 months ago

Working for me as well

On Tue, Jun 25, 2024, 10:34 Elad Bar @.***> wrote:

Closed #70 https://github.com/maorcc/citymind_water_meter/issues/70 as completed.

— Reply to this email directly, view it on GitHub https://github.com/maorcc/citymind_water_meter/issues/70#event-13276611255, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATBF5G3QDDKKLPJE2HV6LELZJEMQBAVCNFSM6AAAAABIVEEGOCVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTGI3TMNRRGEZDKNI . You are receiving this because you were mentioned.Message ID: @.***>