-
Notifications
You must be signed in to change notification settings - Fork 25
Homeassistant (retired)
- Overview
- Preconditions
- Home Assistant's Device Discovery
- Helpers
- Cards
- Automation.yaml
- Configuration.yaml
- Download
This page is retired and descibes home assistant integration for older picframe (<= 2021.07.05) versions.
The image below shows the full integration of PictureFrame into Home Assistant. A user friendly 'step-by-step' instruction is published on Wolfgang's blog www.thedigitalpictureframe.com.
Here we will only provide the required files for download and provide a rough 'How-To' for experienced Home Assistant users.
- Home Assistant has to be up and running
- Home Assistant device discovery has to be enabled (which by default is)
- Home Assistant's mqtt interface has to be enabled and connected to your mqtt broker
- PictureFrame's mqtt interface has to be enabled and is connected to your mqtt broker
- If you enabled SSL to connect to your Home Assistant instance, you have to enable SSL also in PictureFrame's web server (if SSL is enabled, Home Assistant will always use SSL no matter if you call http or https to retrieve the images)
- Home Assistant identifys PictureFrame through its configured 'device_id'. Default is 'picframe'. This id has to be unique. So for a second PictureFrame you have to change it. And accordingly all references to it in the following example scripts.
If the preconditions are met. PictureFrame will send on network connect auto discovery messages to Home Assistant.
So after a while you schould find PictureFrame in Home Assistants 'settings -> Integration -> MQTT -> devices'. Listed with its configured device_id which is by default 'picframe'.
In the device overview you should see all discoverd switches ans sensors.
If anything goes wrong, or you delete an entity from PictureFrame by mistake. Don't worry. You can delete the whole device and after a new connection of PictureFrame it will appear again.
Switches and sensors could be used directly in Home Assistant cards. For input elements like text fields or the brightness slider you have to create the elements first.
Unfortunatele Home Assistant doesn't provide a YAML import for helpers. You have to crete them over the GUI manually.
input_text support regular expressions. They are used to enter a valid date format, which can be processd.
Country | Format | Regex |
---|---|---|
Germany | dd.mm.yyyy | ^(0[1-9]|[12][0-9]|3[01])\.(0[1-9]|1[012])\.\d{4}$ |
US | mm/dd/yyyy | ^(0[1-9]|1[012])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$ |
US | yyyy-mm-dd | ^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])$ |
en | dd/mm/yyyy | ^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[012])\/\d{4}$ |
If you define other date formats please share them with us, so we can extend the list. To test the regex I find this site very helpful regex101.com
For date input you can also use the date picker helper. But this limits you to the standard unix time. So you can't pick a day before 1970.
If you create a new card in Home Assistant you can switch from visual editing to yaml editor. Download the corresponding yaml-files and paste them in to the editor.
Open hass_card_image.yaml
.
Search for
...
![Image](http://myhost:9000/{{
states('sensor.picframe_image') | urlencode }})
...
and replace myhost:9000
with the correct 'hostname' and 'port number'. If you enabled SSL in PictureFrame's webserver change http
to https
.
Open hass_card_filter.yaml
.
Adjust date format, if needed. It has to correspondend to the regular expression in you date_from / date_to helper.
...
- entity: input_text.picframe_date_from
name: Bilder ab (TT.MM.JJJJ)
- entity: input_text.picframe_date_to
name: Bilder bis (TT.MM.JJJJ)
...
Use 'hass_card_overlay.yaml'.
Use hass_card_settings.yaml
.
Open hass_automation.yaml
.
Search for
...
"%d.%m.%Y"
...
and change it to the date format you are expecting in date_from / date_to helpers. The time format could be found here: docs.python.org datetime
Append the file to your automation.yaml
Open hass_configuration.yaml
.
To show the image date in the correct local date format you have to format it to your needs.
sensor:
- platform: template
sensors:
picframe_image_date:
value_template: "{{ state_attr('sensor.picframe_image', 'EXIF DateTimeOriginal') | int | timestamp_custom('%d. %b. %Y %H:%M') }}"
friendly_name: "Datum"
The time format could be found here: docs.python.org datetime
Copy the sniplet to the appropriate section in your configuration.yaml
Download the required yaml files homeassistant.zip
- fix #127 Directory listing in HA drop-down menu is not alphabetized
- Adding clock switch in overlay card
- automations check now, if sensors ar available
- fix brightness controll for correct settings