• 0 Posts
  • 4 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle

  • If you do use the Pi for Home Assistant, save a lot of future headaches and use a proper SSD and not a SD card - there are always soooo many people having issues with SD cards after a while.

    If you are thinking you’re going to be investing a good bit of time in the future with Home Assistant (you will as it’s a hell of a rabbit hole) apparently Pi’s are quite slow to work with.

    A used PC (small form factor for about $200 with a 5 or 6 gen i5 CPU that ends with T and 4 gig of ram) is a suuuper snappy, future proof and reliable system to run HA on. Mine only uses ~10watt and is automating my whole house.



  • This is the template trigger code I use in my automation. Automations triggers and ramps up lighting 5min before phone alarm goes off.

    The template checks the current time/date at the start of ever minute (the bracketed bit formats the current timestamp) then checks to see if current time matches my next alarm time formula and triggers automation if it does match.

    The next alarm formula gets the (time to) next alarm in milliseconds, devides that by a thousand to make it seconds then, subtracts 300 (= 5 minutes) then prints that formula to a time stamp formatted the same as the current time stamp (for it to compare against)

    This is for an Android phone and using the companion app sensor for ‘next alarm’. #USER# is to be replaced with users own name/entity. Not sore how much of this translates to an Amazon thing but, hopefully give you a bit of an idea of how to perform it once you find the right entity?

    {{now().strftime('%H:%M %Z %a %d %h %Y') == (((state_attr('sensor.#USER#_phone_next_alarm', 'Time in Milliseconds') | int / 1000 | int - 300 )) | timestamp_custom('%H:%M %Z %a %d %h %Y'))}}