How do I disable 'source sensors' and keep the templated ones?

Hi! I started with HA today and already encountered a problem:
I want to read data from a D0 IR USB device which is attached to a smart meter. This is the complete raw data that gets transmitted from the device:

Since there is no compatible integration for this, I tried editing the configuration.yaml to create a sensor:

# Loads default set of integrations. Do not remove.

# Load frontend themes from the themes folder
  themes: !include_dir_merge_named themes

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

- platform: serial
  serial_port: /dev/ttyUSB0
  baudrate: 9600
  bytesize: 8
  parity: N
  stopbits: 1
  name: smartmeter_data

    - name: smartmeter_import_total
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      device_class: "energy"
      state: >
        {% if states('sensor.smartmeter_data')|regex_search("1-0:1\.8\.0\*255") %}
           {{ states('sensor.smartmeter_data')|regex_findall_index("\((\d*\.\d*)\*kWh\)") | float | round(1) }}
        {% else %}
          {{ states('sensor.smartmeter_import_total') | float }}
        {% endif %}
    - name: smartmeter_export_total
      unit_of_measurement: "kWh"
      state_class: "total_increasing"
      device_class: "energy"
      state: >
        {% if states('sensor.smartmeter_data')|regex_search("1-0:2\.8\.0\*255") %}
          {{ states('sensor.smartmeter_data')|regex_findall_index("\((\d*\.\d*)\*kWh\)") | float | round(1) }}
        {% else %}
          {{ states('sensor.smartmeter_export_total') | float }}
        {% endif %}
      - sensor.smartmeter_data

The two sensor templates are working and they get the correct value from smartmeter_data but I do not want to display smartmeter_data as the raw data is of no interest to me.

How can I hide the raw data from the ui and furthermore I do not want this data to be tracked or recorded anywhere, how can I exclude it from being written to my planned InfluxDB instance?


The Sensor Card created looks like this for now:

Disable Visibility

Go to Settings > Devices & Services > Entities, select sensor.smartmeter_data, in the popup click the gear icon (upper right) and disable its Visible property.

Disable History

In the recorder section of your configuration.yaml file, add sensor.smartmeter_data to the entities section under exclude (see example in the Recorder integration). Restart Home Assistant for the change to take effect.

The sensor’s existing history will probably still be visible until the next purge occurs (10 days by default) or you can manually execute the recorder.purge_entities service call.

Hi 123!

Thanks for you reply.

I tried to hide the sensor with the steps you posted, but as soon as I click the gear icon, the following message appears:


The history should be disabled then, I already added the entries you mentioned.

Now I wonder how the Raw Sensor can be disabled

I am going to guess that the message says sensor.smartmeter_data doesn’t have a unique ID therefore it cannot be configured via the UI.

An entity can be hidden if it has a unique_id. Unfortunately, it appears that the Serial Sensor integration doesn’t (currently) support a unique_id property. Your ability to hide sensor.smartmeter_data is limited to simply not adding it to any of your dashboard’s cards but it will continue to be automatically displayed in other places:

  • Settings > Devices & Services > Entities
  • Developer Tools > States
  • Default Dashboard

At least its history can be disabled so its data won’t needless populate your database.


For reference purposes, the ability to hide an entity was added in version 2022.4. The screenshot in the Release Notes shows an entity’s configuration panel and that’s available only if the entity has a unique_id.

Home Assistant Release 2022.4 - Hide Entities

Thanks for the throrough answer, I think I understood that. I disabled the default dashboard with an empty one and left the entity out. Does this negatively impact performance in any way or can I let the system run like this? (Using HA OS on Raspberry Pi 4B with 8GB RAM)


Dashboards are processed when they’re viewed, so if you have a dashboard you never display, it won’t affect performance.

Awesome, thank you!

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.

For more information about the Solution tag, refer to guideline 21 in the FAQ.

1 Like