Hi there I would like to plot the marine forecast, i’m able to extract the information in json format. However I’m stuck in the arrays.
{## Imitate available variables: ##}
{% set my_test_json = {"latitude":54.0,"longitude":10.5,"generationtime_ms":0.7840394973754883,"utc_offset_seconds":0,"timezone":"GMT","timezone_abbreviation":"GMT","hourly_units":{"time":"iso8601","wave_height":"m","wave_direction":"°","wave_period":"s","wind_wave_height":"m","wind_wave_direction":"°","wind_wave_period":"s","wind_wave_peak_period":"s","swell_wave_height":"m","swell_wave_direction":"°","swell_wave_period":"s","swell_wave_peak_period":"s"},"hourly":{"time":["2023-02-07T00:00","2023-02-07T01:00","2023-02-07T02:00","2023-02-07T03:00","2023-02-07T04:00","2023-02-07T05:00","2023-02-07T06:00","2023-02-07T07:00","2023-02-07T08:00","2023-02-07T09:00","2023-02-07T10:00","2023-02-07T11:00","2023-02-07T12:00","2023-02-07T13:00","2023-02-07T14:00","2023-02-07T15:00","2023-02-07T16:00","2023-02-07T17:00","2023-02-07T18:00","2023-02-07T19:00","2023-02-07T20:00","2023-02-07T21:00","2023-02-07T22:00","2023-02-07T23:00","2023-02-08T00:00","2023-02-08T01:00","2023-02-08T02:00","2023-02-08T03:00","2023-02-08T04:00","2023-02-08T05:00","2023-02-08T06:00","2023-02-08T07:00","2023-02-08T08:00","2023-02-08T09:00","2023-02-08T10:00","2023-02-08T11:00","2023-02-08T12:00","2023-02-08T13:00","2023-02-08T14:00","2023-02-08T15:00","2023-02-08T16:00","2023-02-08T17:00","2023-02-08T18:00","2023-02-08T19:00","2023-02-08T20:00","2023-02-08T21:00","2023-02-08T22:00","2023-02-08T23:00","2023-02-09T00:00","2023-02-09T01:00","2023-02-09T02:00","2023-02-09T03:00","2023-02-09T04:00","2023-02-09T05:00","2023-02-09T06:00","2023-02-09T07:00","2023-02-09T08:00","2023-02-09T09:00","2023-02-09T10:00","2023-02-09T11:00","2023-02-09T12:00","2023-02-09T13:00","2023-02-09T14:00","2023-02-09T15:00","2023-02-09T16:00","2023-02-09T17:00","2023-02-09T18:00","2023-02-09T19:00","2023-02-09T20:00","2023-02-09T21:00","2023-02-09T22:00","2023-02-09T23:00","2023-02-10T00:00","2023-02-10T01:00","2023-02-10T02:00","2023-02-10T03:00","2023-02-10T04:00","2023-02-10T05:00","2023-02-10T06:00","2023-02-10T07:00","2023-02-10T08:00","2023-02-10T09:00","2023-02-10T10:00","2023-02-10T11:00","2023-02-10T12:00","2023-02-10T13:00","2023-02-10T14:00","2023-02-10T15:00","2023-02-10T16:00","2023-02-10T17:00","2023-02-10T18:00","2023-02-10T19:00","2023-02-10T20:00","2023-02-10T21:00","2023-02-10T22:00","2023-02-10T23:00","2023-02-11T00:00","2023-02-11T01:00","2023-02-11T02:00","2023-02-11T03:00","2023-02-11T04:00","2023-02-11T05:00","2023-02-11T06:00","2023-02-11T07:00","2023-02-11T08:00","2023-02-11T09:00","2023-02-11T10:00","2023-02-11T11:00","2023-02-11T12:00","2023-02-11T13:00","2023-02-11T14:00","2023-02-11T15:00","2023-02-11T16:00","2023-02-11T17:00","2023-02-11T18:00","2023-02-11T19:00","2023-02-11T20:00","2023-02-11T21:00","2023-02-11T22:00","2023-02-11T23:00","2023-02-12T00:00","2023-02-12T01:00","2023-02-12T02:00","2023-02-12T03:00","2023-02-12T04:00","2023-02-12T05:00","2023-02-12T06:00","2023-02-12T07:00","2023-02-12T08:00","2023-02-12T09:00","2023-02-12T10:00","2023-02-12T11:00","2023-02-12T12:00","2023-02-12T13:00","2023-02-12T14:00","2023-02-12T15:00","2023-02-12T16:00","2023-02-12T17:00","2023-02-12T18:00","2023-02-12T19:00","2023-02-12T20:00","2023-02-12T21:00","2023-02-12T22:00","2023-02-12T23:00","2023-02-13T00:00","2023-02-13T01:00","2023-02-13T02:00","2023-02-13T03:00","2023-02-13T04:00","2023-02-13T05:00","2023-02-13T06:00","2023-02-13T07:00","2023-02-13T08:00","2023-02-13T09:00","2023-02-13T10:00","2023-02-13T11:00","2023-02-13T12:00","2023-02-13T13:00","2023-02-13T14:00","2023-02-13T15:00","2023-02-13T16:00","2023-02-13T17:00","2023-02-13T18:00","2023-02-13T19:00","2023-02-13T20:00","2023-02-13T21:00","2023-02-13T22:00","2023-02-13T23:00"],"wave_height":[0.06,0.06,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.04,0.04,0.06,0.10,0.12,0.12,0.12,0.12,0.12,0.14,0.14,0.14,0.16,0.16,0.16,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.18,0.20,0.22,0.24,0.26,0.30,0.32,0.32,0.34,0.34,0.34,0.32,0.32,0.34,0.36,0.38,0.38,0.40,0.40,0.36,0.34,0.30,0.26,0.22,0.18,0.16,0.16,0.14,0.18,0.20,0.24,0.26,0.26,0.28,0.30,0.30,0.32,0.36,0.40,0.44,0.46,0.50,0.52,0.52,0.52,0.52,0.52,0.50,0.50,0.50,0.52,0.52,0.56,0.62,0.66,0.64,0.60,0.58,0.56,0.52,0.50,0.46,0.40,0.36,0.32,0.28,0.24,0.22,0.20,0.18,0.18,0.16,0.16,0.16,0.18,0.18,0.18,0.20,0.20,0.20,0.20,0.20,0.18,0.18,0.16,0.16,0.16,0.16,0.16,0.16,0.16,0.16,0.16,0.16,0.14,0.14,0.12,0.14,0.14,0.16,0.18,0.22,0.24,0.22,0.18,0.16,0.14,0.12,0.10,0.08,0.08,0.06,0.06,0.06],"wave_direction":[41,42,42,43,44,46,47,61,75,89,111,133,155,158,160,163,163,162,162,163,163,164,165,166,167,167,166,166,164,163,161,161,161,161,161,160,160,160,160,160,161,161,162,162,163,163,164,164,165,167,170,172,176,180,184,189,193,198,204,209,215,217,220,222,224,227,229,231,234,236,238,241,243,245,246,248,249,249,250,250,249,249,247,246,244,242,239,237,234,230,227,227,226,226,230,233,237,241,245,249,254,260,265,266,268,269,270,270,271,272,273,274,278,281,285,288,291,294,294,295,295,295,294,294,294,293,293,292,291,290,289,287,286,283,280,277,275,274,272,271,271,270,269,268,267,267,267,267,267,268,268,266,265,263,264,264,265,266,266,267,267,267,267,267,267,267,267,267],"wave_period":[2.05,2.05,2.10,2.10,2.10,2.10,2.05,2.00,1.95,1.90,1.90,1.90,1.90,1.90,1.85,1.85,1.85,1.85,1.85,1.85,1.80,1.80,1.80,1.75,1.75,1.75,1.70,1.70,1.65,1.65,1.60,1.60,1.60,1.60,1.60,1.60,1.65,1.70,1.75,1.80,1.80,1.75,1.75,1.75,1.80,1.85,1.90,1.95,2.00,2.05,2.10,2.10,2.10,2.05,2.05,2.05,2.05,2.10,2.15,2.25,2.30,2.35,2.40,2.40,2.40,2.35,2.35,2.35,2.40,2.40,2.40,2.45,2.45,2.45,2.40,2.35,2.30,2.20,2.15,2.05,1.95,1.90,1.95,2.00,2.10,2.15,2.15,2.20,2.25,2.25,2.30,2.35,2.45,2.50,2.55,2.60,2.65,2.70,2.70,2.70,2.70,2.70,2.70,2.70,2.70,2.70,2.75,2.80,2.85,2.90,2.90,2.90,2.85,2.80,2.75,2.70,2.65,2.55,2.45,2.35,2.25,2.15,2.10,2.05,2.00,1.95,1.95,1.95,1.95,1.95,2.00,2.00,2.05,2.05,2.05,2.05,2.05,2.00,2.00,2.00,1.95,1.95,1.95,2.00,2.00,2.00,2.05,2.05,2.05,2.00,1.95,1.90,1.80,1.80,1.90,2.00,2.10,2.15,2.15,2.15,2.15,2.10,2.10,2.05,2.05,2.00,1.95,1.95],"wind_wave_height":[0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.02,0.02,0.02,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.02,0.02,0.04,0.06,0.08,0.08,0.06,0.06,0.08,0.08,0.10,0.10,0.12,0.12,0.12,0.14,0.14,0.14,0.14,0.14,0.14,0.16,0.16,0.18,0.20,0.22,0.26,0.28,0.32,0.32,0.32,0.32,0.32,0.30,0.30,0.32,0.36,0.38,0.38,0.40,0.40,0.36,0.30,0.26,0.20,0.16,0.10,0.10,0.12,0.12,0.16,0.20,0.24,0.26,0.26,0.28,0.28,0.30,0.30,0.34,0.40,0.44,0.46,0.50,0.52,0.52,0.52,0.52,0.52,0.50,0.50,0.50,0.52,0.52,0.56,0.62,0.66,0.64,0.60,0.58,0.56,0.52,0.50,0.44,0.40,0.34,0.28,0.24,0.18,0.16,0.14,0.12,0.12,0.12,0.12,0.14,0.14,0.16,0.16,0.16,0.16,0.16,0.16,0.16,0.16,0.14,0.14,0.14,0.16,0.16,0.16,0.16,0.16,0.14,0.12,0.10,0.10,0.08,0.08,0.10,0.12,0.14,0.16,0.20,0.22,0.16,0.12,0.06,0.04,0.02,0.00,0.00,0.00,0.00,0.00,0.00],"wind_wave_direction":[180,180,180,180,180,180,180,180,180,180,190,199,209,199,190,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,175,169,164,168,171,175,174,172,171,171,170,170,171,172,173,175,176,178,182,187,191,193,196,198,201,204,207,211,215,219,220,222,223,226,228,231,233,234,236,238,241,243,246,249,252,252,251,251,248,246,243,243,243,243,241,238,236,232,228,224,225,225,226,230,233,237,241,246,250,255,261,266,267,268,269,270,270,271,272,273,274,278,281,285,289,293,297,296,294,293,293,294,294,293,291,290,290,290,290,288,285,283,278,274,269,268,266,265,266,266,267,266,264,263,264,265,266,266,267,267,265,263,261,262,264,265,265,266,266,237,209,180,180,180,180,180,180],"wind_wave_period":[1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.10,1.20,1.25,1.20,1.10,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.05,1.15,1.25,1.30,1.35,1.40,1.40,1.35,1.35,1.40,1.50,1.55,1.55,1.60,1.60,1.65,1.70,1.75,1.80,1.80,1.80,1.80,1.80,1.80,1.85,1.90,2.00,2.10,2.20,2.25,2.30,2.35,2.35,2.35,2.30,2.30,2.30,2.35,2.40,2.45,2.45,2.45,2.40,2.35,2.25,2.05,1.75,1.55,1.50,1.50,1.60,1.75,1.95,2.10,2.15,2.15,2.15,2.20,2.25,2.30,2.35,2.45,2.50,2.55,2.60,2.65,2.70,2.70,2.70,2.70,2.70,2.70,2.70,2.70,2.70,2.75,2.80,2.85,2.90,2.90,2.90,2.85,2.80,2.75,2.65,2.55,2.45,2.25,2.05,1.90,1.80,1.75,1.75,1.75,1.75,1.75,1.80,1.85,1.90,1.95,1.95,1.95,1.95,1.90,1.90,1.85,1.80,1.80,1.80,1.85,1.85,1.90,1.90,1.90,1.85,1.75,1.65,1.60,1.50,1.50,1.55,1.65,1.75,1.90,2.05,2.05,1.85,1.55,1.30,1.15,1.05,1.00,1.00,1.00,1.00,1.00,1.00],"wind_wave_peak_period":[1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,0.95,1.00,1.15,1.40,1.50,1.40,1.15,1.00,0.95,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,0.95,1.00,1.15,1.35,1.50,1.55,1.50,1.50,1.50,1.45,1.50,1.60,1.75,1.85,1.85,1.85,1.85,1.90,1.95,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.05,2.10,2.20,2.30,2.40,2.45,2.45,2.45,2.45,2.50,2.60,2.65,2.65,2.65,2.65,2.65,2.65,2.65,2.65,2.70,2.65,2.45,2.20,2.00,1.95,1.95,2.00,2.05,2.10,2.20,2.30,2.40,2.45,2.45,2.45,2.45,2.50,2.55,2.65,2.75,2.85,2.95,2.95,2.95,2.95,2.95,2.95,2.95,2.95,2.95,2.95,2.95,2.95,2.95,3.05,3.20,3.25,3.20,3.05,2.95,2.95,3.00,2.95,2.80,2.65,2.45,2.30,2.10,2.00,1.95,2.00,2.00,2.00,2.00,2.00,2.05,2.15,2.20,2.20,2.20,2.20,2.20,2.20,2.20,2.15,2.05,2.00,2.00,2.00,2.00,2.00,2.00,2.00,1.95,1.90,1.85,1.90,1.95,2.00,2.10,2.20,2.20,2.05,1.75,1.50,1.30,1.10,1.00,0.95,1.00,1.00,1.00,1.00],"swell_wave_height":[0.06,0.06,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.04,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.02,0.04,0.04,0.04,0.06,0.06,0.08,0.08,0.10,0.10,0.08,0.08,0.08,0.10,0.10,0.10,0.12,0.12,0.12,0.12,0.12,0.12,0.10,0.10,0.10,0.10,0.10,0.10,0.10,0.10,0.10,0.10,0.10,0.10,0.08,0.08,0.08,0.06,0.06,0.06,0.08,0.08,0.10,0.12,0.14,0.14,0.16,0.16,0.14,0.12,0.10,0.08,0.08,0.06,0.06,0.06,0.06,0.08,0.08,0.10,0.08,0.08,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.08,0.08,0.06,0.06,0.04,0.04,0.04,0.04,0.04,0.06,0.06,0.06,0.06,0.06,0.08,0.10,0.12,0.14,0.14,0.16,0.14,0.14,0.12,0.12,0.10,0.10,0.08,0.08,0.06,0.08,0.08,0.10,0.10,0.12,0.12,0.12,0.10,0.10,0.10,0.08,0.08,0.08,0.08,0.08,0.10,0.12,0.14,0.12,0.12,0.10,0.08,0.06,0.04,0.06,0.06,0.08,0.10,0.14,0.16,0.14,0.12,0.10,0.08,0.08,0.06,0.06,0.06],"swell_wave_direction":[41,42,42,43,44,46,47,61,75,89,111,132,154,157,160,163,163,162,162,163,163,164,165,166,167,167,166,166,164,163,161,161,161,161,157,152,148,152,155,159,156,153,150,150,151,151,150,150,149,150,152,153,154,156,157,158,159,160,163,165,168,180,191,203,202,200,199,201,204,206,213,220,227,229,230,232,238,244,250,252,254,256,261,267,272,265,258,251,256,260,265,244,223,202,197,192,187,190,193,196,204,211,219,232,246,259,245,231,217,220,223,226,232,237,243,252,261,270,279,288,297,296,295,294,295,297,298,296,293,291,294,296,299,297,295,293,290,288,285,284,283,282,282,282,282,277,272,267,268,268,269,275,282,288,282,276,270,269,268,267,267,267,267,267,267,267,267,267],"swell_wave_period":[2.05,2.05,2.10,2.10,2.10,2.10,2.05,2.00,1.95,1.90,1.90,1.90,1.90,1.90,1.85,1.85,1.85,1.85,1.85,1.85,1.80,1.80,1.80,1.75,1.75,1.75,1.70,1.70,1.65,1.60,1.60,1.65,1.70,1.75,1.85,1.95,2.00,2.00,1.95,1.95,2.00,2.10,2.20,2.25,2.25,2.25,2.30,2.35,2.40,2.40,2.45,2.45,2.45,2.50,2.50,2.50,2.50,2.55,2.60,2.70,2.75,2.85,2.90,2.95,2.95,2.90,2.90,2.95,3.00,3.05,3.10,3.15,3.15,3.05,2.95,2.80,2.65,2.50,2.40,2.35,2.30,2.30,2.35,2.40,2.50,2.60,2.70,2.75,2.75,2.75,2.75,2.85,3.00,3.10,3.15,3.20,3.20,3.20,3.15,3.15,3.20,3.25,3.25,3.20,3.15,3.10,3.10,3.15,3.20,3.25,3.35,3.40,3.40,3.30,3.25,3.20,3.15,3.05,2.95,2.80,2.65,2.55,2.45,2.40,2.35,2.30,2.30,2.30,2.35,2.40,2.40,2.45,2.45,2.45,2.40,2.40,2.40,2.40,2.40,2.40,2.40,2.40,2.40,2.40,2.40,2.35,2.30,2.25,2.20,2.20,2.20,2.20,2.25,2.30,2.40,2.55,2.60,2.50,2.40,2.25,2.20,2.15,2.10,2.05,2.05,2.00,1.95,1.95],"swell_wave_peak_period":[2.65,2.65,2.65,2.65,2.70,2.70,2.65,2.40,2.10,1.85,1.85,1.95,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.00,2.05,2.00,1.85,1.60,1.50,1.55,1.70,1.85,2.05,2.30,2.45,2.35,2.15,2.00,2.05,2.10,2.20,2.20,2.20,2.20,2.25,2.35,2.45,2.55,2.60,2.65,2.60,2.50,2.45,2.50,2.55,2.65,2.75,2.85,2.95,3.05,3.15,3.25,3.25,3.25,3.25,3.25,3.25,3.25,3.35,3.50,3.55,3.40,3.15,2.95,2.80,2.75,2.65,2.55,2.50,2.45,2.50,2.55,2.65,2.75,2.85,2.95,2.95,2.95,2.95,3.05,3.15,3.25,3.35,3.45,3.55,3.55,3.55,3.55,3.55,3.55,3.55,3.55,3.50,3.55,3.65,3.80,3.90,3.95,3.95,3.90,3.80,3.70,3.55,3.45,3.35,3.25,3.05,2.85,2.65,2.55,2.50,2.45,2.45,2.45,2.45,2.50,2.60,2.65,2.65,2.65,2.65,2.60,2.50,2.45,2.45,2.45,2.45,2.45,2.45,2.45,2.45,2.45,2.45,2.40,2.25,2.20,2.15,2.15,2.20,2.25,2.35,2.45,2.55,2.65,2.65,2.55,2.35,2.20,2.15,2.20,2.20,2.20,2.20,2.20,2.20,2.20]}}
%}
The wave height is {{my_test_json.hourly['wave_height']}}.
{{my_test_json.hourly['time']}}
I create an entity card like this, I’m only show a couple of attributes.
type: entities
title: Marine Forecast
show_header_toggle: false
entities:
- entity: sensor.marine_forecast
name: time
type: attribute
attribute: time
- entity: sensor.marine_forecast
name: wave_height
type: attribute
attribute: wave_height
The problem i’m not able to plot any of this data. Not sure if I’m doing something wrong. Maybe is the type of data, I do believe I retrieve the data as string, but dunno how to transform into a float.
Thank you for your support.