20 things I wished I knew when I started with Home Assistant

The title of that thread was changed, so the link isn’t valid anymore…

Here you go, but take your time, this is a seriously written post, and it is long! The length is needed, but it is not a “five-minute-job”. :slight_smile:

@kameo4242 Sorry for tagging you, but could you please change the link to your tutorial? Thanks!

What sort of helper would you recommend as a proxy variable for a smartphone device tracker please?

Great idea!

Use the old style groups in your config.yaml

Hi @FriedCheese just did that, created old style groups for my smartphone (one for gps and one for wifi). Those groups do what they are supposed to do, they show me as home or not_home based on the underlaying entity state (wifi or gps on my smartphone).

However, the groups are not selectable in the person entity. How to go about this please? Can one set the device type of a group to device_tracker for example?

Entity ID 'group.fred_smartphone_gps' does not belong to domain 'device_tracker' for dictionary value @ data['device_trackers']. Got ['group.fred_smartphone_gps']

I’d you’re putting them in the person entity it is itself a group. (you don’t need it)

You would add the device trackers tonthe person then the person’s aggregate state is home or not_home. So you don’t need a group inside a person. Object.

(read: You’re already abstracting the group membership and don’t gain any benefit)

Use old style groups for grouping trackers when you’re NOT using them with a person

1 Like

Ah ok. I thought the point of proxy entities is needing less changes. Such as when you replace your smartphone.

E.g., how could proxy entities be set up for using in-app (HASS) notifications?

For those you need a notify group.

For my system I put my phone in my person object (its the base object for presence detection in my system). (use zone counts to determine home presence. The Home zone will be a count of persons in zone)

Then I also put the phone in one or more notify groups:

Family Member Notify
Family Member Notify Verbose
Guest
Admin

All automation targets one of those notify groups or person object. So when I get a new phone next year I just edit 5 groups.

3 Likes

Excellent list, thanks.

I would also add to spend some time on the various automation solutions and realistically decide on which to use vs. the number of automation vs the expected dynamism (how often you will change them) vs the time you have.

I started with HA some 5 years ago and initially went for the UI-based automation.
I then felt that they are very limiting and moved to AppDaemon (I am an amateur developer)
I briefly decided to replace it with my own code
I then felt that this is too disconnected from the core HA and moved to YAML for automation
Then I discovered pyscript and moved everything there
And today I am back to UI-based automation :neutral_face:

Why? Because I realized that I have a fairly stable set of similar automation (I need to have a look at blueprints BTW) that I need to switch on and off on a regular basis.
I also need from time to time to change them from my bed, on my phone.

This means that I have a long web page with automations and writing them is a bit cumbersome. My developer’s heart feels pain as well. But this si probably the most optimal solution for me (and that’s why one should spend some time on testing the above to avoid constant moving between solutions)

1 Like

Indeed, that works. For those who prefer a notification group instead of an individual device (so you only need to change the group instead of all automations where the device is called), a few pointers.

This solved it: Sending notifications to a group - #6 by agios

Working example (e.g., you’ll get notify.phone_fred and notify.phone_x).

notify:
  #NOTIFICATION GROUP:
  # https://companion.home-assistant.io/docs/notifications/notifications-basic/#sending-notifications-to-multiple-devices
  # https://www.home-assistant.io/integrations/group#notify-groups
  # https://www.home-assistant.io/integrations/notify/#test-if-it-works
  - name: "Phone Fred"
    platform: group
    services:
      - service: mobile_app_freds_phone
  - name: "Phone Partner"
    platform: group
    services:
      - service: mobile_app_x_iphone
1 Like

So true, like Tuya, asking for a lot of $$$ after 3 months of use on their wifi products because it is cloud dependent. Buy Tuya if you want, but Zigbee not Wifi. You’ll even save a few bucks on consumption.

And don’t tell me that you can ask for an additional 6 months easely! Yes, but for how long? Are you aware of Tuya’s plans for the future?

3 Likes

Thanks for these tips.
To add to your point 16 “Don’t under-estimate groups”, these tips also apply to the new style of groups.
For example, when you define a group in the new style:

binary_sensor:
  - platform: group
    name: "pirs"
    device_class: motion
    entities:
      - binary_sensor.pir1
      - binary_sensor.pir2

You can enumerate group members like so:

{% for sensor in expand(state_attr('switch.always_on_group', 'entity_id')) -%}

– Ingrid

4 Likes

So… wow… this is great! Having just installed HA yesterday what I now realize is… I think I know just enough to really grind myself into the dirt. :slight_smile:

When I started I thought it had something to do with self-hosting and privacy. NOPE!
Where are the discussions on privacy? Should I give someone access to my github and go to sketchville to D/L files to crack my NSpanel ?. I did. I have a NABU subscription, I use duckduck for my searches. should I put a Google ai device in my home server? Feels like I am turning my chicken coup into a B&B for foxes.

Well I think a self hosted solution like HA is a good starting point.
Also, as highlighted in the post, use cyphered protocols, focus on FOSS, no Cloud dependencies as much as possible, no Alexa and other connected mics. Secure your remote accesses, segregate your networks. etc.

But there is indeed more to write on that front.

Could somebody please explain what the author meant with " proxy variables"? I spent an hour trying to figure that out and only this thread comes up. There seems to be no such thing in HA.

Is the author simply referring to putting any entity in its own group so the config or automation does not depend on the exact name of an entity/device?

1 Like

I think the author is describing a concept, rather than a specific HA feature.

Here’s an attempt a definition…

Proxy Variable (noun)
The concept of not using the name of an entity (that might be replaced) directly, but creating a reference to them so that if the entity changes, you only need to alter the proxy variable once, and not multiple automations, dashboard entries, etc that use them.
.
The concept of a proxy variable can be created using:
* A Group entity - add household phones to a Group to track presence. Mobile handsets may be replaced regularly, giving additional work to change entity names in automations.
* A Template Function - an Helper entity based on a template function (e.g. Templating)

Any others community? :man_mage:

(If there are many, a new thread may be needed)

(My related favourite is using a Toggle Helper as a binary ON/OFF used with a condition in automations to simply TURN OFF multiple actions - e.g. disable an alarm clock, enable motion lights when dark, etc.)

If this helps, :heart: this post!

4 Likes

Thanks, it’s exactly what I had in mind, following the question and your answer, I updated the original post.

2 Likes

An example: Say you don’t track people’s location, e.g. to know when they’re home, then a proxy variable would be to use your alarm panel’s state (e.g. armed means nobody is home). It’s anything that acts on behalf of or as a substitute for something else.

1 Like

I agree that knowing templates is very, very important.

brace { }, double brace {{ }}, brace percent {% %}, bracket , dot ., single quote ’ ', double quote " ", numeric/string (0 is not the same as “off” … note the upside down double quote here), back slash , comparators > < >= <= = (or is it ==?) and the schaefer sign (sorry, really, really old school) |, which is not really a pipe but used as a cast … sometimes.

Seems to me the most important thing you learned is where to find how to construct templates.

1 Like

Wow! Thanks for the wonderful post!!!

1 Like