openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

[tesla] shiftstate changed from UNDEF to P and vice versa #3832

Closed bassmaster187 closed 3 years ago

bassmaster187 commented 6 years ago

My eventlog is full of shiftstate changed from UNDEF to P and vice versa.

2018-08-14 10:42:45.323 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:42:51.246 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:43:55.258 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:44:08.343 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:45:15.326 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:45:21.224 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:46:25.435 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:46:36.280 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:47:45.233 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:47:51.171 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:48:55.159 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:49:06.194 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:50:15.181 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:50:22.241 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:51:26.110 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:51:36.332 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:52:45.154 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:52:52.408 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:53:55.329 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:54:06.402 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:55:15.322 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:55:21.212 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:56:25.234 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:56:36.236 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:57:45.368 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 10:57:51.235 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 10:58:49.638 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to R
2018-08-14 10:59:04.377 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from R to D
2018-08-14 11:03:53.170 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from D to R
2018-08-14 11:03:57.439 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from R to D
2018-08-14 11:04:11.173 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from D to P
2018-08-14 11:07:55.277 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 11:08:06.241 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 11:09:15.284 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 11:09:21.261 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 11:10:25.348 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 11:10:37.228 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 11:11:45.297 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 11:11:51.249 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 11:12:55.218 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 11:13:12.125 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 11:14:15.210 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 11:14:21.106 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 11:15:25.096 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 11:15:37.241 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 11:16:45.403 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 11:16:52.149 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 11:17:55.229 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 11:18:07.149 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P
2018-08-14 11:19:15.185 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from P to UNDEF
2018-08-14 11:19:21.131 [vent.ItemStateChangedEvent] - Teslarossa_shiftstate changed from UNDEF to P

that's how my mysql persistance table looks like:

| 2018-08-14 10:20:21 | P     |
| 2018-08-14 10:21:35 | P     |
| 2018-08-14 10:22:52 | P     |
| 2018-08-14 10:24:05 | P     |
| 2018-08-14 10:25:22 | P     |
| 2018-08-14 10:26:36 | P     |
| 2018-08-14 10:27:50 | P     |
| 2018-08-14 10:29:05 | P     |
| 2018-08-14 10:30:21 | P     |
| 2018-08-14 10:31:36 | P     |
| 2018-08-14 10:32:51 | P     |
| 2018-08-14 10:34:07 | P     |
| 2018-08-14 10:35:21 | P     |
| 2018-08-14 10:36:36 | P     |
| 2018-08-14 10:37:52 | P     |
| 2018-08-14 10:39:09 | P     |
| 2018-08-14 10:40:21 | P     |
| 2018-08-14 10:41:36 | P     |
| 2018-08-14 10:42:51 | P     |
| 2018-08-14 10:44:08 | P     |
| 2018-08-14 10:45:21 | P     |
| 2018-08-14 10:46:36 | P     |
| 2018-08-14 10:47:51 | P     |
| 2018-08-14 10:49:06 | P     |
| 2018-08-14 10:50:22 | P     |
| 2018-08-14 10:51:36 | P     |
| 2018-08-14 10:52:52 | P     |
| 2018-08-14 10:54:06 | P     |
| 2018-08-14 10:55:21 | P     |
| 2018-08-14 10:56:36 | P     |
| 2018-08-14 10:57:51 | P     |
| 2018-08-14 10:58:49 | R     |
| 2018-08-14 10:59:04 | D     |
| 2018-08-14 11:03:53 | R     |
| 2018-08-14 11:03:57 | D     |
| 2018-08-14 11:04:11 | P     |
| 2018-08-14 11:08:06 | P     |
| 2018-08-14 11:09:21 | P     |
| 2018-08-14 11:10:37 | P     |
| 2018-08-14 11:11:51 | P     |
| 2018-08-14 11:13:12 | P     |
| 2018-08-14 11:14:21 | P     |
| 2018-08-14 11:15:37 | P     |
| 2018-08-14 11:16:52 | P     |
| 2018-08-14 11:18:07 | P     |
| 2018-08-14 11:19:21 | P     |
| 2018-08-14 11:20:38 | P     |
| 2018-08-14 11:21:51 | P     |
| 2018-08-14 11:23:07 | P     |
| 2018-08-14 11:24:22 | P     |
| 2018-08-14 11:25:37 | P     |
| 2018-08-14 11:26:52 | P     |
| 2018-08-14 11:28:07 | P     |
| 2018-08-14 11:29:22 | P     |
| 2018-08-14 11:29:58 | R     |
| 2018-08-14 11:30:13 | D     |
| 2018-08-14 11:35:48 | R     |
| 2018-08-14 11:36:01 | D     |
| 2018-08-14 11:36:12 | P     |
| 2018-08-14 11:39:07 | P     |
| 2018-08-14 11:40:22 | P     |
| 2018-08-14 11:41:37 | P     |

I've got 20000 rows in a couple of days.

Expected Behavior

I would suspect to see just a change of the shiftstate in the DB. That makes easier to run querys and don't mess up the whole table.

| 2018-08-14 10:57:51 | P | | 2018-08-14 10:58:49 | R | | 2018-08-14 10:59:04 | D | | 2018-08-14 11:03:53 | R | | 2018-08-14 11:03:57 | D | | 2018-08-14 11:04:11 | P |

Your Environment

I've got openhab2 / addons Version: 2.4.0~20180813124523-1 on Raspberry PI 3 / Raspbian jessie

wborn commented 6 years ago

Teslarossa is a good name. :-) Maybe @kgoderis is already planning to fix this?

kgoderis commented 6 years ago

@wborn @bassmaster187 Nope. Sorry, it has nothing to do with the binding itself, it is the Tesla back-end that is acting weird and sending out sh*t data

cguedel commented 5 years ago

@kgoderis Any thoughts about filtering those null values out?

kgoderis commented 5 years ago

@cguedel As far as I can remember (very very long time ago) the Tesla back-end is in fact causing this, e.g. it is not reporting back the shift state correctly. I am not sure we can do anything about this

cguedel commented 5 years ago

@kgoderis Yeah, it seems to come from the backend, but judging from the fact the car never is not in a gear other than P, R, N, D, I suggest to just not handle an invalid shift state so the binding does not report a change to UNDEF then. What do you think?

sjonez commented 3 years ago

I know this is an old thread but the binding still has this behaviour today and after looking into it it looks like on some cars the Shift State will be reported as null/undefined once it is preparing to sleep.

more info here: https://support.teslafi.com/en/knowledge-bases/2/articles/640-enabling-sleep-settings-to-limit-vampire-loss

So rather than simply updating the channel to UNDEF the binding could probably use that as a trigger to immediately change the car to inactive and stop requesting data to allow the car to sleep

hmerk commented 3 years ago

closed due to inactivity