setCapabilityValue when triggering a Action card

Hei,
I’m trying to make my first app and want to sett the battery value when an action card is triggered. Have tried many different approaches and got one to work but then it stopped working. Can’t figure out what I did to get it to work or what I did to break it. I know that I can set it on a “schedule” so its always is up to date, but I am concerned that it is going to use up the battery when I don’t often need to see how much is left.

I am new to making apps and new to javascript so grateful for all help.

Let us consult our crystal balls :crystal_ball: We’ll get back to you when we have received an answer from the afterlife.

Or, in case our crystal balls aren’t functioning properly, perhaps you can share your app’s code on Github or something similar so others can take a look at it.

I don’t really understand what the problem is though.

From looking at the packages you’re including, it looks like you’re trying to implement a device driver for Nissan Leaf cars, and you want to be able to track the battery level of those cars. If that’s the case, what does that have to do with flows? The way it would normally work is that you receive (or ask for) the car’s battery level, and update the capability accordingly. That’s unrelated to flows.

When the charger starts i want to request the status from the car. If it’s that car that is charging I want to get the homey to notify me of how long it going to take.
I don’t check battery status on my phone so I don’t want to use battery on homey constantly requesting battery status.