AitorDB / home-assistant-sun-card

Home assistant sun card based on Google weather design
MIT License
407 stars 184 forks source link

Manual installation steps clarifications #57

Open rct opened 3 years ago

rct commented 3 years ago

I tried following the manual installation steps from the README.md, but I'm getting custom:sun-card can't be found. I've got some questions about the installation steps.

I'm using a 'supervised' install, so the HA configuration directory is /usr/share/hassio/homeassistant. I created www and put the latest release of home-assistant-sun-card.js in that directory. So it's full path on the host is

/usr/share/hassio/homeassistant/www/home-assistant-sun-card.js

From README.md

Add /local/community/home-assistant-sun-card.js to the URL

Should community be part of the URL if HACS isn't being used?

By 'Add .. to the URL', do you mean to just add only that to the URL field, or do I need to put the base URL for hass and /local/... in the URL field for the resource?

Is a Home Assistant restart required after adding the custom component?

Should I be able to access http://<hass-hostname>:8123/local/home-assistant-sun-card.js via the browser? I'm getting a 404 for that. (If I understand things correctly, config/www on the host should map to baseurl/local.)

AitorDB commented 3 years ago

Thanks for opening the issue! I just saw that I wrote configuration/www instead config/www, can you confirm that putting it inside config/www mades it accesible from the browser through baseUrl/local?

rct commented 3 years ago

(disclaimer - this is the first time I've tried to use a custom card.)

Thanks for opening the issue! I just saw that I wrote configuration/www instead config/www, can you confirm that putting it inside config/www mades it accesible from the browser through baseUrl/local?

This is an area where the home assistant documentation leaves a lot to be desired.

Note: The name of the configuration folder varies both by install type and were you happen to be observing it from. It looks like in many HA documentation cases "config" is a placeholder to indicate where your configuration files are.

When looking from outside the HA container (on the host system) on certain types of installs (like supervised [docker on Linux]), /config/www is accessed via /usr/share/hassio/homeassistant/www. If one uses the web terminal/ssh that puts you inside a container, the path to those files is /config/www.


can you confirm that putting it inside config/www mades it accesible from the browser through baseUrl/local?

It looks like by default, there is no www folder. The user needs to create it when adding the first custom card or whatever.

The theory I have now, is that after creating www Home Assistant will need to be restarted before /local/ is accessible. Testing that theory now.

The clue is that baseUrl/local/ is returning a 404 instead of a 403. (This could be a troubleshooting step.)

After restarting baseUrl/local/ returns 403 and baseUrl/local/home-assistant-sun-card.js returns the .js file.


Ok, I've got it working now and it looks great~ Thanks for creating this!

Documentation fixes for manual install

  1. remove /community/ from URL,
  2. add note about possibly needing to create www folder
  3. clarify use/location for config directory.

Manual install

Manually

  1. Download the home-assistant-sun-card.js file from the latest release available and save it in the www folder where your Home Assistant configuration files are located.
    • Typically this will be config/www but is installation specific.
    • The www folder may need to be created if you haven't used any other custom UI components. It does not exist in a default install. If you create www, you must restart Home Assistant before using Sun Card.
    • See notes below.
  2. Go to Configuration > Lovelace dashboard > Resources in Home Assistant and click on Add resource.
    1. In the URL field, enter /local/home-assistant-sun-card.js
    2. Choose Javascript Module as Resource type.

Notes

  1. The location for Home Assistant configuration files depends both on what type of installation you are using and how you are accessing them (via web terminal/ssh, host system files, or file sharing). Possible locations:
    • /config
    • /usr/share/hassio/homeassistant
    • /home/homeassistant/.homeassistant
  2. The files in <config-dir>/www/* are accessed as http://<home assistant host>:8123/local/*.
  3. After putting home-assistant-sun-card.js in your config/www folder you should be able to see the JavaScript file via http://<home assistant host>:8123/local/home-assistant-sun-card.js
  4. Troubleshooting, try to access http://<home assistant host>:8123/local/. You should get a 403: Forbidden. If you get a 404: Not found instead, you need to restart Home Assistant after creating the www directory.
Aresitoo commented 3 years ago

Somehow the ''automatic instalation'' did not work, even when refreshing and clearing cache of chrome, I did the manual instal guide and now the card is show. But in Configuration > Lovelace dashboard > Resources I now have two lines

AitorDB commented 3 years ago

Somehow the ''automatic instalation'' did not work, even when refreshing and clearing cache of chrome, I did the manual instal guide and now the card is show. But in Configuration > Lovelace dashboard > Resources I now have two lines

  • /hacsfiles/home-assistant-sun-card/home-assistant-sun-card.js ( installed by the auto instal )
  • /local/home-assistant-sun-card.js ( the manual instal one )

Have you faced any other issue with any other HACS card or only this one?

Aresitoo commented 3 years ago

Sorry for the delayed reply, your card is the first I ever install into HA, so no idea if it was a HACS card issue or only this one

A7F commented 3 years ago

I have the same issue @Aresitoo had, it's my very first card I try to install and the path where HACS searches the component is /hacsfiles/home-assistant-sun-card/home-assistant-sun-card.js but actually it is in the path /config/www/community/home-assistant-sun-card/home-assistant-sun-card.js

patrickcollins12 commented 3 years ago

@rct 's suggestion here saved me. I now have this up and running. Definitely need to incorporate his notes. In particular in my case it was the suggestion that ha needs to be restarted.