I made an improved NOAA Tides sensor for my family's summer house

Can you give a little more details on what you changed after copying the noaa_coops.py file into the tides folder?
Thanks

The “noaa_tides_local” branch on my github has the changes suggested by Alex.

You’ll have to clone it (git clone https://github.com/jshufro/home_assistant_noaa_tides.git), change into the directory, checkout the branch (git checkout noaa_tides_local) and init submodules to pull in the modified noaa_coops (git submodule update --init). There’s a symlink in there to make python happy with the pathing, which may not copy/paste well, so you may be better off removing the symlink and adding the directory directly.

Then you need to restart home assistant. The data show up within 5-10 minutes.

This is not suggested if you’re not familiar with git, python, and ln. I’ll shoot an email over to the maintainer of noaa_coops and ask him to politely merge the fix and release a new version.

1 Like

Thanks. I’ll wait for a fix. Can you resent changes cause HA to take a long time to start up? I am seeing HA is starting, not everything is available until finished.

The recent changes don’t cause the slowness, but the NOAA instability does. That will also be resolved with the update to noaa_coops.

Speaking of, I emailed the original author of noaa_coops to bring the PR to his attention, and it should be merged and tagged within a few days.

1 Like

Hopefully it is fixed soon as now none of the sensors from the tides work.

I just noticed that your new code is causing a couple of issues for me.

Home Assistant is starting, not everything is available until finished

And none of my other template sensors are available. I just did a restart without the tide sensor and all of my other sensors work again and the Home Assistant is starting goes away very quickly.
I then went back to your 7/5 codes and a couple of yours work again and all my others work.

Interesting, but also not something I’m going to look into until noaa_coops is updated.

All- I tagged version 0.1.1 which uses the updated noaa_coops (hat tip to the maintainer, gclunies, for promptly merging the PR and publishing the updated version to py-pi).

I tested it locally and it’s working well.

@bschatzow - The sensors start up reasonably quickly for me on 0.1.1, but please let me know if they’re slow for you or if you run into anything unexpected.

1 Like

Still very slow starting up. Over five minutes and counting. Not sure how long it took as I had to go away for awhile. The code seems to have fixed the N/A issue as all of the sensors are working again. Next time I restart, I’ll let you know.

5 minutes certainly sounds too long. If it still takes that long, try completely removing noaa_tides and seeing if it’s faster.

I did before an it started very fast. I’ll do and restart both ways and get back to you.

I just installed 0.1.1 and it seems to be working now. Values are coming up again (they weren’t working with the previous version for a week or so). It seems to be starting up faster as well. However I still have the following in my logs after startup:

2020-08-10 18:56:08 ERROR (SyncWorker_1) [custom_components.noaa_tides.sensor] Received HTTP code 404 from https://www.ndbc.noaa.gov/data/realtime2/8443970.txt query
2020-08-10 18:56:08 ERROR (SyncWorker_7) [custom_components.noaa_tides.sensor] Received HTTP code 404 from https://www.ndbc.noaa.gov/data/realtime2/8443970.txt query
2020-08-10 18:56:17 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform noaa_tides is taking over 10 seconds.
2020-08-10 18:56:17 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform noaa_tides is taking over 10 seconds.
2020-08-10 19:02:09 ERROR (SyncWorker_1) [custom_components.noaa_tides.sensor] Received HTTP code 404 from https://www.ndbc.noaa.gov/data/realtime2/8443970.txt query

Thanks for the update.

My logs:

2020-08-10 19:59:31 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform noaa_tides is taking over 10 seconds.
/usr/local/lib/python3.8/site-packages/noaa_coops/noaa_coops.py:421: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead
  df = json_normalize(json_dict[key])  # Parse JSON dict to dataframe
/usr/local/lib/python3.8/site-packages/noaa_coops/noaa_coops.py:421: FutureWarning: pandas.io.json.json_normalize is deprecated, use pandas.json_normalize instead
  df = json_normalize(json_dict[key])  # Parse JSON dict to dataframe

About 1 minute faster boot time without tide sensors.

Just set this up and everything is working as expected. I use the HA NOAA tides sensor almost every day and this is much better. Thanks!

@cdopp - Those log errors indicate that you have a type: buoy sensor configured with an invalid station id, 8443970. I don’t see it in the NDBC.

@bschatzow I need more detailed logging to debug the slow startup. If you don’t mind, please add a block like this to your configuration:

logger:
  logs:
    custom_components.noaa_tides: debug

After your next restart you should see much more data in your full log, which may help me figure out why it’s starting up slowly.

@linkdevk you’re welcome!

@jshufro - Thank you. I didn’t notice the incorrect buoy id. I updated it to an active buoy id and the errors went away.

After I added it, it started fairly quickly. Maybe something else. I still see that it taken over 10 seconds to start error in the log. I’m leave the info in the log and if there is an issue, I send it to you. All seems to be working well. Let’s see if it changes now that .114 is released.
I have dinner several more restarts and not seeing any issues. Not sure what the problem was but it’s now gone.

This is a great project. Thank you all the work. Any chance features will be added to pull additional products from ‘https://tidesandcurrents.noaa.gov/’ stations? ie: humidity, visibility, air_pressure

Not knowing how easy or hard this is, you can get that stuff from the new accuweather integration.

Did some of the Noaa stations change how they are sending data? I have not received air or water temps from Sandy Hook (8531680) for over a week.