diff --git a/check_home_assistant_state.py b/check_home_assistant_state.py index 11a69dc..8a5fcbc 100755 --- a/check_home_assistant_state.py +++ b/check_home_assistant_state.py @@ -66,6 +66,7 @@ class AttributeFilter: class Entities(nagiosplugin.Resource): url: str token: str + domain: str device_class: str numeric: bool area: str @@ -149,6 +150,8 @@ class Entities(nagiosplugin.Resource): def probe(self): template_filter = "states" + if self.domain: + template_filter += f"|selectattr('domain', 'eq', '{ self.domain }')" if self.device_class: template_filter += ( f"|selectattr('attributes.device_class', 'eq', '{ self.device_class }')" @@ -351,6 +354,12 @@ def main(): common_args = shared_parser.add_argument_group( "Common Arguments", "Arguments shared between metric types" ) + common_args.add_argument( + "--domain", + type=str, + required=False, + help="domain of entities to monitor", + ) common_args.add_argument( "-d", "--device-class",