jhansche / ha-teslafi

Home Assistant integration for TeslaFi-monitored vehicles
MIT License
13 stars 0 forks source link

Missing commands #28

Closed henrikalthofknudsen closed 5 months ago

henrikalthofknudsen commented 6 months ago

The integration works very good. It´s stable and fast responding. Thanks for that :-)

However are missing a few important commands. In Teslafi.com -> Settings -> TeslaFi API -> Commands - All relevant is checked of (see screenshot)

When testing from Home Assistant e.g. the Horn and that works fine. But I am missing a few especially :

They are all checked off in TeslaFi.com but are not available in Home Assistant. Am I missing something or is the TeslaFi pluging missing this?

I would be so happy if those was available :-)

TeslaFi commands

AlisterGill commented 6 months ago

Any chance you can also add an "open charge port" command natively? Those of us without tesla chargers with the button to open the flap either need to get our phone out and open the app or open the car and do this on the screen. I've been doing this in the past with the Tesla intergration and calling this from a zigbee button press by my front door. It would be great to get this functionality natively within the intergration. Many thanks

dktrekkie commented 5 months ago

I also added this integration, because I use TeslaFi anyways. I used the custom Tesla integration before, but can’t get it to work anymore. I mostly used it to simply unlock the car and release the charge port every morning. I can’t get that to work here. I have checked all charge port commands on TeslaFi but they don’t become available in this integration. Am I missing something?

AlisterGill commented 5 months ago

@dktrekkie Indeed - I couldn't find the commands in the integration and installed this one as the old tesla intergration needed fleet API etc. I can fire the charge port opening (and assumingly other commands) direct from the API so it just looks like it could be added to the intergration controls along with honking the horn and flashing the lights.

dktrekkie commented 5 months ago

@dktrekkie Indeed - I couldn't find the commands in the integration and installed this one as the old tesla intergration needed fleet API etc. I can fire the charge port opening (and assumingly other commands) direct from the API so it just looks like it could be added to the intergration controls along with honking the horn and flashing the lights.

Yeah. It could be really nice to get those commands available in this integration, because then this is actually a pretty good alternative to the custom integration – requiring proxies etc to work now, for people who already use TeslaFi.

dktrekkie commented 5 months ago

Hmm. Have been playing a bit around in Node-Red calling the API manually. But it seems it's not possible to just unlocking the charge port. You can open the charge port door, but not unlock it :(

AlisterGill commented 5 months ago

Does opening the charge point door not also unlock it? On the alandtse tesla integration I had a button by the door and the "Unlock Charge port latch" action would open the port and if it was already connected would unlock the charge cable.

dktrekkie commented 5 months ago

It actually does. Nice! My mistake! I actually only checked it on the phone, expecting it to show as unlocked there - which it does not.

snooty83 commented 5 months ago

Hello

I found problems. Start Sentry mode -> works. Exit Sentry mode -> doesn't work. The button changes to deactivated but it doesn't do it. Can you check this? They also have a few commands listed as unavailable. How can this be activated? Charger level Charger power Charger Voltage Charger Current Charge Time Remaining

This is all available on TeslaFi. Set Charge Level Set Charge Amps

Thanks

Greetings Dani

Edit 1: Fehler beim Aufrufen des Diensts alarm_control_panel/alarm_arm_away. cannot access local variable 'result' where it is not associated with a value

jhansche commented 5 months ago

@snooty83 please open a new issue for sentry mode. For the charger entities, those are unavailable if the car is not plugged in, or in some cases if it is plugged in but not charging. Also some of the entities are hidden or disabled by default and will need to be enabled manually if you want to use them.

snooty83 commented 5 months ago

@jhansche I'm not sure. Unfortunately I can't check it until next week due to the lack of charging options. But if it were the case that it would only be available when a charger is connected, then in my opinion this would be wrong. I should have the opportunity to set the charging limit and voltage before charging. Just like on TeslaFI.

Greetings Dani

jhansche commented 5 months ago

Those entities I'm talking about are read-only. They report the current and voltage that are being delivered to the car. They cannot be changed.

snooty83 commented 5 months ago

@jhansche I mean this one:

TeslaFI

jhansche commented 5 months ago

I know what you mean 🙂 And that is what the rest of this ticket is about: adding support for additional TeslaFi commands.

I'm referring to these that you mentioned above:

They also have a few commands listed as unavailable. How can this be activated? Charger level Charger power Charger Voltage Charger Current Charge Time Remaining

Those are "Unavailable" like this in Home Assistant, when the car is not plugged in (or not charging). They are read-only entities. Screenshot 2024-04-11 at 10 07 33 AM

