Custom Integration: HDHomeRun

An integration to gather some basic information about SiliconDust HDHomeRun devices.
My main reason for creating this was to ensure I was notified about firmware updates to the devices.

The integration can be installed using HACS.

7 Likes

Just installed this and it works really well. Great job!

Is it possible to obtain the channel the tuner is tuned to? I currently use REST sensors for this.

Hi @WhimsySpoon,

It certainly is. I did have this working in a version when I was tinkering, but it was getting messy, mainly because I was using them as sensors.

However, I have since refactored the data gathering and entity code so it should be a bit easier to do now.

My plan is to see what they look like as media_player entities rather than sensors. Clearly though you wouldn’t be able to interact with the player because, well it isn’t a true player.

I also want to look at seeing what it looks like when the device becomes a media source in HASS. Although I’m not in a rush to do that because DLNA Server support has just been added to HASS in 2022.3.0 and it does find the HDHomeRun devices.

I’ll keep this thread updated when I’ve made more progress as my time permits.

1 Like

2022.3.2b0 is out…
This adds support for tuner sensors. You can also set an update frequency for them in the configure option.

Ensure HACS is looking for beta versions.

Feedback welcomed.

1 Like

I have installed the beta without issue and I can see the new sensors and they work well.

Minor issues:

When not in use, the status is reported as idle in lowercase. This isn’t in line with other sensors.

When in use, the sensor value is a concatenation of channel number and station name. Purely personal preference, but could channel number be relegated to an attribute? My REST sensors change the icon based on station name alone and it works really well.

Again, these are very minor issues. Otherwise loving the integration!

Good points… I was in two minds what put for the status, hence leaving it in beta… I might make it possible to configure what it should look like when I have time…

The info you’re looking for is in the attributes but I’ll change the status when the tuner is locked to a channel to just be the VctName attribute in the next beta.

I have instances where the tuner is in use, but not locked to a channel, in those instances I currently set the status to scanning however I have found that it is also in that state when I use tvheadend to lock a tuner. So the next beta will switch that to in-use which seems more appropriate.

What are you expecting the sensor value to be when idle? If I set it to None it shows as Unknown which also isn’t true.

Sorry, I should have been more clear; Idle is just a casing problem. It’s currently all lower case.

Oh OK. That’s a simple one for me to sort out then. :grin:

It’s also what happens when you adjust the code slightly when using your mobile phone. :joy:

Ha! I thought I was taking risks by replying to this topic on my mobile phone!

2022.3.2b1 is out…

  • Add support for tuner sensors
  • Fix case and labels for tuner sensors
  • Allow changing the sensor format when the tuner is active (available formats are documented in the README; default is just the channel name)
  • Update README to reflect tuner sensors

Ensure HACS is looking for beta versions.

Feedback welcomed.

Works perfectly! I’m just going to throw a template sensor over the top of the tuner sensor so that I can replace the icon with channel logos as I’ve done in the past with the rest sensors.

Amazing work, thank you!

What name format do you use for your icons? I could probably add an option for you to configure a path, which would let the integration build the entity_picture property for you.

@WhimsySpoon - actually no template sensor is required. This makes use of auto-entities card and template-entity-row (ignore the image, I just put a random one in for testing). Obviously change the path to match yours.

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - domain: sensor
      entity_id: /hdhomerun.*tuner\d+$/
      options:
        type: custom:template-entity-row
        image: >
          {% if states(config.entity) | lower not in ("idle", "in use", "scanning") %}
            /local/update_icons/{{states(config.entity) | lower}}.png
          {% endif %}
        name: |
          {% if state_attr(config.entity, "friendly_name") is not none %}
            {{ state_attr(config.entity, "friendly_name").split(":")[1] | title }}
          {% endif %}
        secondary: |
          {% if state_attr(config.entity, "friendly_name") is not none %}
            {{ states[config.entity].last_changed | relative_time }}
          {% endif %}

image

That works perfectly! Thanks again!

Just thinking about how much better an option this would be as it would mean using the icons in various places in Lovelace without needing the extra code.

Would love to help contribute on this. It could finally be the project that forces me to learn Python!

It’s not coming up on hacs for me. Do I need to add your repo or should it be there by default.

Yes, it needs to be added as a custom repo. The latest version will need beta enabled.

1 Like

Just updated the YAML in this post. It was causing some warnings to appear so I’ve guarded against the entities not being ready yet.

It shouldn’t take me too long to do it. I’ll try and take a look tomorrow.

1 Like

2022.3.2b2 is out…

  • Add support for tuner sensors
  • Fix case and labels for tuner sensors
  • Allow changing the sensor format when the tuner is active (available formats are documented in the README; default is just the channel name)
  • Set entity categories
  • Add the ability to configure entity images (see README for configuration)
  • Update README to reflect tuner sensors

Ensure HACS is looking for beta versions.

Feedback welcomed.

Using 2022.3.2b2 you can now use the following in a card to get the desired effect.

N.B. To get friendlier names you can just change the name of the entity as you would do for any other entity.

type: custom:auto-entities
card:
  type: entities
filter:
  include:
    - domain: sensor
      entity_id: /hdhomerun.*tuner\d+$/

image