Adding attribute to nadtcp - not getting it to work

Hi,

I have a NAD Amplifier and it works pretty good with Home Assistant. One issue I have is that I have is that it is not intuitive which volume level it is set at. It currently displays it volume(in dev-state in the gui from 0…1 in the HA format. I would like to see the same dB level i see at the display.

I have only used python for small personal projects before, almost no classes, but I tried to copy how other attributes where defined in the code. Could any of you help me with why it’s not working?

current ha code here:
https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/media_player/nadtcp.py

My modified code here:

I added a new class variable, new function to calculate the value and added the attribute with the @property tag in the bottom but it does not sho up in dev-state attribute. Is there something else I should do?

The current solution would require that you update the frontend to expose the value.

Use device_state_attributes to show details about a device in the frontend.

1 Like