How to include automation triggering device's name in notification message (trigger.to_state.name fails)?

Neither of those triggers are state triggers. They are device triggers.

The to_state variable is not available for device triggers. See the different variables available for different trigger types here: Automation trigger variables - Home Assistant

You need to change your triggers to state triggers. See here for help with that: Why and how to avoid device_ids in automations and scripts