Other way to automatically signal for custom-cards updates than HACS?

not knocking your abilities. I’m just speaking from experience and my understanding of code. Also, I know how it works in regards to updating. It bases its updates on the releases OR the latest fix. The drop down determines that. If you aren’t paying attention to the drop down and update, you could just be installing the same version. Not to mention cache comes into play. If you don’t have a ? at the end of your resource, the browser may not use the update.

So all in all, I’d need to see ALL that information before I say it’s a bug.

There is a github issue with logs etc…
I am actually checking the downloaded code with the previous downloaded code so it’s not a resources issue.
I am well aware how it is supposed to work with releases or latest commit.

If I restart Home Assistant and then tell HACS to reinstall it pulls the right version without changing anything else.

I don’t need you to agree it’s a bug…

where is it? I just went through all the issue and I didn’t find it.

No, you certainly don’t. I would help you… but your attitude is turning me away.

HACS not updating some cards · Issue #944 · hacs/integration · GitHub closed as it has the same cause as a different still open issue.

you might need a mirror

This is a possible temp fix:

Try selecting "master", then selecting the nevest version, the click the tree dots -> reload data.
Then update"

I’ll try that next time

Please point out where I was malicious towards you.

Here’s you pulling context out of nowhere, acting like I called you an idiot:

Not once did I question your abilities. I simply explained how it worked. Maybe I could have phrased this

better but it still didn’t warrant your asinine responses.

It seems like you have a chip on your shoulder and you don’t like it when someone explains something.

The implication being I don’t understand how it works…

Um… no. Do you have a chip on yours?

Anyway… look… lets call a truce. Maybe I over reacted. I’ve been frustrated by this bug for weeks so maybe I’m a bit sensitive about it…

1 Like

yes, have the tag for most cards now, and some dont have it set as you can see (btw, are these in HACS…?)

now how do you do that? Can we parse a config file and template anything into the frontend/backend?
would be the final step to take here…

I was using a shell script… I’ll dig it out tomorrow… it was pretty straightforward.

thanks, no worries, no rush.

meanwhile I took the last_changed out (since it adds nothing really other than the last time the system is restarted…) and replaced it with the latest commit message, so I can see in a glance what was changed.

  - type: custom:auto-entities
    card:
      type: entities
      title: Github repos
      show_header_toggle: false
    filter:
      include:
        - entity_id: sensor.github*
          options:
            type: custom:template-entity-row
            state: >
              {% if state_attr(config.entity,'latest_release_url') %}
              {{ state_attr(config.entity,'latest_release_url').split('tag/')[1]}}
              {% else %} Not set
              {% endif %}
            secondary: >
              {{ state_attr(config.entity,'latest_commit_message')}}

first effort for an automation:

  - alias: 'GitHub repo update'
    trigger:
      platform: event
      event_type: state_changed
    condition:
      - condition: template
        value_template: >
          {{ trigger.event.data.entity_id.startswith('sensor.github')}}
      - condition: template
        value_template: >
          {{ 'old_state' in trigger.event.data and 'new_state' in trigger.event.data and
             trigger.event.data.new_state.attributes.latest_release_url !=
             trigger.event.data.old_state.attributes.latest_release_url }}
    action:
      service: notify.marijn
      data_template:
        title: Github repo update
        message: >
          {{trigger.event.data.entity_id}} was updated to {{trigger.event.data.entity_id.attributes.latest_release_url.split('tag/')[1]}}
1 Like

slight little nudge here… found it yet David? just being anxious to try…

Ugh. I’ll look today.

1 Like

Here is the script

#!/bin/bash

cd "$(dirname "$0")"

lovelace_cards=$(cat ui-lovelace.yaml)
darksky_card=$(echo "$lovelace_cards" | grep "dark-sky-weather-card" | head -1 | sed "s/.*\/dark-sky-weather-card.js?v=//")

# Build JSON output
card_installed_string='{"state":"","attributes":{"darksky":"'"$darksky_card"'"}}'

# Home Assistant Config
creds=$(cat abbusage/abbcreds.json)
server=$(echo "$creds" | jq -r '.server')
token=$(echo "$creds" | jq -r '.token')

# Publish to HA with token
curl -X POST -H "Authorization: Bearer $token" \
     -H "Content-Type: application/json" \
     -d "$card_installed_string" \
     "$server"/api/states/sensor.lovelace_card_installed

I had the credentials stored in anoter file along with a token. I also was reading other cards originally but removed them as they were added to HACS but you get the idea. It reads the lovelace yaml file to get the current installed version… just parses resources section.

The lovelace code to display is here:

          - type: 'custom:config-template-card'
            variables:
              - states['sensor.lovelace_card_installed'].state
              - states['sensor.lovelace_card_installed'].attributes['darksky']
            entities:
              - sensor.hacs
              - sensor.darksky
            card:
              type: 'custom:hui-entities-card'
              title: "👀 Available Card Versions"
              show_header_toggle: false
              entities:
                - entity: sensor.hacs
                  name: HACS
                - entity: sensor.darksky
                  name: "${'Darksky installed:' + '\xa0'.repeat(6) + vars[1] + '\xa0'.repeat(3) + 'Available:'}"
                  icon: mdi:weather-partlycloudy

Also… HACS bug seems resolved now.

ok thanks David,
need some time to consume this.

Id need a way to read the resources.yaml file, and find the version number of each loaded resource, to compare those with the tag my GitHub sensors extract from the repo’s…

not immediately obvious how I should handle the, so please let me think on that …

The script will read any file you want it to read and extract the version. It’s all in the script.

ok, will test.

could I expand this to read all version numbers for all listed resources?

like:

lovelace_cards=$(cat resources.yaml)
darksky_card=$(echo "$lovelace_cards" | grep "dark-sky-weather-card" | head -1 | sed "s/.*\/dark-sky-weather-card.js?v=//")

button_card=$(echo "$lovelace_cards" | grep "button-card" | head -1 | sed "s/.*\/button-card.js?v=//")

etc

# Build JSON output
card_installed_string='{"state":"","attributes":{"darksky":"'"$darksky_card"'"}}'
card_installed_string='{"state":"","attributes":{"button":"'"$button_card"'"}}'
etc

Yes definitely. When I started with the script I had a bunch of cards in there. I just posted my latest version before I didn’t need it anymore as everything I used was in HACS.

Also… I have been using rest sensors to suck data out of github and didn’t realise there was a github integration I could use. Going to try that as I think the rest sensors slow down ha when it starts - and a bunch of log messages about rest platform taking more than 10 seconds… so thanks.

ok great, will do that. 1 more questions for now then:
should I change the ‘card_installed_string’ in that case to

card_installed_string_darksky
card_installed_string_button
card_installed_string_etc

or isn’t that necessary when referecing that later on in the script:

     -d "$card_installed_string" \
     "$server"/api/states/sensor.lovelace_card_installed

please assist me here, making this script a multi liner :wink:

Oh crap… you will need to add them together building the json string. It needs to be 1 string. If you can’t work it out I will post when my computer is on. Too hard on ipad.

ok cool, no hurry, but please do. thanks!

card_installed_string='{"state":"","attributes":{"darksky":"'"$darksky_card"'","buttoncard":""$button_card""}}'

etc…
You will only have ONE card_installed_string and the curl command will write that string to a sensor, sensor.lovelace_card_installed in HA. Every card will be an attribute of that sensor and I was using the config-template-vard t display them in my lovelace example above.
I also used an automation to run the script every hour I think.

1 Like