def is_state_attr(hass, entity_id, name, value):
    "Test if a state's attribute is a specific value."
    attr = state_attr(hass, entity_id, name)
    return ((attr is not None) and (attr == value))
Test if a state's attribute is a specific value.
def is_state_attr(hass, entity_id, name, value):
    
    attr = state_attr(hass, entity_id, name)
    return ((attr is not None) and (attr == value))