gcobb321 / icloud3

iCloud3 v3 - iCloud3 is an advanced iDevice tracker that uses Apple iCloud account and HA Companion App data for presence detection and location based automations.
MIT License
586 stars 53 forks source link

ValueError: invalid literal for int() with base 10: 'unavailable' #352

Closed JPM-git closed 2 months ago

JPM-git commented 4 months ago

I have this issue for sometime now but today i decided to open this ticket in order to get is sorted :)

Every 5 seconds i get this erros on the log: 07-05 00:04:20 Traceback (most recent call last): File "/config/custom_components/icloud3/icloud3_main.py", line 314, in _polling_loop_5_sec_device Device.update_battery_data_from_mobapp() File "/config/custom_components/icloud3/device.py", line 1922, in update_battery_data_from_mobapp battery_level = int(battery_level_attrs[STATE]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: invalid literal for int() with base 10: 'unavailable'

I've gone to the setup menu, selected Sensors and remove every single one that are related to the battery with no visible result :(

gcobb321 commented 4 months ago

Check the entity name for the mobile app battery entity in Stage 4 of the Event Log and see if there is one for the device. Also check the Mobile App integration for the battery sensor name and the Developer Tools > State for the battery. If the Mobile App is not creating it, go to the HA app on the device and make sure the battery sensor is enabled.

ICloud3 should catch the error and handle it instead of the error you got and I’ll look into that.