Detect Shore\Grid Power Disconnect\Connect

If I have a powershell script monitoring my Victron MultiplusII\cerbogx how can I detect shore power has been connected and\or disconnected?

Is there an event model I have to follow and if so where is this documented?

Thanks!