Automation ceased to work after last upgrade

This was working up to the last release, I’ve tried changing the entity ID of my phone to the mac address but still no go, any ideas why please, pretty please

  - alias: shack power if Richard is home
    trigger:
      platform: time_pattern
      minutes: '/5'
    condition:
      condition: and
      conditions:
        - condition: template
#          value_template: "{{ is_state('device_tracker.richardUlefone','home')}}"
          value_template: "{{ is_state('device_tracker.f6_d4_e0_b8_a1_c4', 'home')}}"
        - condition: time
          after: '08:00:00'
          before: '16:04:00'
        - condition: state
          entity_id: switch.shack_power
          state: 'off'
        - condition: state
          entity_id: input_boolean.notify_home
          state: 'off'
    action:
      service: switch.turn_on 
      entity_id: switch.shack_power 

Why you are using a template condition?
Just use the state condition

  - condition: state
    state: home
    entity_id: device_tracker.yourphone

And is this really the name of your device_tracker entity?

Also, device_tracker entities to my knowledge are disabled by default, you have to look them up and enable them selectively.

Yes that is the phone name as I have changed it on the router in the dhcp table

I’m more surprised about the time pattern trigger…

Do you see this name in the developer tools as well?

Hi, its very confusing as the table of devices is no longer used, but it doesn’t say the device you are tracking is no longer used.
On lovelace the device is shown as either home or away, but I have two sections of automations that are triggered by state of a device appearing on the Lan to cause a switch to be activated, both used to work , and were working for years , now I just cant get them to function. The one above and 2 smart bulbs on wall lites which as soon as they appear on the lan activate a lamp to be switched off.
I suspect there are other automations that no longer work which turn on lites when I’m out at night,

This just gets worse, To clean out all the old entities and other old stuff I completely did a fresh install, Got most of the automations working, the installation went in to /home/homeassistant/.homeassistant.
I had to shut down all the other software running on this odroid XU4 as has was using a lot of resources when installing. after a reboot, HA wanted to use the default user “odroid”

611 ?        Ssl    0:08 /srv/homeassistant/bin/python3.9 /srv/homeassistant/bin/hass -c /home/odroid/.homeassistant

So the .homeassistant directory was copied from /home/homeasistant to /home/odroid/
which after a reboot worked and lovelace UI was as set up
I edited automations.yaml to change the state section in the above posting, restarted HA, and it crashed !!!, It went back to hass using the default in /usr/local/bin.
At the moment I cant use and test the automations with the solar power and hot water control as there is not enough energy produced this time of year.
Before I set up the integrations again and love lace, is the current version stable, Or should I wait until next month for the next release, which I know will break templates as default values are needed, so loads of work trying to get that working, The only thing working is the hot water control which duplicates the timer on the boiler. Nearly everything else has been broken by updating :frowning_face:
If running the current version on a 8 core 32bit ARM processor is causing high usage and crashes, what is needed to have a stable system, the only other software running on that SBC is motion with 4 IP cameras

Do you have a back up of your old system before re-installing HA?

It’s almost never the answer to a single automation (or two…) problem to nuke the HA install and start over.

it sounds like you’ve caused yourself way more pain than just trying to fix the original issue by getting too aggressive trying to fix a small issue.

it’s like cutting off your foot because of an ingrown toenail.

That sounds like you installed a HA core version of HA.

Is that what you were running before all of this started?

Hi Finity,
I trying to get all the automations to work that were related to device_tracker , I ended up with loads of entities, and other clutter, and I was running out of disk space , I only have a 16GB emmc card on the odroidxu4, I only have 163MB of space left at the moment, the original HA was I think 0.84. Obviously in the the 2 years since the system was cobbled together, with your, and others help HA has grown.
I did keep and use the original automation and configuration yaml files, but alot has been depreciated,
an example:-

  - alias: Turn off LR lampif WL on
    trigger:
      platform: state
      entity_id: device_tracker.ESP552F65_lan, device_tracker.ESP55FD74_lan
      to: 'home'
    action:
      service: switch.turn_off
      entity_id: switch.living_room_lamp


When this worked the lamp would turn off within a minute of the wall lights being switched on,
the wall lights both show as home in lovelace withing a minute, yet it takes 1 hour before the section is triggered and functions.
My android phone is shown as home in lovelace withing a couple of minutes of getting in the house, and even when its been “home” for ages the script to turn shack power on either doesn’t work or maybe its taking so long to trigger.
It maybe like cutting off a foot to treat an ingrown toenail, but if the ingrown toenail is gangrenous the correct course of action.
I’m seriously thinking about getting a Odroid N2+ with a 64GB card, twice as quick, 64 bit and more memory.
The Hass usage when nothing is being done is very low, but very,very high on installation, and I had to install several times before what seems a working system, CPU usage when idle <1%, on install over 600 %, using 6 of the 8 cores of the CPU. a real PITA :rofl:

Well for a start - that should be:

