Automation Issue when internet restored

Hi,

Hoping for some guidance, I have an automation that basically turns some stuff off when we arm our alarm (away) and turns some stuff back on when our alarm is disarmed. There’s also a ‘nighttime’ routine that drops the thermostat temps and dims some of our motion controlled lights etc.

However, I’m seeing when the internet connection drops out and reconnects the alarm system state (disarmed, usually) is triggering our ‘I am home’ automation. Is there a way to condition or stop automations running when HomeAssistant re-connects to the internet?

Thanks!

Basically:

Hmm, OK. I will check the log and see if the previous state is something helpful like ‘disconnected’ so I can prevent the trigger.

After checking the trigger is a service called on the device itself, no option for from or to