Help with Multiscrape

#multiscrape

Can someone please help me figuring this out; it appears to have broken after update to latest Multiscrape (6.7.2) and HA 2023.8.3

Multiscrape.yaml

- resource: http://metservice.intnet.mu/forecast-bulletin-english-mauritius.php
  scan_interval: 1800
  log_response: true
  sensor:
    - unique_id: mu_met_service_high_tides
      name: MMS High Tide
      select: "#content > div.left_content"
      value_template: '{{ (value | regex_findall_index("High.*[T|t]ides.*:.*h[0-9][0-9]")).split(":")[1] }}'
    - unique_id: mu_met_service_low_tides
      name: MMS Low Tide
      select: "#content > div.left_content"
      value_template: '{{ (value | regex_findall_index("Low.*[T|t]ides.*:.*h[0-9][0-9]")).split(":")[1] }}'
    - unique_id: mu_mms_date
      name: MMS Bulletin Date
      select: "#content > div.left_content"
      value_template: >-
        {{ strptime(
              (value | regex_findall_index("[0-9]{1,2} *[A-Z]{3,9} *[0-9]{4}"))
                .replace("  "," ")
            , "%d %B %Y")
            .date()  
        }}

The first two sensors are scraping correctly but the third mu_mms_date returns Unavailable although if I run the same value template with the HA template page, the date is correctly calculated!

It appears that there is a non-breaking-space in the HTML code (   ) after the date, for instance like this:
WEATHER NEWS FOR MAURITIUS ISSUED AT 1630 HOURS ON TUESDAY 22  AUGUST 2023
Try this for the third sensor:

        {{ strptime(
              (value.replace(" "," ") | regex_findall_index("[0-9]{1,2} *[A-Z]{3,9} *[0-9]{4}"))
                .replace("  "," ")
            , "%d %B %Y")
            .date()  
        }}
1 Like