Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync doors open/close from Teslamate MQTT #707

Open
KrzysztofHajdamowicz opened this issue Sep 1, 2023 · 2 comments
Open

Sync doors open/close from Teslamate MQTT #707

KrzysztofHajdamowicz opened this issue Sep 1, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@KrzysztofHajdamowicz
Copy link

Is your feature request related to a problem? Please describe.
User wants to automate something car-related, where automation will be triggered by opening and closing car doors.
Currently, door status is polled from Tesla servers, instead of using Streaming API/Teslamate+MQTT.

Describe the solution you'd like
sensor.doors entity updated from Teslamate MQTT.

Describe alternatives you've considered
Current workaround is using MQTT triggers, but automation gets triggered every dozen of seconds as Teslamate periodically re-sends "doors closed" MQTT message.

trigger:
  - platform: mqtt
    topic: teslamate/cars/1/doors_open
    payload: "false"
    id: closed
  - platform: mqtt
    topic: teslamate/cars/1/doors_open
    payload: "true"
    id: open

Additional context
Task is simmilar to #698 , just another entity needs to be synced.

@alandtse alandtse added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Sep 1, 2023
@KrzysztofHajdamowicz
Copy link
Author

I spend an hour digging through the code and Teslamate MQTT topics.

So far, I understand that Tesla API shows door status with granularity {d,p}{f,r)={true,false} and Teslamate publishes teslamate/cars/$TESLAMATE_ID/doors_open={true,false} MQTT message.
That means, that from API you can get status of individual doors, while Teslamate exposes "are any doors open?"
Next, in file binary_sensor.py#L169 there is casting of Tesla API granularity into generic {true/false}

Unfortunately, I have no idea how to merge teslamate.py: MAP_VEHICLE_STATE["doors_open"] with binary_sensor.py#L169

@alandtse
Copy link
Owner

alandtse commented Sep 8, 2023

Probably change it to store the value of the or statement and let teslamate set it true or false. The polling with granularity would then update when it has new info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants