Home Assistant - How to automatically re-enable bluetooth on your smartphone after it has been disabled

Home Assistant - How to automatically re-enable bluetooth on your smartphone after it has been disabled

Hello guys,

In this article we saw how to disable automatically the bluetooth of the smartphone if your smartwatch gets disconnected at least for 1 minute.

But how to automatically re-enable it ? Below a possible solution.

Scenario

You want the bluetooth is automatically turned ON as soon as you are interacting with your smartphone.

Software configuration

  1. Home Assistant. I'm currently running version?2022.8.7.
  2. Mobile App integration?configured in Home Assistant. This integration allows Home Assistant mobile APP (Android / IOS) to integrate with your Home Assistant environment.
  3. The?Home Assistant APP?installed on your smartphone.
  4. The binary sensor interactive must be enabled (this sensor is available on Android only).

Home Assistant code (yaml) / procedure

This is the piece of code you have to write as Automation:

alias: Smartphone - Turn ON bluetooth if smartphone interactive sensor goes ON
description: Turn ON bluetooth (if disable) as soon as smartphone's interactive sensor goes ON
trigger:
? - platform: state
? ? entity_id:
? ? ? - binary_sensor.yoursmartphone_interactive
? ? from: "off"
? ? to: "on"
condition: []
action:
? - if:
? ? ? - condition: state
? ? ? ? entity_id: binary_sensor.yoursmartphone_bluetooth_state
? ? ? ? state: "off"
? ? then:
? ? ? - service: notify.mobile_app_yoursmartphone
? ? ? ? data:
? ? ? ? ? message: command_bluetooth
? ? ? ? ? data:
? ? ? ? ? ? command: turn_on
mode: single        

Some specifics about the code above

  1. The automation trigger is based on the changing state (from off to on) of the binary sensor interactive.
  2. The action to be executed will check first if the bluetooth is currently disabled. If it's true the notification command to turn it on will be send to your smartphone.

As already said before, this is just a possible solution to get the bluetooth automatically enabled.

Thanks to the great flexibility of Home Assistant it's possible to thinking about different ways to get?the same result based on your needs and habits.

Thank you for reading. ?? I hope you have enjoyed this article.

I'm available for any feedback so, feel free to contact me or share your thoughts in the comments section below!

Meanwhile,?if you liked this article share it or?subscribe?to my newsletter?about?Home Assistant?to read previous episodes and still up to date on latest news.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了