magico13 / ha-emporia-vue

Home Assistant Integration for Emporia Vue Energy Monitor
MIT License
475 stars 64 forks source link

Changing EVSE charge current turns off charging #193

Open hendrik42 opened 1 year ago

hendrik42 commented 1 year ago

Specifically, it does so when the integration has been running for a while (at least 1 day). When I reload the integration then changing charge current works properly.

So, I can jerry-rig something to reload ha-emporia-vue every morning, but maybe there's a way to fix this in the code? Does the integration use some kind of tokens that need to be renewed?

Thanks, Hendrik

magico13 commented 1 year ago

Odd, I'm not sure what would be different after it's been running for a while. The only tokens in play are automatically refreshed because they expire after an hour, so you'd notice much earlier if there was a problem with them. There was an API change that had this effect but that's what the last release fixed, but that would turn it off every time no matter how long it was running for.

hendrik42 commented 1 year ago

Thanks for the quick response! Is there a way for me to come provide more debugging logs/info? I didn't spot anything in the regular homeassistant log

magico13 commented 1 year ago

I'm not sure if anything would be logged but if there's any errors logged when you see this happen again definitely let me know. I'll try to keep an eye on mine, I don't adjust the charge rate that often on mine but I'll try to do it for the next few days. I unfortunately just restarted mine about 12 hours ago.

hendrik42 commented 1 year ago

Ok it happened again. Looks like sometimes it takes more than 24h. I made a screen recording of it:https://drive.google.com/file/d/15-xVqcO9UL_4rqLnb7_e0B9xZgXDd9Zs/view

In the recording, we start out charging, but it pauses when I set the charge rate using the emporia vue plugin. I then manually restart charging, reload the plugin, and afterwards setting the charge rate works as expected.

magico13 commented 1 year ago

Thanks, that definitely helps! I'll have to review the order of the API calls but I wonder if it's getting a bad initial state and copies that in. If I can't easily get a better initial state then it might be fine to just assume it should be on if you're changing the charging current.

jax0m commented 1 year ago

Hey! +1 on this, love the integration overall but seeing the same behavior when I call the service to change while actively charging it heads over to Paused.

Happy to support any diags if needed, running latest plus with the newer unit with PIN code

motoridersd commented 1 year ago

+1 on this issue. My Vue Connect died and while waiting for a replacement, I've been looking into automating Excess Solar charging via HA, but running into this problem.

hendrik42 commented 1 year ago

Maybe we could make it re-query the state from the EVSE every time we call set_charger_current?

motoridersd commented 1 year ago

I haven't tried diving into the code. This uses pyenv on the backend. When I change the current on the Emporia app, the charger doesn't go into a pause state, so maybe the Set Current command needs to be sent along with a turn on command. I'm curious what the flow is through pyenv/this integration that causes it to pause

jax0m commented 1 year ago

I did a little workaround on my end that seems to keep it fresh, basically in home assistant if the car isn't home it'll turn off the port, when it's plugged in at home it turns it on. Also when at home it'll arbitrarily call a "turn on" just after midnight and afternoon.

Beyond that linked up an automation in nodered to look to pick amperage rates based on time the car expects to be at charging setpoint so it's lowest amp draw to meet target. Works great, might back off the logic as it really doesn't need to tinker with charging rate every 5min lol

motoridersd commented 1 year ago

I implemented an automation that continuously monitors the EVSE draw and compares to excess Solar energy and adjusts the amperage to use up the excess, but every time it updates the charging current, the charger pauses. I can add a Turn On event, but the updates happen fast and it keeps turning off/on.

magico13 commented 1 year ago

It's supposed to just pass the current state with only the charge current modified but it seems like it's starting with a bad initial state. It might be based on if the charger was on when Home Assistant/the integration was started, it seems where I'm pulling the state from isn't updated when the entities are updated. I'll see about fixing this tomorrow, I've got a few different ways in mind.

motoridersd commented 1 year ago

Awesome! Happy to test any changes. Thank you

magico13 commented 1 year ago

