JakobLichterfeld / TeslaMate-Telegram-Bot

A telegram bot which sends a message if an update for your Tesla is available (use TeslaMate MQTT)
MIT License
25 stars 4 forks source link

`car_id` 'int' object has no attribute 'isdigit' #33

Closed freinbichler closed 6 months ago

freinbichler commented 6 months ago

After upgrading to v0.7.2 I am getting the following error (with and without setting the CAR_ID env variable):

teslamate-teslamatetelegrambot-1  | Traceback (most recent call last):
teslamate-teslamatetelegrambot-1  |   File "/app/./src/teslamte_telegram_bot.py", line 64, in <module>
teslamate-teslamatetelegrambot-1  |     if not car_id.isdigit() or int(car_id) < 1:
teslamate-teslamatetelegrambot-1  |            ^^^^^^^^^^^^^^
teslamate-teslamatetelegrambot-1  | AttributeError: 'int' object has no attribute 'isdigit'
teslamate-teslamatetelegrambot-1  | Traceback (most recent call last):
teslamate-teslamatetelegrambot-1  |   File "/app/./src/teslamte_telegram_bot.py", line 64, in <module>
teslamate-teslamatetelegrambot-1  |     if not car_id.isdigit() or int(car_id) < 1:
teslamate-teslamatetelegrambot-1  |            ^^^^^^^^^^^^^^
teslamate-teslamatetelegrambot-1  | AttributeError: 'int' object has no attribute 'isdigit'
teslamate-teslamatetelegrambot-1  | Traceback (most recent call last):
teslamate-teslamatetelegrambot-1  |   File "/app/./src/teslamte_telegram_bot.py", line 64, in <module>
teslamate-teslamatetelegrambot-1  |     if not car_id.isdigit() or int(car_id) < 1:
teslamate-teslamatetelegrambot-1  |            ^^^^^^^^^^^^^^
teslamate-teslamatetelegrambot-1  | AttributeError: 'int' object has no attribute 'isdigit'
teslamate-teslamatetelegrambot-1  | Traceback (most recent call last):
teslamate-teslamatetelegrambot-1  |   File "/app/./src/teslamte_telegram_bot.py", line 64, in <module>
teslamate-teslamatetelegrambot-1  |     if not car_id.isdigit() or int(car_id) < 1:
teslamate-teslamatetelegrambot-1  |            ^^^^^^^^^^^^^^
teslamate-teslamatetelegrambot-1  | AttributeError: 'int' object has no attribute 'isdigit'
teslamate-teslamatetelegrambot-1  | Traceback (most recent call last):
teslamate-teslamatetelegrambot-1  |   File "/app/./src/teslamte_telegram_bot.py", line 64, in <module>
teslamate-teslamatetelegrambot-1  |     if not car_id.isdigit() or int(car_id) < 1:
teslamate-teslamatetelegrambot-1  |            ^^^^^^^^^^^^^^
teslamate-teslamatetelegrambot-1  | AttributeError: 'int' object has no attribute 'isdigit'
teslamate-teslamatetelegrambot-1  | Traceback (most recent call last):
teslamate-teslamatetelegrambot-1  |   File "/app/./src/teslamte_telegram_bot.py", line 64, in <module>
teslamate-teslamatetelegrambot-1  |     if not car_id.isdigit() or int(car_id) < 1:
teslamate-teslamatetelegrambot-1  |            ^^^^^^^^^^^^^^
teslamate-teslamatetelegrambot-1  | AttributeError: 'int' object has no attribute 'isdigit'

Btw: there is a typo in the filename teslamte_telegram_bot.py

JakobLichterfeld commented 6 months ago

Thanks for reporting, will try to reproduce and fix accordingly

freinbichler commented 6 months ago

The reason should be that .isdigit() is a String method, however car_id is of type int. However, if I set the environment variable as a string, I get the following error: ERROR - Error: Please set the environment variable CAR_ID to a valid number and try again.

JakobLichterfeld commented 6 months ago

Sorry again, was doing too much in parallel and found an issue in my test system. Will fix and release new version by today

JakobLichterfeld commented 6 months ago

Btw: there is a typo in the filename teslamte_telegram_bot.py

Good catch!

JakobLichterfeld commented 6 months ago

Will release after lunch