dalehumby / ESPHome-Apple-Watch-detection

ESPHome BLE Apple Watch presence detection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Home Assistant Watch is Unlocked Sensor

romanpeters opened this issue · comments

commented

Hi,
I noticed it's possible to tell if the Watch is locked or unlocked.

I would like to track my Watch, but I also want to know when my Watch is in the room but it's charging.
That way I can adjust my presence automations accordingly when I'm not wearing it.

Ideally whether the Watch is unlocked would be an attribute of the presence binary_sensor in Home Assistant, or alternatively a separate binary_sensor.

Is it possible to add this functionality through the ESPHome YAML configuration?

commented

Hi @romanpeters - Sorry for the delay replying. I'm in the process of moving homes and all my home automation stuff is still in transit until mid-Feb. This is a nice idea. I can look at it then.

In the meantime, which Apple Watch series do you have? As far as I can tell, not all of them change state when locked/unlocked. Does the sensor in HA for your watch change to 'not present' when you take it off, after a short while?

Could you give an example of the different automations that your would run based on your presence (wearing a watch) vs watch charging (not wearing the watch)?

commented

I'm using a Series 4. I just tested it and once my watch locks, the sensor does not update any more, but stays on its last measurement from before locking.

I usually charge my watch first thing in the morning, so my use case would be to use it as a trigger for my morning routine.

commented

Hi @romanpeters - Thanks for the info. Could you try changing line 60 to be

if (data_flags == 0x98 || data_flags == 0x18) {

This will at least detect your watch when it's both locked and unlocked. If this doesnt work, please send

  • what watch model you have. If possible, install LightBlue app on your iPhone, open app, connect to your Watch, and under "Device Information" send me "Model Number String" (something like Watch6,6)
  • esphome yaml file
  • debug log with very verbose logging switched on (add the following to your yaml file)
logger:
  level: VERY_VERBOSE

As an enhancement, I could look at sending a flag to HA of whether the watch is locked/unlocked, and then you could run an automation when the status changes from unlocked to locked (when you take it off for your morning routine.)