-
Notifications
You must be signed in to change notification settings - Fork 31
360 Degree Vehicle Images
This guide will help you set up dynamic 3D vehicle images in your Ultra Vehicle Card for Home Assistant, refreshing the images every 5 seconds.
First, you'll need to create a template sensor in your configuration.yaml
that generates the image URLs based on the current time.
-
Open your
configuration.yaml
file. - Add the following code to create the template sensor:
template:
- sensor:
- name: "Current Time"
state: "{{ now().strftime('%H:%M:%S') }}"
- name: "Current Date"
state: "{{ now().strftime('%Y-%m-%d') }}"
- name: "Dynamic 3D Image"
state: "{{ now() }}"
attributes:
entity_picture: >
{% set image_number = '%03d' % ((now().second * 36 / 60) | round(0, 'floor')) %}
{{ '/local/3d_images/yourimageprefix' + image_number + '.png' }}
yourimageprefix should be the prefix before the number like NLG_G1U_360e_
This sensor generates the URL for the 3D images based on the current seconds and milliseconds.
Next, set up an automation that will force the sensor to update every 5 seconds.
-
Add the following code to your
automations.yaml
file to create the automation:
automation:
- alias: Update Dynamic Image Every 5 Seconds
trigger:
- platform: time_pattern
seconds: "/5"
action:
- service: homeassistant.update_entity
target:
entity_id: sensor.dynamic_3d_image
This automation will trigger an update of the dynamic_3d_image sensor every 5 seconds.
You can also add the automation in YAML form using the Home Assistant GUI and choosing the 3 dots and clicking "Edit in Yaml" and pasting the code above.
Select "Entity" for your vehicle image and select the entity you just made, in this case sensor.dynamic_3d_image
By following these steps, you will have a dynamic 3D vehicle image that updates every 0.5 seconds in your Ultra Vehicle Card. If you have any issues or questions, feel free to reach out for assistance!