Adding entries in top row

Hi.

As I wasn’t happy with the device trackers for nmap and bluetooth I now implemented something on my own with Tasker on my phone. I call a script from Tasker that sets a binary input when coming home and leaving (using Cell Near and Wifi Near). Seams to already work better as everything I tested before. My only problem now is: how can I show this input in the top row where the circles with the devices where before?

Thanks!

Can you elaborate?

I would like to hear more about how you have integrated Tasker and HA. Specifics please, if possible.

Sure. I mean how to show input_binary here with state AWAY/HOME:
tow-row

Thanks.

I give you the short tl;dr; version as I am still testing it. looks good though… :wink:

In HA

  1. Create input_binary for all Android/Tasker Phones you want to track
  2. (Optional) Create a group of them, let’s say “Inmates”
  3. Create a script to switch these binary inputs from over the net (HA exposes the script by default over REST-API)

In Tasker

  1. Create on one phone a Tasker Profile “At Home”
    4 a) You are free to add tracking here as you wish. I did “Cell near + Wifi Near” as this should be easy on the battery as the docs state
    4 b) For Cell Near be sure to Scan Cells also when calling somebody! And check “magnifying glass” for recent Cells you missed
  2. As Entry-Task call your script with HTTP Post Action for Input A, State “home”
  3. As Exit-Task call your script with HTTP Post Action for Input A, State “away”
  4. Copy all this to the other Android devices and change the Input to B
  5. Repeat 7) for all other devices

Hope this is ok as explanation. Else I am willing to do a post in the “My Projects” thread once I know for sure it is working for 99.9% :wink:

1 Like

Those items in the ‘top row’ are sensors. So, all you need to do is link your device to a sensor. Your best option is a sensor template. Something like this:

 - platform: template
   sensors:
     my_top_row_sensor_1:
       value_template: {{ states.light.livingroom }}

that would create a template sensor that shows on/off in the top row.

This next example, I look at the state of a odd device that outputs 22 as an open door and 23 as a closed door. I don’t like seeing a sensor that has either 22/23, i want it to show Open/Closed. This is how I created this template sensor, which would go directly under my_top_row_sensor_1:

  entry_door_hindge: # GARAGE ENTRY DOOR SENSOR #
    value_template: >
      {% if is_state('sensor.garage_door_access_control', '23') %}
        closed
      {% elif is_state('sensor.garage_door_access_control', '22') %}
        open
      {% else %}
        closed
      {% endif %}

so, you need to figure out where you are getting your away/home info from, then create a template sensor from that information.

2 Likes

Could you please post an example of one of your scripts? I have not worked with scripts but this seems like a very power part of HA that I need to learn.

Thanks

Sure. Here’s the HA script switching the inputs which I call from Tasker:

set_home_state:
  alias: Set the home state
  sequence:
   - service_template: > 
       {% if state == 'home' %}
         input_boolean.turn_on
       {% elif state == 'away' %}
         input_boolean.turn_off
       {% endif %}
     data_template:
       entity_id: >
         {% if for_who == 'me' %}
           input_boolean.me_home
         {% elif for_who == 'wife' %}
           input_boolean.wife_home
         {% endif %}

You can then call this over REST-POST with

{
  "for_who": "me",
  "state": "home"
}

I anonymized the values so you may use your names accordingly… :wink:

Btw, the biggest problem atm is that the state may “bounce” as you walk away from home or come home.
So for example when leaving I get out and loose “wifi near” in the stairway, which switches to “away” but when I turn around the house I get “wifi near” again, through the windows I guess, and switch to “home”. Until I am far away when it switches to “away” for real.
I can live with that atm as I am only swirtching stuff on/off. but your milleage may vary.

Thanks Fearless