Automation to/from home not working after update

First, would you please format your code properly for readability? It will be very difficult to assess the problem and help you otherwise.

f6be36681e0da431418ec7781fb6c62712941803