snooty83 commented 5 months ago

It would be great if we could manage that. Unfortunately, I'm also a Tesla integration nerd because of the new API. and their integration is a great alternative. I've been using TeslaFI for years. Thanks for your work

Greetings Dani

snooty83 commented 5 months ago

@jhansche

Hello

A question. How is the scan interval set? So how often is the data retrieved from TeslaFi.com? Can this be changed somewhere?

Best regards Dani

jhansche commented 5 months ago

@snooty83 Please do not hijack unrelated issues for support questions. I've just enabled Github Discussions for the project, so please ask your questions there.

jhansche commented 5 months ago

I've opened 2 new PRs for testing, if anyone would like to test these before releasing.

I tested the new entities from #35 (my car does not have a heated steering wheel, so I only "tested" that it shows an error 😅), but now the other half has the car so I can't test #36 until later.

Anyone interested in testing these, please install the HACS version by PR branch, which you can do with the following service in Developer Tools > Services:

service: update.install
target:
  # This entity is provided by HACS
  entity_id: update.teslafi_update
data:
  # Uncomment just ONE of these `version` lines

  ## for #35 only
  #version: fix-28/add-commands

  ## for #35 plus #36 (with start/stop charge)
  #version: fix-28/charger-switch

Keep in mind that if you do this, HACS will likely offer the current latest release (v2.5) as an update -- but that will downgrade you back to v2.5, so just ignore it unless you want or need to roll back.

Also note that these new entities are disabled by default - this is because the TeslaFi API commands must be manually enabled. So once you've enabled the TeslaFi commands, go to the device info page, and find and enable the entities you want to test: Screenshot 2024-04-13 at 1 48 43 PM

I tried to handle various error cases, but there may still be some edge cases that are not handled. If you're going to test this, and especially if you need to report any issues with the new entities, please enable debug logging for the integration, either from the Settings > Integrations > TeslaFi screen, or in your configuration.yaml:

logger:
  default: info
  logs:
    custom_components.teslafi: debug
snooty83 commented 5 months ago

@jhansche I would like to update, but I don't understand your code. Sorry, I'm still a beginner :-)

What exactly needs to be entered into the services if I want to update it?

for #35 plus #36 (with start/stop charge)

Can you show the code as it should be so I can copy it and learn from it?

Greetings Dani

jhansche commented 5 months ago

@snooty83 exactly as it is in the block above, but remove the # in front of the version line you want to use. So to use the version with start/stop charge, go to Developer Tools > Services, and then click "GO TO YAML MODE" button. Paste this into the box, and click "CALL SERVICE"

service: update.install
target:
  entity_id: update.teslafi_update
data:
  version: fix-28/charger-switch

Read Developer Tools to learn more about HA dev tools.

Then once HA restarts, remember you need to enable the entity(ies) that you want to test:

  1. Settings > Integrations > TeslaFi
  2. "N Device(s)"
  3. in the "Diagnostic" section click "+N entities not shown" to expand the list and show the disabled entities
  4. select the entity you want to enable (Charging for the start/stop switch)
  5. in the top-right of the dialog, click the settings cog ⚙️ icon
  6. toggle the switch for "Enabled"
  7. click Update
  8. Repeat for other entities you want to enable
  9. wait ~30 seconds for the integration to reload and add the enabled entities
jhansche commented 5 months ago

I just had a chance to test these myself, and there was an issue with the charge port door cover entity - that is fixed now, so if you tried it before now, you may need to run the update service again (same version, just run it again and restart HA again).

I also tested the Charging switch, and it is working correctly - but there is a small bug where the switch reverts back to the state it was in before clicking. The vehicle got the correct command, and if you wait for the entity to update on the polling interval, it will correct itself. I'm pushing a fix for that now, so it will also be included when you run the update service, as of now.

jhansche commented 5 months ago

These new entities are released in version 2.6

snooty83 commented 5 months ago

@jhansche I have installed pre-release 2.6. I tested Set Charge Limit during sleep mode. This error message comes:

image

This wakes up Dau’s car. I can then set the limit again and it will be applied.

Greetings Dani

jhansche commented 5 months ago

If there is any error from TeslaFi, we just raise it up. So that's what you're seeing.

I can add a flag that should work around this error by instructing TeslaFi to wake the car and wait before proceeding with the command.

jurviz commented 4 months ago

Somehow i can't find out how to set the charge current in the car using this custom integration. Currently i'm using the Go-eCharger integration to set the current of the charger, but this only allows me to adjust as low as 6A. To set even lower i would like to use this integration.

PS: Found solution, it is working when i set request_charger_current.