pippyn / Home-Assistant-Sensor-Afvalbeheer

Provides Home Assistant sensors for multiple Dutch and Belgium waste collectors
Apache License 2.0
287 stars 87 forks source link

iOS app/mobile Safari displays "invalid timestamp" #293

Open dieugab opened 2 years ago

dieugab commented 2 years ago

I have 3 sensors setup with this integration. However, on the iOS apps and mobile safari they display as “invalid timestamp”, while they display correctly on desktop browsers.

Proper display on desktop: image

Incorrect display on mobile: image

I first reported this as a Home Assistant frontend issue here: https://github.com/home-assistant/frontend/issues/11351 but apparently it’s an ISO 8601 timestamp issue and up to the integration author to fix, according to this comment:

Apple strongly enforces ISO 8601 compliant timestamps, meaning the "T" between the data and time need to be there.

See the warning here: https://www.home-assistant.io/docs/configuration/templating/

Where are those entities from? Are they template entities that you created? If yes, you can adjust the timestamp yourself (see link above), otherwise the integration author should take care of that.

dieugab commented 2 years ago

Additional info, straight from Home Assistant docs: https://www.home-assistant.io/docs/configuration/templating/ 19ED9F7B-E91F-4B07-9E36-C7B7A9DF2455

This integration currently seems to omit the “T”. Can that be added, to be compliant with HA standards? 01BA33D9-B06B-4F27-A3F8-9DCEDB4A2194

pippyn commented 2 years ago

What is your sensor config? Do you use the option to make the sensor state a date object?

dieugab commented 2 years ago

@pippyn I believe I have it setup as a date object. Should it be something else? Below is the config:

  - platform: afvalbeheer
    upcomingsensor: 1
    wastecollector: HVC
    resources:
      - gft
      - papier
      - pmd
    postcode: XXXXAA
    streetnumber: XX
    dateobject: 1
pippyn commented 2 years ago

Do you need the date object? If not remove that option and all should be fine

dieugab commented 2 years ago

I'd rather it be a dateobject as that way I can show relative time like in the screenshots in my first post ("next week, next month"). Otherwise it's just a string of numbers.

dieugab commented 2 years ago

I'd be fine to use a custom dateformat. I've tried '%F' and '%Y-%m-%dT%H:%M:%S%z' but both seem to still omit the "T"

pippyn commented 2 years ago

I am working on make the timestamps ISO compliant, but it is not ready yet.

The problem is not all API's report the timezone, so I'll have to convert them and do a lot of tests.

For now you'll have to sit tight i'm afraid.

dieugab commented 2 years ago

No problem! I’m glad this integration exists at all, happy to wait. I’ll see if I can figure out making a template sensor for each that’s ISO compliant.