World Tide Info v2 API + graph

I love what you guys have acheived with the World Tides! I am on a small island in the Bahamas (Little Hog Cay), and have been battling to get it working. So I just tried to use the exact code you have in the example - and it just displays “unknown” for each entity. I am definitely doing something wrong - but I am stumped for 3 days now.

image

This is what I have in my configuration.yaml

sensor:
  - platform: enphase_envoy
    name: Enphase
    ip_address: 192.168.6.80
    monitored_conditions:
      - production
      - daily_production
      - seven_days_production
      - lifetime_production
  - platform: worldtidesinfocustom
    name: royan_tides
    api_key: 1c86297b-xxxx-xxxx-xxxx-1d91503xxxxx
    latitude: 45.61949378902948
    longitude: -1.0318721687376207
#    station_distance: 10
#    vertical_ref : LAT
#    scan_interval: 900
#    worldtides_request_interval: 90000
  - platform: template
    sensors:
      tide_royan_next_high:
        value_template: '{{ as_timestamp(states.sensor.royan_tides.attributes.high_tide_time_utc) | timestamp_custom("%a %d/%m/%Y %H:%M") }}'
        friendly_name: "Royan Next High Tide"
      tide_royan_next_low:
        value_template: '{{ as_timestamp(states.sensor.royan_tides.attributes.low_tide_time_utc) | timestamp_custom("%a %d/%m/%Y %H:%M") }}'
        friendly_name: "Royan Next Low Tide"
      tide_royan_next_high_height:
        value_template: "{{ state_attr('sensor.royan_tides','high_tide_height')  }}"
        friendly_name: "Royan Next High Tide Height"
        unit_of_measurement: m
      tide_royan_next_low_height:
        value_template: "{{ state_attr('sensor.royan_tides','low_tide_height')  }}"
        friendly_name: "Royan Next Low Tide Height"
        unit_of_measurement: m
      tide_royan_credit:
        value_template: "{{ state_attr('sensor.royan_tides','CreditCallUsed')  }}"
        friendly_name: "Royan Tide Credit"
        unit_of_measurement: credit
      tide_royan_current_height:
        value_template: "{{ state_attr('sensor.royan_tides','current_height')  }}"
        friendly_name: "Royan Tide Current Height"
        unit_of_measurement: m
      tide_royan_station:
        value_template: "{{ state_attr('sensor.royan_tides','tidal_station_used')  }}"
        friendly_name: "Royan Tide Station used"

camera:
  - platform: generic
    name: Royan_tides_curve
    still_image_url: https://127.0.0.1:8123/local/royan_tides.png
    verify_ssl: false

switch:
  - platform: ecoplug
    scan_interval: 10

btw, you are always welcome to stop by our Cay if you are in the Abacos.

Great work @jugla. Just migrated over and loving what you’ve done. Kudos man. :+1:

Thanks ioios-io !

Hello wreuvers,
Please can you tell me if you see “royan_tides” sensor (the value is something different than unknown.
Other sensors have no sense without this one.

Please can you see in your configuration directory/custom_components if the worldtidesinfocustom directory exists

Hi jugla

No, I do not see the toyan_tides sensor.
And I have the worldtidesinfocustom directory -
image

Thank you so much for your help!

Cheers
Wayne

@jugla - And it looks like it is fetching the info as I see the requests on the worldtides.info

When I had this issue. I found be removing all the code and hacs install then restart.

Install hacs bit then restart.

Install code then restart.

This then started working, not sure why. Prior to this no api calls were being make to world tides either.

Might be of some use.

Hello Wayne,
Please can you in menu “development tools”, see the tab where you have all states:
look if you find sensor.XXXX_tideXXX (it’s the name you have put in configuration file)

  • do you have something ?

To start in a known point in the analysis, you can restart your HA

Hi Jugla

I copied your exact example for the Royan tides, only changing my api key as a means to make debugging easier.

And I do not see the sensor.royan… in the States tab.

I am truly stumped.

Thanks
Wayne

Hello,
Strange :frowning:
Please can you :

  • upgrade towards V2.3.0 for worldtidesinfocustom
  • restart you HA (completely i.e.reboot) ==> gives the time of reboot
  • see your latest request towards worldtidesinfoserver
  • see what do you have in your config_directory/www
    Thanks in advance

Philippe

Hello,
Please can you update towards v2.3.1 .
Can you tell me on which OS, are you ?

If the error is still confirm can you create an issue on https://github.com/jugla/worldtidesinfocustom

Hi jugla

Sorry for the delay - I had to deal with a few power issues and a new desalination (RO watermaker) unit, so I have been unable to look at this until now.

I am still having the problem so I will add an issue.

Thanks in advance
Wayne

Two things that I discovered that may help others - I am using a Raspberry PI 4B for Home Assistant
Make sure you create the www folder below your config folder - without this the sensor will not appear
And I could not get the Image to work using the recommended settings, so I played around and found this to work well and refreshes too

## CAMERA
camera:
  - platform: local_file
    name: green_turtle_tides_curve
    file_path: "/config/www/green_turtle_tides.png"

Remember to update the name and filename

Does anyone know how to change the metrics to feet (yup, sadly I am in the US where Imperial is still a thing). When I change the unit of measurement to ft, it just shows ft after the metre amount. So I multiplied it by the 3.28 factor but my graph is still showing metres.

      tide_green_turtle_current_height:
        unique_id: 'tidesGTCcurrentHeight'
        value_template: "{{ state_attr('sensor.green_turtle_tides','current_height') * 3.28084 }}"
        friendly_name: "Tide Current Height"
        unit_of_measurement: ft

image

And I will get round to formatting the decimals too :smile:

Hello,
I will see how to display height in feet.

The release V2.5.2 handles the ceation of www directory, if this directory does not exist.

Hello,
Imperial will be supported in V2.6.0 (feet/miles)

This is working REALLY well - absolutely brilliant!!! Thanks for all the effort.

As I (sometimes / often) live on an island in the Bahamas, this is a huge benefit for me!!

Three very useful variables would be
TideState - Rising / Falling
HighTideIn - the number of Hr::min until the next High Tide
LowTideIn - the number of Hr:min until the next Low Tide

And if it was possible, to draw the graph from “now” to hours in the future. This would allow one to easily plan “aah, it’s 4hrs to slack, got some time to get finish my chores before getting the fishing rods out” :grinning:

Hello,
Thanks a lot for your feed back.
As the source code has became important, I have done some modication in order to better organize it ! (V3.0.0) My next aim is to use config flow.

I will add Tide State, HighTideIn, LowTideIn. (V3.1.0)

Unfortunately , I’ve tried to draw from current time the plot curve, but it is the same picture with blank on left side …