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

Tags: #<Tag:0x00007f73ae111100> #<Tag:0x00007f73ae110f98> #<Tag:0x00007f73ae110750> #<Tag:0x00007f73ae110660>

I wasn’t happy with the level of detail in the NOAA Tides component so I went ahead and made my own fork of it.

The results:

The repository is on my github along with instructions and sample configuration.

5 Likes

Looks great! I can’t wait to try it out!

Works great! I wonder with the resent changes in HA whether it will be allowed to be used in the future.
They now want any new integrations installed via the UI. Having it in yaml allowed me to install, customize and see the results in minutes. Thanks again.

I’m actively using it myself, so if newer versions of HA require changes, I’ll be sure to update the repository.

What I was referring to is the long discussion about new integrations must be UI installed to be “officially supported”. I find once you have an understanding of yaml, configurations are much easier to share and modify using Yaml. I have used similar code as you have shared and my temperature graphs, water level info and tide info is coming out correct. The graph of the tide is a straight line rather than the sine wave. Do you see what I have done wrong?
My code (your code modified)

  -
    entities:
      - color: '#02ace5'
        entity: sensor.beach_air_temp
        name: Air
        show_state: true
        state_adaptive_color: true
      - color: darkblue
        entity: sensor.water_temp
        name: Water
        show_state: true
        state_adaptive_color: true
    hours_to_show: 24
    name: Air and Water Temperatures_Sandy Hook
    points_per_hour: 12
    show:
      fill: false
    type: 'custom:mini-graph-card'
    unit: °F
  - entities:
      - entity: sensor.next_tide
      - entity: sensor.last_tide
    footer:
      entities:
        - sensor.water_level
      hours_to_show: 12
      icon: 'mdi:swim'
      line_color: darkblue
      lower_bound: 0
      points_per_hour: 60
      show:
        labels: false
      type: 'custom:mini-graph-card'
      upper_bound: 100
    title: Tides_Long Branch Pier
    type: entities

image

When you first add the widget, it backfills data with a flat line. If you wait a couple hours, does it start to look sinusoidal?

edit: on further review i forgot to mention that i use a time_date sensor to provide a heartbeat to the water level sensor, since the sine wave is a mathematical fit that doesn’t update by itself.

Try adding

  - platform: time_date
    display_options:
      - 'beat'

to your sensors configuration, and make sure that the water_level template sensor has

           entity_id: sensor.internet_time

in the block, ie

        water_level:
            friendly_name: "Water level"
            entity_id: sensor.internet_time
            value_template: "{{ state_attr('sensor.tides', 'tide_factor') }}"
            unit_of_measurement: '%'

p.s. my station is on the opposite side of the NY-NJ Bight and shows a high tide at 1:04a.m., so i suspect you’ve configured it correctly!

Thanks I’ll make the changes and let you know. This puts everything I need before I head to the beach without opening another app. Is there anyway to get the buoy data into the sensor? I like looking at the off shore ones to see water temp and waves.

1 Like

I haven’t looked into the buoy attributes, but I assume that the data are largely available in noaa_coops, so I should be able to integrate them. The water is much colder that far from shore, isn’t it?

It is colder, but once summer hits it is more accurate for me than the one by Sandy Hook. Sandy Hook is on the bay side and is much warmer due to the river. The buoy off of NY Harbor (44065) or long island (44025) is closer to the ocean temperature by me. Sometimes NY Harbor is much colder due to the deep water.
The time sensor fixed my graph. Thanks.

Nice Job! I was already using the original component and much appreciate the added detail.

FYI… since your code references the same platform name, I couldn’t get my HA instance to use your version until I restarted HA with my existing sensors disabled. Then, with your noaa_tides directory copied to custom_components, the noaa_tides platform sensor re-enabled, and after restarting HA could I get it to work. Prior to that sequence the config validation would always throw an error.

I’m having an issue with just the sensor. I’m just trying to add it to an entities card. But it shows “invalid date”. The sensor itself looks correct.

image

Looks like you’ve added it as an entity, which I haven’t tried yet. I’ll investigate, but for the detailed view in the screenshot that I posted, you need to follow the docs on how to use the template platform.

You’re correct I did add it as an entity. I’d expect it to show the state. The generic NOAA tides just shows the state when added as an entity. Weird. Sometimes you just wanna show the state. :slight_smile:
Although I do like the extra template sensors and the nice graph too.

I’m in a similar situation with the off shore buoy being more accurate for me. I love what you’ve done so far. I think for me being able to use buoys would be the icing on the cake. Also who knows,maybe someone would want to know the temp way off shore? Either way, great work

To be clear, I believe you’ve found a bug. I intended for it to behave like the current sensor by default, I guess I just didn’t test it. I got too wrapped up in making the graphs pretty :slight_smile:

1 Like

I’ve tagged release 0.0.2 (currently master, if you want to simply git pull to update).

The changes include off-shore buoy support requested by @bschatzow and @ptdalen as well as a fix for the bug identified by @ptdalen.

I put an example buoy sensor in the readme, but I didn’t do any UI examples, so setting up your cards / template sensors is homework. The buoy sensor attributes include every measurement supported by the NBDC, its units, and the timestamp of the most recent data. Go here to find a buoy ID https://www.ndbc.noaa.gov/

Thanks for the feedback and happy 4th!

3 Likes

Thanks works great. Do we need to hand in our homework?

It’s working perfectly for me using the buoy sensor. Thanks for taking the time to do this.

the homework can be honor system :smile: