Posted by
ads' corner
on
Wednesday, 2018-12-12 Posted in [Ansible][Linux][Openhab]
A while ago I posted about adding a Fritz!Box to openHAB, using Ansible. Now I had to use the Playbook to install another Raspberry, and found that some parts are missing in my posting. Mostly at the end, when it comes to configuring the Fritz!Box.
Therefore let’s run over all the steps again, and make sure that everything is covered.
- name:Get list of available and installed extensionsuri:url:"http://{{ ansible_host }}:8080/rest/extensions"register:oh2_extensionschanged_when:false- name:Install extensionsuri:url:"http://{{ ansible_host }}:8080/rest/extensions/{{ item }}/install"method:POSTwhen:"not (oh2_extensions.json|byattr('id', item))[0].installed"with_items:- binding-fritzboxtr0641register:oh2_install_extensions
The extension comes with a configuration file, which holds access credentials to access the Fritz!Box. It is strongly recommended to create a separate account on the Fritz!Box, and not use the admin account here.
The Fritz!Box can not yet be used, the openHAB configuration is missing. That is a bit ugly, because a JSON object must be send to the server, and plenty of escaping is required. Also the credentials are read from two files (can also come from a Vault) in order not to store them directly in the Playbook.
The first “Initialize” step is only run the first time. It will configure the Fritz!Box extension. The second “Update” step is run every time the credentials change.
After a few seconds all the Fritz!Box adapters will show up in openHAB.