jakoblichterfeld / teslamate-telegram-bot Goto Github PK
View Code? Open in Web Editor NEWA telegram bot which sends a message if an update for your Tesla is available (use TeslaMate MQTT)
License: MIT License
A telegram bot which sends a message if an update for your Tesla is available (use TeslaMate MQTT)
License: MIT License
This action is ARCHIVED and will not receive any updates, update your workflows to use the official Docker action docker/setup-buildx-action@v1
see: https://github.com/marketplace/actions/docker-setup-buildx
v0.7.3 runs on test system, fails on production with:
teslamatetelegrambot | Traceback (most recent call last):
teslamatetelegrambot | File "/app/./src/teslamate_telegram_bot.py", line 227, in
teslamatetelegrambot | asyncio.run(main())
teslamatetelegrambot | File "/usr/local/lib/python3.12/asyncio/runners.py", line 194, in run
teslamatetelegrambot | return runner.run(main)
teslamatetelegrambot | ^^^^^^^^^^^^^^^^
teslamatetelegrambot | File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
teslamatetelegrambot | return self._loop.run_until_complete(task)
teslamatetelegrambot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
teslamatetelegrambot | File "/usr/local/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete
teslamatetelegrambot | return future.result()
teslamatetelegrambot | ^^^^^^^^^^^^^^^
teslamatetelegrambot | File "/app/./src/teslamate_telegram_bot.py", line 205, in main
teslamatetelegrambot | await check_state_and_send_messages(bot, chat_id)
teslamatetelegrambot | File "/app/./src/teslamate_telegram_bot.py", line 172, in check_state_and_send_messages
teslamatetelegrambot | await send_telegram_message_to_chat_id(bot, chat_id, message_text)
teslamatetelegrambot | ^^^^^^^^^^^^
teslamatetelegrambot | UnboundLocalError: cannot access local variable 'message_text' where it is not associated with a value
teslamatetelegrambot exited with code 0
As a user I want to be informed when an update is available for my Tesla car. This can be done by messaging service to my mobile.
I do not want do have a full weight automation such as Openhab2, HomeAssist, NodeRed, ... running.
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
It would be great if the pip requirements were cached for docker builds, see: https://github.com/actions/cache/blob/main/examples.md#python---pip
Can you please let me know how different this notification is when compared to the official Tesla app sending a notification about an available update?
Thanks for the python implemantation (#2), to edit the source code for my own config is not the prefered way. Can we have the confi in one or more additional files?
Its possible to define a mqtt namespace variable in teslamate.
MQTT_NAMESPACE=
If it is defined, the telegram bot won't notify the update, because its looking in a wrong topic.
teslamate/$namespace/cars/2/inside_temp
would work then.
Today after updating to version 0.7.2 and 0.7.3, which caused issues #33 and #35, my server CPU usage was constantly at >90%. Probably there is an endless loop running trying to validate the config again and again.
After I stopped the (broken) teslamatetelegrambot container, CPU usage returned to normal:
Use MQTT topic teslamate/cars/$car_id/update_version
to specify which sw update is available
The proof of conecpt (#1) shows it works, perfect.
Let us implement it in python, as there are libraries for mqtt and telegram bot available for cool features in the future.
For convenient it would be great to have the dependabot enabled for the pip requirements
For convenient it would be great to have the dependabot enabled for the GitHub actions
It would be great to have it automatically deployed on docker-hub for multiple platforms
I use a separate MQTT broker with simple authentication.
MQTT_BROKER_USERNAME and MQTT_BROKER_PASSWORD are not implemented.
After upgrading to v0.7.3 I am now getting this error:
ERROR - Error: Please set the environment variable TELEGRAM_BOT_CHAT_ID to a valid number and try again.
My env variable:
TELEGRAM_BOT_CHAT_ID=-410996XXX
XXX are more digits, removed for privacy. I guess the issue is that it is a negative number. Also doesn't work if I wrap it in double quotes.
Thanks for config with files (#4). It would be cool to have it as a docker container, so no need to take care about requirments and so on as a user.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.