Allow entity with (templated) resource in World Clock

as Worldclock - Home Assistant mentions:

The resource or endpoint that contains the value.

a resource with that value should be a valid config. However, trying that with the mobile_app entity geocoded_location renders an error in the log:

invalid config for [sensor.worldclock]: Invalid time zone passed in. Valid options can be found here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones for dictionary value @ data['time_zone']. Got "{{state_attr('sensor.marijn_geocoded_location','Time Zone')}}\n". (See ?, line ?).

indicating only a valid Time Zone can be used.

please consider
allowing

  - platform: worldclock
    name: Marijn
    time_zone: sensor.mobile_app_geocoded_location

which would require the integration to find the correct attribute on the core integrations entity

or maybe better even:

  - platform: worldclock
    name: Marijn
    time_zone: >
      {{state_attr('sensor.marijn_geocoded_location','Time Zone')}}

which would allow any template to return a correct Time Zone

or a dedicated entity

  - platform: worldclock
    name: Marijn
    time_zone: sensor.marijn_geocoded_location_time_zone

this would allow us to have dynamic world clocks, that follow our traveling family members on their trips
and easily spot the time difference allowing better communications planning!

thanks for considering

I’ve put together a very basic version of this which works for my personal use. Maybe others will be able to make use of it too.

1 Like

that is nice, ill test it tomorrow, thanks!

did you consider PR’ing the core HA integration? Maybe we can have it in core that way, would be even better.

(unless the dev team doesn’t allow pr;s on this yaml configured integration…)

edit

nvm, I added it and quick and simple: it works right out of the box :wink:

would be cool if you added the actual time zone as an attribute, and, maybe the timezone, so we can use this sensor entity in other templates etc etc without having to rework the output manually