Hello Wizards!
It has been just a few weeks since I started playing around with my home automation software, and I am already stuck in a trap because of my lack of knowledge around the libraries of this platform.
I started with a raspberry PI 4 but I realized very quickly that this environment wouldnât be able to scale to the level that I was expecting and this was the reason why I decided to migrate my configurations to a docker container in my QNAP NAS server.
The issue that I am facing is related to smartphone tracking, presence detection and Life360. I started using Life360 to help me track my family smartphones but I realized that the quality of the sensor is questionable. During my research, I found an article from Phil Hawthorne where he explains how to enhance the HA presence detection mechanism through a state machine.
My implementation is very similar to what he suggested initially but I decided to introduce two additional sensors to help me filter part of the noise associated with Life360 and HA Companion App. I donât know if there is a problem with my implementation but I noticed that both platforms donât deal well with offline devices (smartphones) and weak connections.
Below is one of my routines from the automations.yaml file and how I am dealing with the state changes:
- alias: Update Device Tracker Status
id: update_device_tracker_status
initial_state: on
trigger:
- platform: state
entity_id: device_tracker.life360
action:
- service: input_select.select_option
data_template:
entity_id: input_select.status_dropdown
option: >
{% if is_state('device_tracker.life360', 'Home') %}
{% if (as_timestamp(now())-as_timestamp(states.device_tracker.life360.last_changed)) < 300 %}
Home
{% else %}
Offline
{% endif %}
{% else %}
{% if is_state('device_tracker.life360', 'Away') %}
{% if (as_timestamp(now())-as_timestamp(states.device_tracker.life360.last_changed)) < 300 %}
Away
{% else %}
Offline
{% endif %}
{% else %}
{% if is_state('device_tracker.life360', 'Work') %}
{% if (as_timestamp(now())-as_timestamp(states.device_tracker.life360.last_changed)) < 300 %}
Work
{% else %}
Offline
{% endif %}
{% else %}
{% if is_state('device_tracker.life360', 'moving') %}
Moving
{% else %}
{% if is_state('device_tracker.life360', 'driving') %}
Driving
{% else %}
Unknown
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
But when I start my HA instance, I am getting the following error message:
2020-09-24 18:20:42 ERROR (MainThread) [homeassistant.components.automation.update_device_tracker_status] Update Device Tracker Status: Error executing script. Service not found for call_service at pos 1: Unable to find service input_select/select_option
2020-09-24 18:20:42 ERROR (MainThread) [homeassistant.components.automation.update_device_tracker_status] While executing automation automation.update_device_tracker_status
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 426, in async_trigger
await self.action_script.async_run(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 944, in async_run
await asyncio.shield(run.async_run())
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 198, in async_run
await self._async_step(log_exceptions=False)
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 206, in _async_step
await getattr(
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 413, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1265, in async_call
raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Unable to find service input_select/select_option
Does anyone have any idea about what may be going wrong here?