/openhab4-ui2files

Command line tools to help migrating configuration from UI to files for OpenHAB v. 4 (semantic model compatible)

Primary LanguagePHPMIT LicenseMIT

OPENHAB 4: UI2FILES

Command line tools to help migrating configuration from UI to files for OpenHAB v. 4 (semantic model compatible)

These tools are written in PHP 8 and can be run as a docker container in Windows, using the provided runme_XXXX.bat. Otherwise you could run by yourself using a local PHP 8 installation

At this moment there are two distinct scripts

convert.php

It generates things and items files, partial services.cfg file for addons and json rules(scenes source files to be imported using API (or the import_rules.php script), reading bridges, things, channels, links, location, equipments, groups, points, items, rules/scenes and addons from OpenHAB 4 configuration using API Rest.

  • .things files (bridges, things and channels) will be generated in output_folder/things
  • .items files (locations, equipments, groups, points, items and links) will be generated in output_folder/items
  • addons.cfg.append (content must be added to the original addons.cfg file) will be generated in output_folder/services
  • _rules.json files (JSON payload to be used with REST API) will be generate in output_folder/rules

In the output_folder there is 1 file

  • XX_addonsconfig.txt: config variables for installed addons as simple reference

Usage

  • Copy params.php.template in params.php and populate config variables according to your setup
  • Run runme_convert.bat
  • Files will be generated in output folder

import_rules.php

It create rules and scenes on the destination platform, reading the json payload files generated by the convert.php software (see previous chapter)

Usage

  • Copy params_dest.php.template in params_dest.php and populate config variables according to your setup
  • Run runme_import_rules.bat
  • You can follow the progress in the terminal output

DISCLAIMER

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.