Closed mikewagnercmp closed 9 months ago
As a side note the rest of the astro weather works wonderfully!
I believe the error is in the path. The www
directory of Home Assistant when running as a container is located here: /config/www
from the Home Assistant perspective.
Uptonight does not have any direct interaction with Home Assistant. It simply drops the files to the specified location.
As seen in the Readme of AstroWeather, I mount the Home Assistant config directory to local and tell UpTonight to drop the files to www
in this directory.
When having debug mode for pyastroweatherio: debug
active you should either get a Uptonight imported
or uptonight-report.json not found.
Ok. I am not using a docker for home assistant. I looked in the code its hard to tell, but it looks like the uptonight_path
is just a relative path to /conf/www
instead of it being an absolute path to where the files actually were.
Am i correct in assuming that the complete absolute path is uptonight_path/conf/www
?
again, as shown in my screenshot, here is where i have the files no,as per the find
command. I set my uptonight_path
to this
So, uptonight seems to place the files in the correct location www/
. All good here.
You can test this with http(s)://YOUR HOMEASSISTANT:PORT/local/uptonight-plot.png
. This should give you the plot in your browser. See hosting files.
The only missing part seems to be a correct path from the home assistant perspective. When running in a container this is /conf/www
, in your case this should then be /root/homeassistant/www
, I assume (with a starting slash).
Good tip - on my instance, http://192.168.1.16:8123/local/uptonight-plot.png
gave me the plot just fine, I can also access the txt/json off the same URL http://192.168.1.16:8123/local/uptonight-report.json
So it is JUST the sensor that is not seeming to work for me. In the Astroweather config, I entered /root/homeassistant/www
, fire it up, and see it consume the path, however, with the debug logging on I never see the actual uptonight sensor entity say it can or cannot find the file, and if i look at the entity in Ha, it just says "unknown" for the values.
I am not a markdown expert, but it think the astroweather sensor is manipulating the data in some way, so I do not think I can just replace the sensor with a path to the .json and have it work, since the markdown is expecting an actual object.
I am delighted that i figured out how to get at least the image plot to the right place. However, the docs on the image were a little confusing, I will have to go through them again as I think there is an option you specified that I did not see in my interface. I did install the add on for the tap-to-zoom.
did you set pyastroweatherio to debug in your home assistant configuration?
logger:
default: warning
logs:
custom_components.astroweather: info
pyastroweatherio: debug
If so, you should either get a "Uptonight imported"
or "uptonight-report.json not found. Current path: {self._uptonight_path}/uptonight-report.json"
.
self._uptonight_path
will be replaced by the configured value.
Additionally, I just saw that you end the path in the first screenshot with a /
, remove this.
Good tip - on my instance,
http://192.168.1.16:8123/local/uptonight-plot.png
gave me the plot just fine, I can also access the txt/json off the same URLhttp://192.168.1.16:8123/local/uptonight-report.json
So it is JUST the sensor that is not seeming to work for me. In the Astroweather config, I entered
/root/homeassistant/www
, fire it up, and see it consume the path, however, with the debug logging on I never see the actual uptonight sensor entity say it can or cannot find the file, and if i look at the entity in Ha, it just says "unknown" for the values.
I am not a markdown expert, but it think the astroweather sensor is manipulating the data in some way, so I do not think I can just replace the sensor with a path to the .json and have it work, since the markdown is expecting an actual object.
I am delighted that i figured out how to get at least the image plot to the right place. However, the docs on the image were a little confusing, I will have to go through them again as I think there is an option you specified that I did not see in my interface. I did install the add on for the tap-to-zoom.
The sensor being unavailable indicates, that there is no state for the sensor. The markdown just renders the attributes of the sensor when available. The two sensors should look like this:
Ok I got that logging enabled as per your last comments I see this. I will admint I am confused as that file is exactly where is says it needs to be
as a side note I checked the file permissions and they were alright, I even set the file to 777 just to make sure there was no chance there was a permission problem.
Hm, please try the following in your configuration.yaml
:
homeassistant:
# White list
allowlist_external_dirs:
- /root/homeassistant/www
welp I fixed it but not how i would have expected - i left the path as the default and it magically pulls in the file.
Only thing I cannot figure out now, is the template image thing. Where in HA do I define a Template Image? when I try to define a template, i have to choose between a binary and some other type of sensor.
you can only define sensors and binary_sensors in the UI. All other templates go into yaml. Same here since you define a image type. Documentation
Perfect, thank you I will take a look in the morning when I wake up. Thanks again, really appreciate you taking time to talk through this.
I think the file issue is due to the VM image actually is running two docker containers, one for the supervisor and one for home assistant. That would explain why /config/www works, as I suspect it is mapped to the full path I found.
Sure thing :-) And I'm happy you find my little projects useful.
Hello. Running Home Assistant in a VM on unraid - through a lot of trial and error I figured out how to run uptonight put the files in the /root/homeassistant/www folder in my VM.
during the config, I mapped the uptonight path to that folder. I verified that the .json and plot files are there wit the terminal.
here is the debug log but it does not have much:
2023-11-21 00:29:57.746 DEBUG (MainThread) [custom_components.astroweather] Starting up 2023-11-21 00:29:57.746 DEBUG (MainThread) [custom_components.astroweather] Options latitude 41.5824944 2023-11-21 00:29:57.746 DEBUG (MainThread) [custom_components.astroweather] Options longitude -81.2034066 2023-11-21 00:29:57.746 DEBUG (MainThread) [custom_components.astroweather] Options elevation 300 2023-11-21 00:29:57.746 DEBUG (MainThread) [custom_components.astroweather] Options timezone America/New_York 2023-11-21 00:29:57.746 DEBUG (MainThread) [custom_components.astroweather] Update interval 5 2023-11-21 00:29:57.746 DEBUG (MainThread) [custom_components.astroweather] Options cloudcover_weight 3 2023-11-21 00:29:57.746 DEBUG (MainThread) [custom_components.astroweather] Options seeing_weight 2 2023-11-21 00:29:57.746 DEBUG (MainThread) [custom_components.astroweather] Options transparency_weight 1 2023-11-21 00:29:57.746 DEBUG (MainThread) [custom_components.astroweather] Uptonight path /root/homeassistant/www/ 2023-11-21 00:29:57.746 DEBUG (MainThread) [custom_components.astroweather] Connected to AstroWeather platform 2023-11-21 00:29:58.459 DEBUG (MainThread) [custom_components.astroweather] Finished fetching astroweather data in 0.713 seconds (success: True) 2023-11-21 00:29:58.459 DEBUG (MainThread) [custom_components.astroweather] Data update coordinator created (update interval: 5) 2023-11-21 00:29:58.460 DEBUG (MainThread) [custom_components.astroweather] Finished fetching astroweather data in 0.001 seconds (success: True) 2023-11-21 00:29:58.460 DEBUG (MainThread) [custom_components.astroweather] Forecast update coordinator created (update interval: 5) 2023-11-21 00:29:58.460 DEBUG (MainThread) [custom_components.astroweather] Forecast updated 2023-11-21 00:29:58.464 INFO (MainThread) [custom_components.astroweather.binary_sensor] Set up AstroWeather binary sensor platform 2023-11-21 00:29:58.464 INFO (MainThread) [custom_components.astroweather.sensor] Set up AstroWeather sensor platform 2023-11-21 00:29:58.464 INFO (MainThread) [custom_components.astroweather.weather] Set up AstroWeather weather platform
Here is the path in my VM to the files![image](https://github.com/mawinkler/astroweather/assets/23058476/1d0c8304-2ccb-453e-9c05-4c6823a65629)
Here is what the uptonight sensor states - unknown
When i try to use th emarkdown card, it is empty, i would assume b/c the sensor is empty.
if it matters, I am running UpTonight in a docker container, I have the /www folder mapped using SMB and my docker is pushing the files to that folder. I'm sure it is irrelevant since the files are clearly in the folder,