Smart Home battery charging

wenna

Member
Aug 1, 2023
209
143
Sweden
Anyone figured out how to use your smart home system to charge the e-bike to a pre-set charge automatically?

I have a "smart home" that is controlled by a Homey Pro hub. The wall socket I use to charge the bike has a smart relay with energy monitoring that I can control.

I wanted to create a "flow" that automatically switches off the socket to the charger when the battery reaches around 80%.
Could I look at the power draw from the socket when the battery is at 80% and use that?
Let´s say it draws 150w when the battery is at 80%. Could I program a set of rules that when the power draw from the socket goes below 150w it should turn off?

So I´m basically wondering if it is possible to correlate a certain amount of power draw to a certain amount of battery charge?


Charger.jpg
 

wenna

Member
Aug 1, 2023
209
143
Sweden
If anyone is interested it turned out that the load on the socket could not be used as the charger has a pretty much constant load until the last few percent.

What I did was use the cumulative meter of the socket instead to create a "flow" that tops up the battery with a set amount of wh. As I´m mostly at around 20-30% battery capacity left when it´s time to charge I created a flow to top up with 360wh (50% of the 720wh battery).

How the flow works:

Start Charging

1 - I start the flow either by a "hey google" voice command or from the phone.
2 - When the flow is started it takes a reading from the meter and stores it in a Variable.
3 - It then sets a Yes/No variable to Yes. This variable is to know that the battery is charging (without it the socket would turn off every time it has used 360w when using it for other things)
4 - It also turns on the socket that the charger is plugged into.

Stop Charging
5 - When the meter changes it checks if the bike battery is charging (The Yes/No variable that was set to Yes in step #3)
6 - If it is charging it then checks if the meter reading has reach the sum of 360wh + the reading it started with (that was stored in a Variable in step # 2)
7 - When step #6 is true (the meter has reached start value + 360wh):
- It turns the socket off
- Sets the Yes/No variable to No (Meaning the bike is not charging, so that I can use the socket for other things without it turning off)
- Sends a message to my phone that it has finished charging.

Cykelladdning.jpg
 

wenna

Member
Aug 1, 2023
209
143
Sweden
Took it a step further. It now sends a message to my phone when finished charging with the exact amount of wh it has charged as well as how much it did cost (It pulls the current electricity price from my provider to calculate the cost)

Cykelladdning_message.jpg
 

wenna

Member
Aug 1, 2023
209
143
Sweden
Added one more step to the flow.
Now, every time the bike have been charged, it publishes the date, electricity used and cost of electricity to a new row in a Google spreadsheet.

It will now monitor the exact amount of electricity used and the cost of it throughout the bikes lifetime.

batteriladdning.png
 

lovespicyfood

New Member
Nov 24, 2023
45
12
California
This is pretty slick! I am just using a "smart" plug with my dumb charger. I try to keep storage state around 60% so I multiply each percentage point I'm away from that times four and usually add 4-6 more minutes. This gets me to within a percent or two of 60% pretty much most of the time. When I know I have a big ride, I set the smart plug to turn on hours before to ensure I'm at 100%.
 

wenna

Member
Aug 1, 2023
209
143
Sweden
This is pretty slick! I am just using a "smart" plug with my dumb charger. I try to keep storage state around 60% so I multiply each percentage point I'm away from that times four and usually add 4-6 more minutes. This gets me to within a percent or two of 60% pretty much most of the time. When I know I have a big ride, I set the smart plug to turn on hours before to ensure I'm at 100%.
That´s an easy way of doing it. I just got carried away with it because I like tinkering with the smart system in my home.

I created several flows like the one above for 25%, 35%, 50%, 75% and 100%.

So when I´m done riding depending on how much battery I have left I just say a voice command to the google speaker in my garage how much to charge it with. So If I have 30% left I tell it to charge 35% and it will enable the socket and top it up with 250Wh and then turn off the socket. Next time I´m going to go ride I just start the 100% flow before.

When I get up in the morning and it´s not a work day I get a popup on my phone asking if I want to start the car heater and I just press yes or no. I might make a similar thing for the bike charger so It askes me If I will be riding today. If I enter yes then it will start charging the bike to 100%.

I think the next step is I will try to create a flow where I can tell it any percentage to charge in one singel flow. If I tell it to charge 42% it will charge 302Wh. I just haven´t managed to get it to work yet.
 
Last edited:

DieBoy

Active member
Jul 14, 2023
111
163
EU
@wenna hej, cool project.

I'm curious, how are you dealing with the (in)efficiency of the charger?

Because 360w out from the power socket won't equal 360w in the battery.

Are you using an average efficiency rate?
 

wenna

Member
Aug 1, 2023
209
143
Sweden
@wenna hej, cool project.

I'm curious, how are you dealing with the (in)efficiency of the charger?

Because 360w out from the power socket won't equal 360w in the battery.

Are you using an average efficiency rate?
I have not taken that into account as I do not really need it to be that exact. If I want it to top up 35% and it charges 30% that is ok. Every time I charge it to 100% I use the load instead to turn the charger off, so for 100% it will be exact. I will still get the correct electricity usage and cost.

If/when I run the battery flat I´ll charge it to 100% and see how much energy was used and can calculate the efficiency. I could calculate it from the top up charges as well but It wouldn´t be very accurate as I only can see the charge in 10% increments.
 

RustyIron

E*POWAH Elite World Champion
Subscriber
Jun 5, 2021
1,830
2,850
La Habra, California
That´s an easy way of doing it. I just got carried away with it because I like tinkering with the smart system in my home.

That stuff you're doing is pretty cool. My outlets don't give any feedback other than their on/off state. I still have to go down to the garage to plug in the charger. Life is hard sometimes.

We have a bunch of yard lights, indoor lights, thermostats, garage doors, front door, and and audio speakers around the house. In the past they've been twitchy and problematic, but the products are becoming much more reliable than in years past--just like everything else.
 

wenna

Member
Aug 1, 2023
209
143
Sweden
That stuff you're doing is pretty cool. My outlets don't give any feedback other than their on/off state. I still have to go down to the garage to plug in the charger. Life is hard sometimes.

We have a bunch of yard lights, indoor lights, thermostats, garage doors, front door, and and audio speakers around the house. In the past they've been twitchy and problematic, but the products are becoming much more reliable than in years past--just like everything else.
Whenever possible I´ve started to opt for the smart relays you can mount on the rail in the service panel.
Like this one:
Shelly_Pro_2PM (4)-625x625.jpg
 

Vani

New Member
Feb 17, 2024
7
5
Barcelona
Hello. In these vehicles, the most important thing is that you have a battery to be able to circulate, so you have to manage to have the battery charged when you want to use the bicycle if you are not going to have a bad time. Thanks to home automation sockets this is easy to achieve without too much hassle. When I get home after riding my bike, I leave it connected and I don't worry about it. My phone and a couple of free apps take care of the job:

---> My trick to always have a charged E-bike, lights, GPS, etc. <---
 

EMTB Forums

Since 2018

The World's largest electric mountain bike community.

554K
Messages
28,010
Members
Join Our Community

Latest articles


Top