NUT - no sensors created for s/n or model no by integration

I been reading about the customize.yaml over last day or two, but when Google is giving me mixed bag of results with some posts several years old I hesitated, but thanks for the link

Don’t be afraid, it’s quite easy to use. Ping me here if you get stuck & I’ll do my best to help you with it.

How does this look? Getting the impression I may also need to use configuration.yaml unless I am not understanding correctly.

sensor:
  - platform: template
    sensors:
      sensor.sony_kd_55x750f_modelname:
        friendly_name: "Model Name"
        value_template: "KD-55X750F"
      sensor.sony_kd_55x750f_serialnumber:
        friendly_name: "Serial Number"
        value_template: "123456"      

You need to add the serial in customize.yaml and reference the file in configuration.yaml first if you’re splitting up your config.

Otherwise just add everything in configuration.yaml under your existing homeassistant lineand forget about customize.yaml, like this.

homeassistant:
  customize:
    sensor.whatever:
      serial: "12345"

Remember to reload location & customisations from the dev tools page in order for the change to apply.

I want to use customize.yaml alone. No errors, but nothing created. Can you tell me what I am doing wrong?

I am referencing the customize.yaml file in the configuration.yaml

sensor.sony_kd_55x750f_serialno:
    friendly_name: "Serial No"
    value_template: "123456"

Ok, let’s take it step by step.
Paste your customize.yaml here, and paste the section in the configuration.yaml (including the homeassistant line) where you’re referencing it

ok so what I pasted from last post is in the customize.yaml. The file did not exist so I created it. So nothing else in that file except what you see from my last post.

configuration.yaml

homeassistant:
    packages: !include_dir_named packages
    customize: !include customize.yaml

    name: Home
    latitude: 42.230830
    longitude: -70.933590

# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder

frontend:
  themes: !include_dir_merge_named themes

# Text to speech
tts:
  - platform: google_translate

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

shell_command:
  backup_script: "/bin/sh -c 'ha core stop && ha backups new --name \"Automated backup $(date +%Y-%m-%d)\" && ha core start'"
  
 

Ok, but sensor.sony_kd_55x750f_serialno doesn’t actually exist as an entity, right?

You need to use an entity which already exists in order to add an attribute to it, so your customize should look something like this:

sensor.sony_kd_55x750f:
  serial: "123456"

You’re also indented too far to the right for friendly_name and value_template. While it may not break anything, those lines should be only 2 spaces in instead of 4

correct. they don’t exist as an entity. was hoping to create a “fake one”. this does exist media_player.sony_kdl_40w600b. Can I add an attribute to this to accomplish what I want x 2 so I can display the model and s/n on dashboard

Looks like a different device from your first one based on the model number, but sure, give that a try.

Remember to reload customisations after your change

so the attribute was created with value I define. sorry if this is obvious, but how would I then reference the attribute on any card?

I’m not really great with templates, but I believe petro already showed you how to display attributes in the dashboard on the other thread.

Something like:

{{ device_attr('sensor.cyberpower_status', 'manufacturer') }}
{{ device_attr('sensor.cyberpower_status', 'model') }}

You can use the entities card. Just make sure the entity and attribute values are correct. The attribute name should be all lowercase.

- type: entities
     entities:
          - type: attribute
            entity: media_player.sony_kdl_40w600b
            attribute: serial_number
            name: SN

That I did. And those are the templates.

1 Like

Wouldn’t they need state_attr instead of device_attr?

{{ state_attr('media_player.sony_kdl_40w600b', 'serial') }}

No

here is a template for serial number for the nut integration

{{ (device_attr('sensor.baseups_load', 'identifiers') | first | list | last).split("_") | last }}

Just copy/paste that into a template helper. No yaml.

For this, you can still create a template entity from the UI without yaml.

{{ 'KD-55X750F' }}

Then you don’t need any templates when putting this anywhere else.

Cycling back on the below:

and this:

Now that you can see the attribute for the serial number and know where to find it, do you really need it taking up dashboard space on the off chance that you might one day maybe need it when calling support for device?

Personally, I’d look it up on the device page or dev tools rather than put it on a card, but you do you.

Thanks to all who offered to help. Fell off the map last day or two – will dig into this feedback hopefully tonight