If your HA is pre 88, you should use this for the tracker;
https://raw.githubusercontent.com/pnbruckner/homeassistant-config/master/custom_components_old.json
That is only required pre 86. And, in theory, it should continue to work before 89. If you’re on 86 or newer, though, you should use custom_components.json instead of custom_components_old.json.
Ok, so I did another test, this time with custom_updater. Here are the steps:
- Stop HA, then remove any of these:
custom_components/sun.py
custom_components/sun/
custom_components/__pycache__
- Install custom_updater and add this config (which I believe you already have, so you can skip this step):
custom_updater:
track:
- components
component_urls:
- https://raw.githubusercontent.com/pnbruckner/homeassistant-config/master/custom_components.json
-
Comment out any
sun:
configuration entries that only the custom sun component supports. -
Start HA.
-
Run these services:
custom_updater.install w/ {"element": "sun"}
custom_updater.install w/ {"element": "sun.automation"}
custom_updater.check_all
sensor.custom_component_tracker (and the associated tracker card, if you’re using it) should show “sun” and “sun.automation”.
-
Stop HA
-
Uncomment any
sun:
configuration entries that only the custom sun component supports. -
Start HA
D’oh! And it didn’t work!!!
Looks like I missed a change in custom_components.json. Argh!! I’ll fix that and try again…
EDIT: So I fixed custom_components.json, but custom_updater is still using its copied version. I guess I have to wait an hour…
EDIT 2: Ok, it now seems to work.
@DavidFW1960 @klogg @finity @elRadix and anyone else who cares…
See previous posts for details, but it looks like I had a typo in custom_components.json which I just fixed. You should now be able to install and update elements “sun” and “sun.automation” via the custom_updater. You shouldn’t need to do any manual copying, moving, renaming, linking, etc.
I still need to make one more change that will combine these two elements into one - “sun”. After that hopefully the dust will finally settle.
As always, glad for any feedback, and sorry for any inconvenience experienced during this absolutely wonderful migration.
Oh, and to summarize on the log messages, the message about using a custom version of sun seems to happen before the log and/or UI is fully initialized, so it doesn’t show up on the Info page. However, it does appear in home-assistant.log. And the new message about using a custom version of sun.automation only happens if/when an automation that uses a sun trigger is initialized.
I just made this change and tested it the best I could. It seems to work. After this change you will only see one “element” in custom updater for this custom component, namely “sun”. (sun/automation.py will still be installed, but it no longer is a separate custom updater element.)
Note that you need to use custom updater version 4.2.9 or later (which added support for custom component “resources”, of which sun/automation.py is one.)
If you already have sun version 1.1.0, in the new layout, and it’s working, you shouldn’t have to do anything further.
just checking back in to let you know it’s working now. i didn’t have to do anything else at all. just clicked “check” again and it popped up in the list.
same here, clicked check updates and the sun component appeared in the tracker card with version 1.1.0
So far so good here too.
I had to copy the files across manually though as running the install service didn’t work. It never has for me but it’s not a big deal and it’s not your problem either!
Thanks for sorting this out, I appreciate it.
I’m glad the custom sun component is working for you!
That’s weird. All you should have to do is to get a copy of custom_updater.py and put it here:
custom_components/custom_updater.py
Make sure it’s at least version 4.2.9 (if you don’t grab a new copy.)
You might want to remove:
custom_components/__pycache__
Then start HA, and run services:
custom_updater.install w/ {"element": "sun"}
custom_updater.check_all
That should install the custom sun component’s files. Then just restart HA.
Hmm…
Yes I’m on custom_updater 4.2.11
I do have a custom_components/__pycache__
which I will delete but as I am all ok with everything working I won’t be able to see if that is why the install
didn’t work.
I’m not too bothered from my end, I used to try to install using custom_updater but it never seemed to work so I gave up a while ago and now routinely copy the files manually and let custom_updater keep everything up to date once I do that.
If you have the YAML mode specified for the custom-updater it will cause the custom-updater not to be loaded and hence the tracker card. (I also got an invalid key error when I restarted Home Assistant which is why it didn’t load because of the mode) Mine started doing this last night (the tracker card). He now assumes if the ui-lovelace.yaml exists that that’s the config…
All of a sudden, I discover that clicking the sun.sun entity in a group:
displays only these attributes:
(no history because that is excluded in recorder)
while in dev-state all attributes of your enhanced component are available:
is this correct (more-info) and shouldn’t these attributes be displayed? Would be really nice if we had them there too. I know I can template it all out, and do so, but having all attributes in the more-info can be very useful, like this:
so know it should be possible
Or am I experiencing a bug?
You’d have to ask someone with frontend experience. I see the same thing. In fact, going back to the standard sun component (which also has many more attributes than the three that are shown) I see the same thing as well.
ok, good to know. the thing is I seem to remember all properties showing in the more-info, so it really surprised me today.
I am getting these errors at startup:
2019-02-26 17:12:42 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.sun.automation. Make sure all dependencies are installed
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/loader.py", line 147, in _load_file
module = importlib.import_module(path)
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 962, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'custom_components.sun.automation'; 'custom_components.sun' is not a package
How to fix?
Have you followed the updated installation instructions?
If so and you’re still having problems, what version of HA are you on? Did you use custom_updater to install the “element” named “sun”, and what version of custom_updater do you have?
I just read the instruction after writing my request… so now i have a folder called sun. Must i delete the old sun.py from the custom_component folder?
I used custom_updater to install the sun component and i run 0.88.1
I just noticed that custom_updater disappeared from the tracker card…
That’s a good question. I’m not 100% sure if it is required, but I would delete it. I’ll have to do some more testing to see if having custom_components/sun.py
interferes with the files in custom_components/sun
. If it does, then I’ll need to update the installation instructions (again.)
EDIT: I just copied custom_components/sun/__init__.py
to custom_components/sun.py
and restarted HA. It did not seem to cause any problems.
I don’t use the tracker card, but I believe others have run into similar problems. You might want to read previous posts in this topic; there might be some clues.
I deleted sun.py from custom_components/ and it seems all is working.
Well, I can’t explain that. I even went back and tried removing the sun folder and adding back custom_components/sun.py
and restarting. It worked (as long as I didn’t have any automations that used a sun trigger.) Then I stopped HA and added the sun folder back in, added the automation with a sun trigger back in, then restarted HA. Everything still worked even with these files still present:
custom_components/sun.py
custom_components/__pycache__/sun.cpython-36.pyc
But, I guess, as long as you got it working, then I’m happy!