Is there any way that a phone can tell which smart switch it is plugged into?

Hi there.

I have a bit of an issue whereby I have a single smart switch that I use for charging either my phone or my son’s tablet.

The automation is set up so that whenever either device hits 100% charge and senses that it is being charged, the switch automatically switches off.

However, the problem with this is that if I charge my phone this way but my son decides to use a separate charger, this can cause the smart switch to turn off if the tablet charges to 100% more quickly.

Can anyone think of a clever way round this?

Ultimately, I need a way for the device to know that it is connected to the smart switch (as opposed to any other power source) but I am not sure that there is any way of sensing that.

That is right. Not possible.

Have 2 plugs in the smart switch. Make them exclusive for each device and don’t ever think swaping them places.

1 Like

I wonder if you have a switch with power monitoring, what’s the response speed like and if it could pick up power draw as low as 5W.

If so, you could try this:

  • Setup a threshold on the power monitoring entity.

  • Install Home Assistants companion and monitor charging status.

  • Automation:
    if device logs as charging, detect if one of the switches triggered the threshold in the last 20 mins (min update freq is 15mins on the app if I recall correctly).

    Mark a helper to tie a relationship between the phone and the switch.

    If device reports battery at 100%, check if helper is populated with a value, if so, turn off the related switch and reset the helper.

But you’ll have to decide how long you want the automation to reset, eg after 4 hours, assume the device will be removed from the charging station and reset the switch to on state. I don’t have a great idea on how you can easily setup a reset, unless you have a convenient button lying around.

Maybe you can send a persistent notification to the device when it’s at 100% that allows you to reset the switch to on and ready to charge state. That’ll be quite a decent UI.

Shameless plug: I have a blueprint that can help with the persistent notification: 🔔 Notification with Confirm, Dismiss and Timeout

1 Like

NFC tag that sets a type of phone presence or status as plugged in??? I haven’t done this nor know exactly how; just brainstorming.

1 Like

Thanks guys - really helpful (I am using NodeRed, by the way, in case it is relevant).

Unfortunately, neither of the devices support NFC and the switches are very basic and cannot monitor energy use.

You have given me an idea, actually.

I have a spare Ikea Smart light switch that I can use.

Is it somehow possible to set up a “dummy” entity, which can either be on or off?

If I could do that, I could then essentially use a “current state” on the dummy node to ensure that either the tablet sequence is used or the one of the phone instead.

Either you have a really old phone and tablet from around 2010 or you are just making obsolete automations.

Modern phones and tablet will stop charging at 100% and not start again until so e lower set value, like 93% or so. This is to extend battery life.

The really modern phones and tablets even deploy AI to analyse your usage and plan the charging, so it will only charging once, but time it so it will hit 100% just before you take your phone out of the charger.

Another (non HA) idea.

There is this thing called chargie ( Chargie - extends phone battery lifespan by limiting overnight charging), in a USB dongle format, where you plug one side to your typical USB power soure, and the other side being your regular USB cable.

There is BT in that dongle, which would talk to an app on your phone / tablet.

So that, with this close-loop feedback little setup, the app would tell the USB dongle to cut the power at your preset battery %, and reactive the power when it is below another battery %.

No smart plug needed.

I hate my chargies. As a daily overnight charger i found after 3 or 4 days it would fail to connect to the phone automatically, which resulted in 100% charging that wasnt desired.

I also have a permanently plugged in phone on which the chargie app would close after a few days and therefore fail to keep the battery in a nice 40-60% charged zone.

You can do something similar with Helpers, found in the integrations/devices/entities/helpers section.

But do consider simpler alternatives than the one I proposed. :rofl: Often times, if a simple task is overengineered you’d just not use it eventually.

In Node-Red you can store it as a persistent variable and consume the variable in a function node.