Tide Times

When you register, you get one month of 100 free credits to make API calls.

So 3 times a day or every eight hours should be possible.

My guess is that the info is rather static so you need at least 1 per day.

Or is this 100 credits just once?

Sorry my response was short, it was from my phone.

This is the email I got back from worldtides after enquiring:

Hi Nick,

Thank you for contacting me. I took a look at your account. It was created back in Feb 2017. At that time we gave new users 1000 free credits per month. However, we no longer do this. Instead we give 100 free credits total and give users 1 month to use them.

I haven’t canceled the previous 1000 credits per month offer. But, it is on my list of things to do. Your email to me won’t shorten my timeline on carrying out this change, so don’t worry. My plan is to simply expire the offer by the end of the year (or something like that).

In your case, you have used 1000 credits since 5/17 and today. 5/17 is your subscription renewal date. It doesn’t line up with the beginning of the month.

Subscriptions are very inexpensive. And it appears that this service is useful for you. So, I recommend that you purchase one that fits usage without assuming that you get an extra 1000 credits per month (because that’s going away).

Suggestions / comments always welcome.

Apologies again, checking here WorldTides - Apidocs reveals

Retrieval of heights, extremes, datums and corrected constituents can be done in one API call, but it will be calculated as separate calls for billing purposes.

My graphs on their site show usually 24 credits used per day, sometimes more. For quite a while in April it was using 48 credits per day.

Frustrating that they are limiting it, but it isn’t as bad as WUnderground making their cheapest monthly subscription to access your own data $850 per month.

PS Line 24 of worldtides.py sets SCAN_INTERVAL to hourly.

SCAN_INTERVAL = timedelta(seconds=3600)

I didn’t want to pay for worldtides, and it was getting complicated to write a script to take a tide table, match it to the time now and return a value.

I live on the water and really just need to know if the tide is rising or falling and for how long, so I used this site www.tides4fishing.com and created a scrape sensor to pull their tide summary tag.

This sensor:

sensor 15:
  - platform: scrape
    resource: http://www.tides4fishing.com/ca/british-columbia/point-atkinson#_tides
    name: Tide
    select: "#brujula_mareas_texto_movil"
    scan_interval: 120

returns “The water level is rising. There are 1 hour and 34 minutes until high tide.” which I can get through Google Assistant with this script:

tide:
  alias: Return the current tide to Google Assistant
  sequence:
  - service: tts.google_say
    entity_id: media_player.living_room_speaker
    data_template:
      message: Tide Status {{states('sensor.tide')}}
      cache: false

Change the resource to whatever the URL for your particular location is. You don’t get the height of the tide, but it’s a good enough summary for me.

PS: I haven’t confirmed if increasing the scan_interval works on the scrape sensor, but if you do implement this be polite and don’t slam their site with excessive requests.

4 Likes

Great, I think that info is far more interesting than what I am currently getting from worldtides.

For some reason, WorldTides seems to be using way more credit than described in the API doc. This would make any WorldTides component almost useless.
I had put a feature request for more data for this component here: https://community.home-assistant.io/t/more-sensors-for-worldtides-component/61583
There is some development on a Magic Seaweed component on GitHub here: https://github.com/home-assistant/home-assistant.io/pull/5598#pullrequestreview-131544698
Development seems to be on hold, but this could be a solution for seafaring automators. Magic Seaweed has data on tides, surf and swell…
Likewise, there is a pull request for NOAA tides data, that could be useful here: https://github.com/home-assistant/home-assistant/pull/15664#pullrequestreview-140402822
Development is also slow. Maybe those with programing skills could help!
Back a few years ago, I had a JS and PHP code running on a website that returned all chart data by scraping the UK Hydrographic Office’s Easytide server.
It also rendered charts as follows:5379_Chart
I still have the code lying around. Let me know if this could be relevant to some developers as I’m happy to share the code by email (800KB)…
I’d really like some proper way to display tides in Home Assistant, but my programing skills are lagging.

1 Like

You are aware that each call to worldtides uses more than one ‘credit’?

Yup, API doc is clear on this.
1 call for 7 days of Extremes and 1 call for 7 days of Heights. I use scan interval with a value of 1080 and have reached 24% of allowed credits in 3 days…
In any case, what would be really useful is a proper tide table implementation for the next few days.

I’m trying to change the datum to ‘LAT’
Any suggestions? I attempted…

# Tides (World Tides)
  • platform: worldtidesinfo
    api_key: #
    name: Tide
    latitude: #
    longitude: #
    datum: “LAT”

…but still shows me tides with minus values like “-0.9” so doesn’t seem to be working

According to the documentation, this option does not exist.

In the offical API website it does

https://www.worldtides.info/apidocs

It doesn’t seem to me in home assistant component though.

Hello,
I’m fairly new to HA and your code here has turned me on to the “scrape” platform and sensor. I modified the url to match my area (quebec/st-romuald#_tides) and it is working perfectly.
I have two questions that i hope you can help me with.

The required “select” variable generally makes sense to me, but your string (#brujula_mareas_texto_movil) (which works just fine) mystifies me. Can you breakdown what I am looking at here?

The other question is about the “scan_interval”. what is the unit of measure, seconds, minutes?

I am in no great hurry, at your leisure please, it is most appreciated, thank you, Bob.

P.S. Many moons ago I lived in Whistler and often when traveling back and forth to Vancouver, i would stop and walk through Lighthouse Park.

Spanish. Author of this site wrote in Spanish.
#compass_tides_text_mobile

That answers that. I suppose the #_tides can be removed from the resource url or at least is unnecessary, no?

Hi Bob, you are correct. When you look at the source HTML for the page it’s in Spanish. That just happens to be the tag where the tide value resides. #_tides is not needed, I just left it in case the website gets refactored in some way.

Scan interval is just to slow down bandwidth usage and site traffic a bit from the default 30 seconds to 120 seconds. From the HA documentation:

SCAN INTERVAL
Platforms that require polling will be polled in an interval specified by the main component. For example a light will check every 30 seconds for a changed state. It is possible to overwrite this scan interval for any platform that is being polled by specifying a scan_interval configuration key. In the example below we set up the your_lights platform but tell Home Assistant to poll the devices every 10 seconds instead of the default 30 seconds.

Example configuration.yaml entry to poll your_lights every 10 seconds.

light:

  • platform: your_lights
    scan_interval: 10

Hi imikerussell!
Great work but is there a reason why this couldnt be integrated into HA as a sensor?

@BarryHampants Did you use WillyWeather API in another project or for yourself for HA? I did a non-api scraper for Tasker on Android. I could port that to python as a tide sensor for HA if others are interested.

2 Likes

@jtitley - sorry, been caught up on other stuff for months. I am fairly sure I just used it for tasker to give me an alert when when wind, waves, tide and swell aligned but I can’t remember now.

hello and for worltides how do you make the template for the hight_tide_height and low_tide_height?

I code this
value_template: '{{ states.sensor.sensor_tide.attributes.low_tide_height }}'
but how to indicate information about unit ‘m’