Get Badge count of HA side bar

You can achieve that with a custom plugin that I maintain. To add a notification to a sidebar item you need to use the notification order item property.

Edit: I misunderstood your question, I thought that you wanted to add a new notification in a sidebar item. And what you want is to get those numbers for an automation.

You can check the number of issues with sensor.active_issues and the number of updates with this template:

{{
  expand(states.update)
  | selectattr('state', 'eq', 'on')
  | list
  | length
}}

For the notifications you can try with sensor.persistent_notifications.