Error in vacuum maintenance check

Hi,

I encountered the following error:

Logger: homeassistant.components.automation.vacuum_maintenance_check
Source: helpers/service.py:168 
Integration: Automation (documentation, issues) 
First occurred: 5:00:00 PM (2 occurrences) 
Last logged: 5:00:00 PM

Vacuum Maintenance Check: Error executing script. Unexpected error for call_service at pos 1: Error rendering service name template: TypeError: '<' not supported between instances of 'NoneType' and 'float'
While executing automation automation.vacuum_maintenance_check
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 353, in async_render
    render_result = compiled.render(kwargs)
  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.8/site-packages/jinja2/runtime.py", line 545, in __next__
    rv = next(self._iterator)
  File "<template>", line 1, in template
TypeError: '<' not supported between instances of 'NoneType' and 'float'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 165, in async_prepare_call_from_config
    domain_service = domain_service.async_render(variables)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 355, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: TypeError: '<' not supported between instances of 'NoneType' and 'float'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 250, in _async_step
    await getattr(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 429, in _async_call_service_step
    domain, service_name, service_data = service.async_prepare_call_from_config(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 168, in async_prepare_call_from_config
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Error rendering service name template: TypeError: '<' not supported between instances of 'NoneType' and 'float'

I don’t have a clue how to fix this. Can anyone help me out?

Show us your automation automation.vacuum_maintenance_check.

Looks like you are doing a number comparison using less than, (<) between objects that are not numbers.

I’m quite a newbee, and I don’t know what you want to see now. The automation vacuum_maintenance_check hasn’t an Unique ID and can’t be explored thru the UI. So where is this automation located?

In your automations.yaml file located in the /config folder.

I found this default settings in vacuum.yaml

 # Maintence Check
  - alias: Vacuum Maintenance Check
    initial_state: true
    trigger:
      - platform: time_pattern
        minutes: /15
      - platform: state
        entity_id: [
          'sensor.vacuum_maint_clean_brushes',
          'sensor.vacuum_maint_clean_contacts',
          'sensor.vacuum_maint_clean_filter',
          'sensor.vacuum_maint_clean_wheel',
          'sensor.vacuum_maint_clean_bin',
          'sensor.vacuum_maint_replace_brushes',
          'sensor.vacuum_maint_replace_filter',
          'sensor.vacuum_maint_replace_wheel'
        ]
    action:
      - service: >-
          {% set ns = namespace(count = 0) %}
          {% for item in states.sensor if 'sensor.vacuum_maint' in item.entity_id and (state_attr(item.entity_id, 'timeout_timestamp') < as_timestamp(now())) %}
            {% set ns.count = loop.index %}
          {% endfor %}
          {% if ns.count > 0 %}
            input_boolean.turn_on
          {% else %}
            input_boolean.turn_off
          {% endif %}
        entity_id: input_boolean.vacuum_maint_due

And in my automations.yaml is nothing to see about my vacuumcleaner as I haven’t set up automations yet.

Ok this is a package you have loaded from somewhere?

Can you please look in the Developer Tools / States menu, find sensor.vacuum_maint and check what value the timeout_timestamp attribute of this sensor has (right hand column)?

These are the only sensors I can choose from that begin with sensor.vacuum_maint

Please check them all for the timeout_timestamp attribute value.

Ok.

timeout_stamp is for all instances ‘null’

The all share a similar state attribute YAML like this:

timestamp_friendly: Invalid Date
timeout: 10 days
timeout_timestamp: null
timeout_seconds: 864000
severity:
  - color: '#bf4060'
    value: '-10 days'
    seconds: -864000
  - color: '#bfb540'
    value: 0 days
    seconds: 0
friendly_name: vacuum_maint_clean_filter
icon: 'mdi:checkbox-marked'
device_class: timestamp```

There’s your problem then. You can not compare null to a timestamp.

You should contact whoever wrote that vacuum package.

That sounds pretty obvious. Thanks.

I used the github https://github.com/jeremywillans/hass-addons for rest980 dockerimage to integrate my Roomba i7

He has a support topic here:

And searching that topic shows this answer to a similar issue:

1 Like

You are too kind. Thank’s a million!