minutes: */5

Though it doesn’t really make any sense to be checking the state of it every 5 minutes, instead just the state of the device as a trigger.

trigger:
  - platform: state
    entity_id: device_tracker.f6_d4_e0_b8_a1_c4

Second, conditions are AND by default - so there is no point in this:

condition: and

Perhaps both work, but the docs say /5
Automation Trigger - Home Assistant (home-assistant.io)

You’re right it does. I’m probably getting confused with how Crontab and other scheduling systems work.

Thanks Andrew, that was written 2 years maybe more, ago
I’ll make those changes and see if it plays in the morning

Hi , it did not work in the morning. :frowning_face:
I’ve ordered a Odroid N2+ SBC , which will have more than enough umph to cope with HA.
I should have this Monday.
Maybe, instead of several automations using the state of my mobile phone either being home or away on the LAN, Just use a Boolean flag set by the phone being home or away, and then use the state of the Boolean flag in the automations.
So an idiot proof yaml script to set flag if phome home, suggestions appreciated
thanks

There is something daft going on here
from states in developer tools both the boolean flags are “off”,

 - alias: shack power if Richard is home
    trigger:
      platform: time_pattern
      minutes: '*/5'
    condition:
#      condition: and
      conditions:
        - condition: state
          entity_id: input_boolean.notify_home
          state: 'off'
        - condition: state
          entity_id: input_boolean.notify_away
          state: 'off'
#        - condition: state
#          state: home
#          entity_id: device_tracker.richardUlefone
#        - condition: template
#          value_template: "{{ is_state('device_tracker.richardUlefone','home')}
#          value_template: "{{ is_state('device_tracker.android_richardfone_lan'
        - condition: time
          after: '08:00:00'
          before: '16:04:00'
        - condition: state
          entity_id: switch.shack_power
          state: 'off'
#        - condition: state
#          entity_id: input_boolean.notify_home
#          state: 'off'
    action:
      service: switch.turn_on 
      entity_id: switch.shack_power 

yet this fails to turn on and nothing shown in the log for triggering

Your yaml is incorrect.
I advice you to use the GUI if you are unsure.

    condition:
#      condition: and
      conditions:        # this shouldn't be there and everything below is indented incorrectly
        - condition: state
          entity_id: input_boolean.notify_home
          state: 'off'
        - condition: state
          entity_id: input_boolean.notify_away
          state: 'off'

Are you saying that was the version you were on and then updated to the latest all at once? Or have you been regularly updating (and dealing with the breaking changes) regularly since .84?

that example doesn’t show anything that has been deprecated - it’s still completely valid syntax and should function today as written.

that doesn’t indicate an issue with the syntax or anything being deprecated. It indicates an issue with your system, as you already mentioned.

that won’t have anything to do with the number of “clutter” entities you have.

entities don’t take up disk space (well, unless you have literally millions of them but that’s not likely the case so let’s move on).

For example, my entire config directory (excluding my HA db files) is only 44MB.

If you are using the entire 16GB of disk space then it’s not because you have too many entities (even clutter). It’s likely because you have not correctly configured the recorder integration correctly or you have some other app(s) writing to log file(s) in the background filling up the disk. You can clean those files out if you can track them down.

there are lot’s of people with a decent size install that are still running on a RPi3B and are not experiencing issues in system performance as you describe. they may experience lags but those lags are in the seconds time-frame, not hours.

The problem with completely starting from scratch is that you no longer have a baseline of “this one thing was working and I did x and now this one thing no longer works”.

based on this post you seem to be in a situation where you are in “this one thing was working so I nuked the whole system and now nothing works”.

but based on the rest you seem to have at least something working now? :man_shrugging:

as far as I know “*/5” isn’t valid.

so go back to what you had before (“/5”)

If the issue is that the phone isn’t setting it’s own state as home or not_home correctly then how will the phone set the state of a different entity as on or off since that other entity will still be relying on the phone setting it’s own state correctly? :man_shrugging:

You will just be literally adding one more step into the process without solving the original problem so the extra step is completely superfluous and, worse, more confusing later.

after you wrote that automation did you run the config checker on it?

if you did I would be surprised if it came back as valid since the syntax is not right (as pointed out above).

to make things reasonable you need to get back to your original baseline configuration (even before you tried switching your device tracker from the phones name to its mac address) and then we might have a chance of helping you solve the original issue.

until then we are just jumping around all over trying to whack down moles that pop up in different places with little chance of progress.

Do you have any better ways to track presence than router/ping/nmap?

Perhaps GPS/wifi via app/bluetooth etc?

I have been experimenting with GPS, and it does successfully track me , as I’ve been 10miles from home, so maybe use that , but there is problem using GPS as it doesn’t work well inside buildings.
So if I was to use that its probable I will be shown as “away” when inside my home.
Discovery from the router is more reliable , as the phone is configured not to drop the WiFi connection when idle, and that is more reliable