Closed wirecuttr closed 10 months ago
I think I understand. I likely need to add an await there. Not sure why it would work normally but fail in that case but that seems like something I can fix.
Great. Thanks for the quick reply.
I'm trying to get this set up in my test environment but I'm going to have to come back to it a bit later I think. Turns out all the documentation and examples I can find, even within the Home Assistant code, has those calls used the same way I'm using them. Despite them being called async
they're not awaitable. I'm going to set up the tile card and do some debugging on the service to see what's different between Home Assistant calling it and that card calling it.
Ok I think I got something working. First download the latest version of the master of this repo, I had to cast a string to an integer to handle the current being a string from the card.
Then update your card to look like this. The entity id has to be passed as an array because for some reason Home Assistant does that. The async wasn't the cause of the issue at all as far as I can tell, just a few type mismatches coming from the service tile compared to "normal".
type: custom:service-call
entries:
- type: slider
icon: mdi:ev-station
service: emporia_vue.set_charger_current
target:
entity_id:
- switch.ev_charger
range:
- 6
- 48
step: 1
value_attribute: charging_rate
thumb: default
label: ATTRIBUTE[charging_rate] A
data:
current: VALUE
Thanks for figuring this out! I'll add some logic to my project to not convert the slider value to string if the data key is just the value.
Any idea why it was throwing Failed to call service emporia_vue/set_charger_current. 'NoneType' object has no attribute 'unique_id'
?
I wasn't able to recreate getting that specific error. I'm not sure how it could even happen because the check right before it should prevent any None objects from getting to that point. It being a race condition seemed reasonable until I actually got in there and confirmed that the data types were a bit off and all the examples code I found lines up with what I was already doing. Fingers crossed that doesn't show up again somehow.
Thanks for sorting this out. The slider seems to be working for me now!
Hi, I was trying to use the service-call-tile-feature and ran into an issue trying to change the charging current via service call. The developer of that card looked into it and believes the issue is with a race condition due to the use of the async call. It's a bit above my head: https://github.com/Nerwyn/service-call-tile-feature/issues/3#issuecomment-1793277123 Thoughts?