-
Notifications
You must be signed in to change notification settings - Fork 100
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
feat: Allow entities to be updated from TeslaMate via MQTT #564
Conversation
Thanks! I don't have anyway to test this, so I'll push it to dev. Can you see if you can get some testers to take the dev build? If after a week, it seems like nothing bad happens, I'll push to main. |
Thanks @Megabytemb, this is a great addition. It will allow me to get rid of some double sensors. I have just switched to dev. Will report back if something weird happens. |
Seems to work. But it wasn't clear to me that I had to enable the text field and fill it it before it starts working. Might not be a bad idea to default to 1, as the vast majority of people will only have 1 car linked, or at least to add it to the docs. |
Hey @petermnt |
I did not, I only saw the README.md change in this PR. That is indeed very clear. Maybe for easy discovery this page could be linked in the line about Teslamate in the README. |
GREAT new feature :-) But the usage of "Teslamate id" is not crystal clear to me. So if I have sensor like "sensor.tesla_usable_battery_level" from Teslamate I should input "tesla" as "Teslamate id" in order for the Tesla integration to read the right sensor values from MQTT? But if I change it it returns to "unknown" after very short time. |
Have a read here :)
https://github.com/alandtse/tesla/wiki/Teslamate-MQTT-Intergration
…On Fri, 21 Apr 2023, 10:22 pm elgeniskogen, ***@***.***> wrote:
GREAT new feature :-) But the usage of "Teslamate id" is not crystal clear
to me. So if I have sensor like "sensor.tesla_usable_battery_level" from
Teslamate I should input "tesla" as "Teslamate id" in order for the Tesla
integration to read the right sensor values from MQTT?
—
Reply to this email directly, view it on GitHub
<#564 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBOKABIQFMXCIIYM57EMEDXCJ3XNANCNFSM6AAAAAAWT5UD54>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
why couldn't I save my tesla mate ID? After I enter 1 and click outside the box, it still showed 'unknown'. |
Hey @fishredleung Did you end up with it working? If not, anything in the Home Assistant Log? |
Hello,
Does this mean it's working? |
ive got the same issue as @fishredleung. the ID is always showing unknown. I had a look and there is no such file I can find using file explorer. There is some stuff in the log that sounds like its sudscribing to something
|
Hey @hanabal2 Yours is working, but i'm not sure why you still get "unknown" whilst still getting MQTT sub messages in the logs. is there any error in the logs when you set the car ID? |
Same "issue" here. Set the id to 1 but keeps showing unknown. Reloaded the Tesla integration and it shows 1. Working as expected. Very nice feature, was running teslamate separate, love to see it integrated!!! Many thanks!! |
HEy @drjjr2 When you start home assistant, are there logs like "Subscribed to topic x" from the tesla intergration? |
Toggling the option off and then on seemed to do it:
|
However, now I am seeing these errors for one of the cars:
|
Hi there. Thanks for this awesome update. Before I set this up, would it make sense to disable some of the entities I'm already grabbing from TeslaMate's MQTT updates so they're not doubled up? Thanks. |
Update: After re-enabling all the devices in the custom integration and restarting, everything seems to be subscribed and I know Teslamate is sending data because the sensors I set up manually work. Hoewver, I don't see any messages about MQTT updating anything. Just the same ones from above. Edit: Definitely only see log entries for car 2.
|
I just made a pull request in teslajsonpy to fix this. will get this into the integration soon |
You don't need to, you can keep both for a bit to ensure its updating correctly |
Excellent. Any thoughts as to why I can never get data for car 1 but I do for car 2. I can see that it has subscribed to both:
|
I've just worked on a update to the teslamate class with way more logging to help us fix that. Any chance you could replace the teslamate.py file in |
@drjjr2 Please continue the discussion in the Issue. We probably shouldn't be having this conversation here |
Just stopped by to say this is awesome, thanks. On a different note, does this means we can / should change / disable polling all together? |
No.
because not all attributes are pushed to TeslaMate via MQTT, and because
not everyone has TeslaMate.
You should leave your polling rate at your desired level (660 is
recommended)
…On Sat, 6 May 2023 at 02:27, jonferreira ***@***.***> wrote:
Just stopped by to say this is awesome, thanks.
On a different note, does this means we can / should change / disable
polling all together?
—
Reply to this email directly, view it on GitHub
<#564 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBOKAHD3MQELMF2COS4JMTXEUS6BANCNFSM6AAAAAAWT5UD54>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Michael Benz
***@***.***
|
So I finally had a little bit of time to do some HA maintenance. First observation I had is once you restart after updating to this version of the extension you must wake your car up, otherwise the device id entity will remain unavailable. Regarding @Megabytemb answering my question:
I don't see entities double up more than just having this Tesla integration and MQTT coming in from Teslamate. My thought was there would be remnants of entities from the prior version of the integration from the previous method of grabbing data directly from Tesla's API. |
Hey @rubin110 When I first read your message, I thought you had manually set up entities in Home Assistant via the MQTT integration to capture the messages from TeslaMate manually (which meant you would now have some duplicate entries - some from the Tesla integration, some from the MQTT integration). Does that clear everything up? |
@Megabytemb yes 100% thank you. One thing I have been noticing and maybe it's more of a Teslamate issues, if the car has been asleep for a bit a lot of the sensor turn unavailable. |
Yeah, i noticed the same. That's not a teslamate issue, but overall how the integration handles data. There is a "force data update" button you can press (or use an automation to press) if you want to refresh the data from Tesla. |
Is there a reason why the integration doesn't just hold onto the stale data until the next refresh, instead of going to unavailable? |
I agree. This would be a preferred behavior. |
It's a HA spec to report unavailability if a data refresh fails. Absent a change in HA, we're not going to change that behavior. |
Ah ok so it's from a failed refresh and not just data that hasn't been
updated in a while? That gives me some hints then.
|
Yes, if the car is asleep, it should just preserve the last data point we had. Unavailable should only appear if we tried to do a request to the car and it failed to respond to us. Please note there is a transient 408 error where the car just refuses to respond even if it's connected. We schedule 5 retries but typically the car won't respond to the retries while in this state. |
As a way of getting more real-time updates for entities, this pull request allows you to configure the tesla_custom integration to use the the MQTT integration to get updates from TeslaMate.
This means a select few entities updates once a second, as TeslaMate publishes them via MQTT.
https://docs.teslamate.org/docs/integrations/mqtt/
This pull request add an option to the Config entry options to enable the overall connection.
It also adds a new Text entity, which is disabled by default, so you can set the TeslaMate ID for the car (aka device) in this integration.
The TeslaMate class also checks to ensure you also have the MQTT integration configured, and simply logs a warning if it doesn't.