Ludy87 / xplora_watch

Xplora® Watch Home Assistant Integration
MIT License
47 stars 6 forks source link

🐛 service.yaml creation leads to non-working integration #61

Closed ravor-org closed 1 year ago

ravor-org commented 1 year ago

System Health details

Version | core-2022.9.5 -- | -- Installation Type | Home Assistant Core Development | false Supervisor | false Docker | false User | homeassistant Virtual Environment | true Python Version | 3.10.6 Operating System Family | Linux Operating System Version | 5.4.70-ravor CPU Architecture | x86_64 Timezone | Europe/Berlin Configuration Directory | /home/homeassistant/.homeassistant

Checklist

Describe the issue

I'm running HA Core in a Venv environment and the integration fails to start due to using a wrong path. I've created a pull request for fixing that: #62

Reproduction steps

  1. Have HomeAssistant Core in venv
  2. Install XploraIntegration
  3. Start HA Core
  4. Integration fails to setup

Debug logs

Sep 21 09:58:52 hwr-server01 hass[20975]: 2022-09-21 09:58:52.462 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Xplora® for xplora_watch
Sep 21 09:58:52 hwr-server01 hass[20975]: Traceback (most recent call last):
Sep 21 09:58:52 hwr-server01 hass[20975]:   File "/opt/homeassistant/lib/python3.10/site-packages/homeassistant/config_entries.py", line 357, in async_setup
Sep 21 09:58:52 hwr-server01 hass[20975]:     result = await component.async_setup_entry(hass, self)
Sep 21 09:58:52 hwr-server01 hass[20975]:   File "/home/homeassistant/.homeassistant/custom_components/xplora_watch/__init__.py", line 50, in async_setup_entry
Sep 21 09:58:52 hwr-server01 hass[20975]:     service_yaml(watches)
Sep 21 09:58:52 hwr-server01 hass[20975]:   File "/home/homeassistant/.homeassistant/custom_components/xplora_watch/helper.py", line 59, in service_yaml
Sep 21 09:58:52 hwr-server01 hass[20975]:     with open(path + "/services.yaml", "w+") as f:
Sep 21 09:58:52 hwr-server01 hass[20975]: FileNotFoundError: [Errno 2] No such file or directory: '//custom_components/xplora_watch/services.yaml'
Ludy87 commented 1 year ago

hi, your default doesn't match the normal path for the config.

Default path: /home/homeassistant/.homeassistant/config/custom_components/xplora_watch/helper.py Please note config in path.

What is your path to the config?

ravor-org commented 1 year ago

My path is indeed: /home/homeassistant/.homeassistant/custom_components/ (missing "config" folder)

I've created a new pull request, which fixes the issue with the HA API: #62