The master branch has a change to use the current state to decide if it should be on or off when the current is changed. The state is pulled from Home Assistant so if you make changes via the app it might not do what you expect if the state in HA hasn't caught up yet. If anyone is able to do some testing I'd appreciate it. I've got other pending changes in there too so there's a chance of a little instability.

jax0m commented 1 year ago

The master branch has a change to use the current state to decide if it should be on or off when the current is changed. The state is pulled from Home Assistant so if you make changes via the app it might not do what you expect if the state in HA hasn't caught up yet. If anyone is able to do some testing I'd appreciate it. I've got other pending changes in there too so there's a chance of a little instability.

Downloaded, confirmed I see the changes to files, and will do some testing. When I was able to replicate the issue it was after 24h or so, so will give it a try once time passes.

jax0m commented 1 year ago

The master branch has a change to use the current state to decide if it should be on or off when the current is changed. The state is pulled from Home Assistant so if you make changes via the app it might not do what you expect if the state in HA hasn't caught up yet. If anyone is able to do some testing I'd appreciate it. I've got other pending changes in there too so there's a chance of a little instability.

Downloaded, confirmed I see the changes to files, and will do some testing. When I was able to replicate the issue it was after 24h or so, so will give it a try once time passes.

So far so good, have had it installed for 26h and am able to call the service to change amps without it turning off the charger. Will keep testing and probably update Thursday or if it hits a roadbump.

jax0m commented 1 year ago

The master branch has a change to use the current state to decide if it should be on or off when the current is changed. The state is pulled from Home Assistant so if you make changes via the app it might not do what you expect if the state in HA hasn't caught up yet. If anyone is able to do some testing I'd appreciate it. I've got other pending changes in there too so there's a chance of a little instability.

Downloaded, confirmed I see the changes to files, and will do some testing. When I was able to replicate the issue it was after 24h or so, so will give it a try once time passes.

So far so good, have had it installed for 26h and am able to call the service to change amps without it turning off the charger. Will keep testing and probably update Thursday or if it hits a roadbump.

Just got home from a few day trip which I left the charger online and waiting and after getting home and plugging in my automation (calling the service to adjust amperage) took over and adjusted the amperage just fine without it going to paused state!

Seems to be working great!

motoridersd commented 11 months ago

I just had this issue pop up again for me yesterday. Changing the current in HA caused the charger to pause. I didn't try restarting the integration. I reboot HA often when installing HACS updates or other updates in the system.

@jax0m are you still running the workaround you mentioned earlier?

jax0m commented 11 months ago

I just had this issue pop up again for me yesterday. Changing the current in HA caused the charger to pause. I didn't try restarting the integration. I reboot HA often when installing HACS updates or other updates in the system.

@jax0m are you still running the workaround you mentioned earlier?

Yep still have it set as a couple of months ago, seems to work great overall no issues across multiple weeks.

motoridersd commented 10 months ago

I just realized I hadn't actually installed the latest version of the integration. I was using v0.8.3 instead of master. Once I installed the master branch, the issue went away.

Downside is that now I have a "pending update". I think we can push these changes to a newer official release.

hendrik42 commented 10 months ago

Thank you for the patch, it has been working great for me

On Sun, Oct 29, 2023 at 10:50 AM motoridersd @.***> wrote:

I just realized I hadn't actually installed the latest version of the integration. I was using v0.8.3 instead of master. Once I installed the master branch, the issue went away.

— Reply to this email directly, view it on GitHub https://github.com/magico13/ha-emporia-vue/issues/193#issuecomment-1784181253, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTNQJ5INXOB3C2S4RZKJWLYB2JNXAVCNFSM6AAAAAAW7DXMB6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBUGE4DCMRVGM . You are receiving this because you authored the thread.Message ID: @.***>

motoridersd commented 6 months ago

Does the latest 0.9.2 version include these changes that were on the master branch? Haven't updated my integration in a while because of the difference.

magico13 commented 6 months ago

@motoridersd Yes, the changes that were in the master branch before are now in all of the releases as well!