tmjo / ha-norwegiantide

Tide information for Norway from Kartverket as a custom integration for Home Assistant. Provides tidal data such as time for high/low, ebb/flow and prediction, forecast and observation.
6 stars 0 forks source link

Apexcharts example in Readme? #7

Open cortado opened 1 year ago

cortado commented 1 year ago

Really useful HA integration - possible to provide the Apexchart code for your example in the Readme?

tmjo commented 1 year ago

Hi,

Here's an example:

type: custom:apexcharts-card
graph_span: 36h
span:
  offset: +24h
now:
  show: true
  label: Now
header:
  show: true
  title: Tidewater
  show_states: true
series:
  - entity: sensor.YOURPLACE_tide_main
    name: Prediction
    show:
      extremas: time
      in_header: before_now
      legend_value: false
    data_generator: |
      return entity.attributes.data.map((entry) => {
        return [new Date(entry.datetime).getTime(), entry.prediction];
      });
  - entity: sensor.YOURPLACE_tide_main
    name: Forecast
    show:
      in_header: before_now
      legend_value: false
    data_generator: |
      return entity.attributes.data.map((entry) => {
        return [new Date(entry.datetime).getTime(), entry.forecast];
      });
  - entity: sensor.YOURPLACE_tide_main
    name: Observation
    show:
      in_header: before_now
      legend_value: false
    data_generator: |
      return entity.attributes.data.map((entry) => {
        return [new Date(entry.datetime).getTime(), entry.observation];
      });

Will look something like this:

image