ollie_ap and ollie_ap_strength need entity_id’s linking them to the source entity.
tests like states(‘sensor.ollie_ap’,‘Outdoor_AP’) should be like is_state(‘sensor.ollie_ap’, ‘Outdoor_AP’) It looks like you have some of these correct and some not
tests like is_state('sensor.ollie_ap_strength) | float should be states(‘sensor.ollie_ap_strength’) | float
I find the key with my template sensors is to use the Template tab in Developer Tools to test what I want to do before implementing - it helps me to build some of the more complex value_templates.
Points 2 and 3 are correct, but you don’t need to define the entities in the template sensor config. All of my template sensors update without explicitly defining the source entities in the config. The docs say “This can be used if the automatic analysis fails to find all relevant entities.”
I started doing it after reading to resolve some updating issues with some of my more bespoke summary templates, and it’s simply become part of my personal coding standards since then (most of which I forget why I do…)
I believe you can reduce the template’s logic to this:
ollie_location:
value_template: >
{% set l = states('sensor.ollie_ap') %}
{% set s = states('sensor.ollie_ap_strength') | float %}
{% if l == 'Office_AP' %}
Office
{% elif l == 'LivingRoom_AP' %}
Living Room
{% elif l == 'Outdoor_AP') %}
{{ 'Outside' if s < -50 else 'Office' }}
{% elif l == 'Playroom_AP' %}
{{ 'Kitchen' if s < -50 else 'Playroom' }}
{% else %}
Unknown
{% endif %}