pnbruckner/ha-sun2

Integration sun2 not found

oneseventhree opened this issue · 7 comments

Hi, I am getting this error:

Screen Shot 2022-06-08 at 5 34 52 pm

I've installed manually and with HACS with the same result. The files are in my config/custom_components so I am not sure whats wrong

The files should be in config/custom_components/sun2. I.e., you need to create a folder named sun2 inside config/custom_components, and then place the files there.

The files should be in config/custom_components/sun2. I.e., you need to create a folder named sun2 inside config/custom_components, and then place the files there.

Hi, that is indeed where my sun2 folder is and I still get that message. For some reason home assistant can’t see the sun2 folder in custom_components. Any ideas on how to fix this?

Here are some easy to miss things to lookout for:

  1. HACS: Unless you have a reason not to, its probably the best to install HACS, then install Sun2 through HACS. It will enable way to update your install, and is an easy to install additional 3rd party integrations.
  2. Permissions: Depending on how your system is setup, when you copy/move data into a new folder HomeAssistant may not be allow to access the new folder/files.
    So remember to check that your files/folders have the correct Owner and Group assigned as well as the correct Read/Write/Execute permissions.
  3. Configuration: To enable Sun2 you will need to manually edit your HomeAssistant config file config/configuration.yaml.
    You should use the simple/typical configuration listed at the top of the README to ensure the integration is working correctly.
    When expanding the configuration to enable additional features, be sure to compare it to the example configuration to check for easy to catch errors.
    Always remember to validate your configuration files after making any changes, you can do this by going to Developer Tools and clicking the Check Configuration button..
  4. Reboot: When manually editing your HomeAssistant configuration file, you will need to reboot the server before the changes are applied.
    Always remember to validate your configuration before rebooting. If your configuration file is broken and you reboot, you may need to manually access the file in order to attempt to fix HomeAssistant. You can restart HomeAssistant by clicking on the Reboot button on the Developer Tools page.

@oneseventhree you probably already did all the above already, but these where the stumbling blocks I faced trying to get integrations working.
I've also just updated HomeAssistant and Sun2 to the current version and don't see anything obviously broken.

-- Basically repeating my self, but in a cleaner/simpler format --

I just purposely broke my Sun2 to see how HomeAssistant deals with issues.
Looks like if you installed/removed/updated an integration (while HA is running), the Check Configuration feature doesn't take the changes into account.
Did you remember to reboot installing Sun2? If you try to configure an integration before rebooting it will error saying the integration was not found.

So based on your issue, HomeAssistant cant see config/custom_components/sun2; some relevant diagnostics/debugging tips:

HACS Install:

  • Remove/Delete Sun 2 through HACS
  • Verify that the files where actually deleted form config/custom_components
  • Install Sun2 through HACS
  • Restart HomeAssistant, remember to Check Configuration (you will need to remove all sun2 code)
  • After HomeAssistant has started use the "typical configuration" on the README page, and check if Sun2 integration works.

Manual Install:

  • Make you are in the correct folder (you are, since HACS is installed and working)
  • Check to make that the folder belongs to the same user/group that HomeAssistant belongs to.
  • Verify that HomeAssistant has complete read/wite access to sun2 and all its contents.
  • Restart HomeAssistant, remember to Check Configuration (you will need to remove all sun2 code)
  • After HomeAssistant has started use the "typical configuration" on the README page, and check if Sun2 integration works.

If you are on Linux or BSD; you can check file ownership and permissions by going to config/custom_components folder on the terminal of your choice and run the following command: ls -la . sun2/.

-- Basically repeating my self, but in a cleaner/simpler format --

I just purposely broke my Sun2 to see how HomeAssistant deals with issues. Looks like if you installed/removed/updated an integration (while HA is running), the Check Configuration feature doesn't take the changes into account. Did you remember to reboot installing Sun2? If you try to configure an integration before rebooting it will error saying the integration was not found.

So based on your issue, HomeAssistant cant see config/custom_components/sun2; some relevant diagnostics/debugging tips:

HACS Install:

  • Remove/Delete Sun 2 through HACS
  • Verify that the files where actually deleted form config/custom_components
  • Install Sun2 through HACS
  • Restart HomeAssistant, remember to Check Configuration (you will need to remove all sun2 code)
  • After HomeAssistant has started use the "typical configuration" on the README page, and check if Sun2 integration works.

Manual Install:

  • Make you are in the correct folder (you are, since HACS is installed and working)
  • Check to make that the folder belongs to the same user/group that HomeAssistant belongs to.
  • Verify that HomeAssistant has complete read/wite access to sun2 and all its contents.
  • Restart HomeAssistant, remember to Check Configuration (you will need to remove all sun2 code)
  • After HomeAssistant has started use the "typical configuration" on the README page, and check if Sun2 integration works.

If you are on Linux or BSD; you can check file ownership and permissions by going to config/custom_components folder on the terminal of your choice and run the following command: ls -la . sun2/.

Installing with HACS did the trick! Unsure why it didn't work the manual way.

Thanks for your help :)

Are you able to tell me the difference between adding the elevation sensor as binary compared to regular sensor?

Thanks again

Binary Sensor
A binary sensor must be ether on or off. By setting a threshold the sensor will turn 'on' when sun's elevation is above the horizon the stated elevation and 'off' when it's below.

Sensors: Other
In contrast the elevation sensor simply states the sun's current elevation.

If you want to automate a action to happen when the sun reaches a certain elevation, you will either want to use the binary elevation sensor.

You could regular elevation sensor and get the same result, but it would take a lot more effort on your part and may require writing custom YAML Templates. Then depending on what and how you want to automate, you'll probably want to look into Helpers next (and now we have binary elevation sensor).

At first look, for automation purposes binary sensor seams to be more helpful upfront. I'm sure knowing the exact location of the sun, and running automation's based on that and other factors could be useful. For my use case the elevation sensor equivalent sundial; can be useful and is nice to have, but not practical for actual time keeping.

@QORTEC thanks for the suggestions. You're hired! 😄

@oneseventhree glad you got it working!