1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/domoticz_ynh.git synced 2024-09-03 18:26:17 +02:00
domoticz_ynh/README.md

163 lines
8.2 KiB
Markdown
Raw Normal View History

2022-05-22 19:15:28 +02:00
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
2020-10-09 23:01:20 +02:00
# Domoticz for YunoHost
2020-10-05 23:05:58 +02:00
2022-05-26 09:30:46 +02:00
[![Integration level](https://dash.yunohost.org/integration/domoticz.svg)](https://dash.yunohost.org/appci/app/domoticz) ![Working status](https://ci-apps.yunohost.org/ci/badges/domoticz.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/domoticz.maintain.svg)
2022-05-22 19:15:28 +02:00
[![Install Domoticz with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=domoticz)
2020-10-05 23:05:58 +02:00
*[Lire ce readme en français.](./README_fr.md)*
2022-05-22 19:15:28 +02:00
> *This package allows you to install Domoticz quickly and simply on a YunoHost server.
2020-10-05 23:05:58 +02:00
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
2020-10-09 23:01:20 +02:00
2022-05-22 19:15:28 +02:00
Domoticz is a Home Automation system design to control various devices and receive input from various sensors.
For example this system can be used with:
2020-10-05 23:05:58 +02:00
2022-05-22 19:15:28 +02:00
* Light switches
* Door sensors
* Doorbells
* Security devices
* Weather sensors like: UV/Rain/Wind Meters
* Temperature Sensors
* Pulse Meters
* Voltage / AD Meters
* And more ...
2020-10-05 23:05:58 +02:00
2020-10-09 23:01:20 +02:00
2022-11-27 22:49:27 +01:00
**Shipped version:** Always the last stable one. The last compiled version is retrieved from [this directory](https://releases.domoticz.com/releases/?dir=./release) during install.
2022-05-26 09:30:46 +02:00
Once installed, **updates from the uptream app are managed from within the app**. Yunohost upgrade script will only upgrade the Yunohost package.
2020-10-09 23:01:20 +02:00
2022-05-22 19:15:28 +02:00
The MQTT broker mosquitto is integrated into the package. It requires its own domain or subdomain. It's an optional setting: during install if you set the same domaine as your main app domain, it won't be installed.
2020-10-09 23:01:20 +02:00
2022-05-22 19:15:28 +02:00
## Configuration
### Broker Mosquitto
2020-10-05 23:05:58 +02:00
2022-05-26 09:30:46 +02:00
During installation, a [MQTT](https://en.wikipedia.org/wiki/MQTT) broker, [Mosquitto](https://mosquitto.org/), is installed at the same time as Domoticz. The installed version is the one from the official project repo and not from Debian ones.
2022-05-22 19:15:28 +02:00
This broker requires a dedicated domain or subdomain to work (ex : mqtt.your.domain.tld) : creating this domain prior installation is a prerequisite
2022-06-05 16:43:20 +02:00
#### Adding in domoticz
2022-05-22 19:15:28 +02:00
To use mosquitto, you need to customize the communication between domoticz and the broker by following the [domoticz documentation](https://www.domoticz.com/wiki/MQTT#Installing_Mosquitto), part *Add hardware "MQTT Client Gateway"*.
User and password are automatically generated during installation, you may retrieve them with
````
sudo yunohost app setting domoticz mqtt_user
sudo yunohost app setting domoticz mqtt_pwd
````
2022-06-05 16:43:20 +02:00
#### Publish/Subscribe
By default, mosquitto will listen on 2 ports:
- 1883 on localhost using mqtt protocol
- 8883 using websocket protocol. Nginx redirect external port 443 to this internal port.
Hence, To publish/subscribe on a topic from the outside, you have to use a software supporting websocket protocol (ex : paho python library).
#### Mosquitto_pub et mosquitto_sub
These 2 tools do not support websocket protocol, only direct mqtt: base settings will not allow communication from an outside device.
If you're using them directly from your server, this kind of syntax should work:
2022-05-22 19:15:28 +02:00
````
2022-06-05 16:43:20 +02:00
mosquitto_pub -u *user* -P *password* -h mqtt.your.domain.tld -p 1883 -t 'domoticz/in' -m '{ "idx" : 1, "nvalue" : 0, "svalue" : "25.0" }'
2022-05-22 19:15:28 +02:00
````
2022-06-05 16:43:20 +02:00
In the same way:
2022-05-22 19:15:28 +02:00
````
2022-06-05 16:43:20 +02:00
mosquitto_sub -u *user* -P *password* -h mqtt.your.domain.tld -p 1883 -t 'domoticz/out'
2022-05-22 19:15:28 +02:00
````
2022-06-05 16:43:20 +02:00
If you wish to open direct mqtt protocol from an outside device, you'll need to:
- open port 1883 on Yunohost firewall (**Attention, security risk**)
- Allows IP addresses in mosquitto configuration for this listener
- Set the tls setting in mosquitto configuration by giving access to crt.pem and key.pem from your mqtt domain by setting respective certfile et keyfile variables. **This is mandatory to ensure a secure connection.**
2022-05-22 19:15:28 +02:00
#### Upgrade from version without mosquitto
If you have package ynh3 or below, mosquitto is not installed by default.
If you have chosen to not set a domain during initial installation also.
So, if you need to activate mosquitto in retrospect, do following actions:
2022-05-26 09:35:27 +02:00
1. Create a domain or a subdomain (for example : 'mqtt.your.domain.tld')
2. Connect to your server in command line
3. Type following command : `yunohost app setting domoticz mqtt_domain -v mqtt.your.domain.tld`
4. Upgrade domoticz to last package.
2022-05-22 19:15:28 +02:00
If you're already on the last package version, use the following command : `yunohost app upgrade domoticz --force`
2020-10-05 23:05:58 +02:00
## Configuration
2020-12-05 23:08:32 +01:00
### Sensors, language and this kind of stuff
Main configuration of the app take place inside the app itself.
2022-11-27 22:49:27 +01:00
### Zwave management
If you're using zwave devices, install mosquitto along domoticz and give a try to [zwave-JS-UI package](https://github.com/YunoHost-Apps/zwave-js-ui_ynh).
Once installed, just follow instructions from the [wiki](https://www.domoticz.com/wiki/Zwave-JS-UI)
2020-12-05 23:08:32 +01:00
### Access and API
By default, access for the [JSON API](https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's) is allowed on following path `/yourdomain.tld/api_/domoticzpath`.
2020-12-06 10:17:49 +01:00
So if you access domoticz via https://mydomainname.tld/domoticz, use the following webpath for the api : `/mydomainname.tld/api_/domoticz/json.htm?yourapicommand`
2020-12-05 23:08:32 +01:00
By default, only sensor updates and switch toogle are authorized. To authorized a new command, you have (for now) to manually update the nginx config file :
````
sudo nano /etc/nginx/conf.d/yourdomain.tld.d/domoticz.conf
2020-12-06 10:17:49 +01:00
````
2020-12-05 23:08:32 +01:00
Then edit the following block by adding the regex of the command you want to allow:
````
#set the list of authorized json command here in regex format
#you may retrieve the command from https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's
#By default, sensors updates and toggle switch are authorized
if ( $args ~* type=command&param=udevice&idx=[0-9]*&nvalue=[0-9]*&svalue=.*$|type=command&param=switchlight&idx=[0-9]*&switchcmd=Toggle$) {
set $api "1";
}
````
For example, to add the json command to retrieve the status of a device (/json.htm?type=devices&rid=IDX),modify the line as this:
````
#set the list of authorized json command here in regex format
#you may retrieve the command from https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's
#By default, sensors updates and toggle switch are authorized
if ( $args ~* type=command&param=udevice&idx=[0-9]*&nvalue=[0-9]*&svalue=.*$|type=command&param=switchlight&idx=[0-9]*&switchcmd=Toggle$|type=devices&rid=[0-9]* ) {
set $api "1";
}
````
2021-02-04 23:35:15 +01:00
All IPv4 addresses within the local network (192.168.0.0/24) and *all IPv6* addresses are authorized as API.
As far as I know, there is no way to filter for IPv6 address on local network : You may remove the authorization by removing or commenting this line in `/etc/nginx/conf.d/yourdomain.tld.d/domoticz.conf`:
2020-12-05 23:08:32 +01:00
````
allow ::/1;
````
This will authorized only IPv4 within local network to access your domoticz API.
2020-12-06 11:37:24 +01:00
You may add individual IPv6 address in the same way.
2020-10-05 23:05:58 +02:00
2022-11-27 22:49:27 +01:00
**Shipped version:** 2020.2~ynh5
## Disclaimers / important information
2020-10-05 23:05:58 +02:00
## Limitations
2020-11-08 17:04:56 +01:00
* No user management nor LDAP integration This function is [not planned to be implemented into the app](https://github.com/domoticz/domoticz/issues/838), hence it's not planned into the package neither.
* Backup cannot be restored on a different machine type (arm, x86...) as compiled sources are different
2020-10-05 23:05:58 +02:00
2022-05-22 19:15:28 +02:00
## Documentation and resources
2020-10-05 23:05:58 +02:00
2022-05-26 09:30:46 +02:00
* Official app website: <https://domoticz.com/>
* Official user documentation: <https://www.domoticz.com/DomoticzManual.pdf>
* Official admin documentation: <https://www.domoticz.com/wiki/Main_Page>
* Upstream app code repository: <https://github.com/domoticz/domoticz>
* YunoHost documentation for this app: <https://yunohost.org/app_domoticz>
* Report a bug: <https://github.com/YunoHost-Apps/domoticz_ynh/issues>
2020-10-05 23:05:58 +02:00
2022-05-22 19:15:28 +02:00
## Developer info
2020-10-05 23:05:58 +02:00
2022-05-22 19:15:28 +02:00
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/domoticz_ynh/tree/testing).
2020-10-05 23:05:58 +02:00
To try the testing branch, please proceed like that.
2022-05-26 09:30:46 +02:00
``` bash
2022-05-22 19:15:28 +02:00
sudo yunohost app install https://github.com/YunoHost-Apps/domoticz_ynh/tree/testing --debug
2020-10-05 23:05:58 +02:00
or
2022-05-22 19:15:28 +02:00
sudo yunohost app upgrade domoticz -u https://github.com/YunoHost-Apps/domoticz_ynh/tree/testing --debug
2020-10-05 23:05:58 +02:00
```
2022-05-22 19:15:28 +02:00
2022-05-26 09:30:46 +02:00
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>