[SOLVED]Domoticz at 18.06.2

Hi all!
Is here anybody who are using Domoticz at OpenWRT router? I'm trying to add RTL2832 dongle through Benjamin Larsson's RTL_433. All seems to be working, I can see received data from wireless sensors while rtl_433 was executed from shell. But then I'm trying to add same Hardware (native Rtl433 RTL-SDR receiver profile) there is only RTL433 AC Lighting 2 (AC switch?) can be configured in Devices. As I understand Domoticz should recognize this dongle as 433Mhz receiver (like other such RF433-like devices) and add information, decoded by dongle as Devices. But it's look like something wrong with Hardware profile.
Another question - as I understand OpenWRT Domoticz package can be used only with default parts and links, I can't be executed if all was moved to external partition (sure, config was changed to new location). Also I can't change default http port from 8080 to another one through config file at /etc/config/domoticz. It's look like parts and links was hardcoded.
Can you explain you experience with this package?

Hi I'm using Domoticz. Even compile for myself latest version.


Alll configuration you have in:
/etc/init.d/domoticz
Regarding RTL433 - I'm not using it - Maybe you need some additional kernel modules ?

1 Like

Hi, perfect!
I'm not alone :smile:
I'll try compile as you. Thank you for such help.
So, about configuration files. As described in guides there is only one config file /etc/init.d/domoticz, but as I can see it isn't config as it really should be - it's startup script with some external variables and some hardcoded paths. Also, as I can see there is config in /etc/config/domoticz, which used because some variables from this config are used after successful startup. How you was fix it?
And, about RTL_433 - could you please check you installation by adding "dummy" record for this hardware. Which device you will see in Devices?

I think that first you should try install rtl_sdr and/or rtl_433

opkg update
opkg list |grep rtl
opkg install rtl-sdr
opkg install rtl_433

Sure, it was installed, I can see information from sensors while rtl_433 was exexuded in command line.

root@Router7:~# rtl_433 -R12 -F json
Registering protocol [1] "Oregon Scientific Weather Sensor"
Registered 1 out of 98 device decoding protocols
Found 1 device(s)

trying device  0:  Realtek, RTL2838UHIDIR, SN: 00000001
Found Rafael Micro R820T tuner
Using device 0: Generic RTL2832U OEM
Exact sample rate is: 250000.000414 Hz
[R82XX] PLL not locked!
Sample rate set to 250000.
Bit detection level set to 0 (Auto).
Tuner gain set to Auto.
Reading samples in async mode...
Tuned to 433920000 Hz.
{"time" : "2019-03-25 13:32:42", "brand" : "OS", "model" : "THGR122N", "id" : 203, "channel" : 1, "battery" : "OK", "temperature_C" : 17.000, "humidity" : 44}
{"time" : "2019-03-25 13:33:04", "brand" : "OS", "model" : "THGR122N", "id" : 225, "channel" : 2, "battery" : "OK", "temperature_C" : 24.800, "humidity" : 32}

One sensor was placed outside or window, anonter one - inside of house.

I have create release for you:


Download and install both files. First execute "opkg update"
than:

opkg install libcurl_7.60.0-3_mips_24kc.ipk
opkg install domoticz_4.10549-1_mips_24kc.ipk
1 Like

Perfect, I'll check you version ASAP.
What about right configuration, which parameters should be changed for change www port to 8084, placing userdata, approot and any other big files at external partition /data/domoticz/ ?
I should change only /etc/init.d/domoticz? But there is no any parameters like "www"...
Also, as I see old version of this package are using some parametes from /etc/config/domotics - as minimum sslwww port.

Yes, you should change /etc/init.d/domoticz
When you run "ps" you can see the current parameters for domoticz:

/usr/bin/domoticz -noupdates -approot /usr/share/domoticz/ -debuglevel -syslog daemon -userdata /var/lib/domoticz/ -sslwww 0

First stop domoticz:

/etc/init.d/domoticz stop

and then construct/start domoticz with your parameters e.g:

/usr/bin/domoticz -noupdates -approot /usr/share/domoticz/ -debuglevel -syslog daemon -userdata /root/ -sslwww 0 -www 8084

2019-03-25 13:01:59.486  Status: Domoticz V4.10531 (c)2012-2019 GizMoCuz
2019-03-25 13:01:59.487  Status: Build Hash: bf19d8bb, Date: 2019-02-27 09:04:05
2019-03-25 13:01:59.489  Status: Startup Path: /usr/share/domoticz/
domoticz: Domoticz is starting up....
domoticz: Domoticz running...
domoticz: BuildManifest: Created directory /root/plugins/
2019-03-25 13:02:00.874  BuildManifest: Created directory /root/plugins/
domoticz: PluginSystem: Started, Python version '3.7.2'.
2019-03-25 13:02:01.305  Status: PluginSystem: Started, Python version '3.7.2'.
domoticz: Active notification Subsystems: gcm, http (2/13)
2019-03-25 13:02:01.348  Active notification Subsystems: gcm, http (2/13)
domoticz: WebServer(HTTP) started on address: :: with port 8084
2019-03-25 13:02:01.355  Status: WebServer(HTTP) started on address: :: with port 8084
domoticz: Proxymanager started.
2019-03-25 13:02:01.365  Status: Proxymanager started.
domoticz: Starting shared server on: :::6144
2019-03-25 13:02:01.383  Starting shared server on: :::6144

Perfect!! With default configuration now I can see my sensors:


As you can see domoticz was execute rtl_433 itself (because hidden parameter "-F csv" added):

root@Router7:/# ps | grep domoticz
14370 root     13724 S    /usr/bin/domoticz -noupdates -approot /usr/share/domoticz/ -debuglevel -syslog daemon -userdata /var/lib/domoticz/ -sslwww 0
root@Router7:/# ps | grep rtl
14412 root     21760 S    rtl_433 -F csv -R12

Now I'm working with moving domoticz's files to the external partition.
Will write final information ASAP.

the issue could be with rights. default user is "domoticz". Change it to "root"

Sorry for delay.
Intermediate results - it was successully installed and executed. I can see my sensors. Now I'm investigating some issues with rtl_433 package - there is old version in repository (poor list of supported sensors) and I can't connect my cheap 433 Mhz EV1527 security sensors (door sensor, motion sensors and 4 button remotes). Main problem is that last version 18.12 of rtl_433 from Benjamin Larsson's repository can not be compiled as some links in build system are linked to 18.05 version in OpenWRT repository. I'm serching how I can compile latest version as single package, but I have no many free time for it.

I have added
https://github.com/kofec/Domoticz-Openwrt/releases/download/Domoticz10549/rtl_433_18.12-1_mips_24kc.ipk
for you

1 Like

Wow, thank you so much! It will help me.

Almost done.
For anyone like me - who use domoticz with customised settings. There is custom config file from /etc/config/domoticz and startup script from /etc/init.d/domoticz.
Settings modified for:

  1. Used external partition /data/domoticz for both userdata and appdata&share
  2. Syslog was disabled.
  3. Logging path was changed to /data/logs/domoticz.log.
  4. Log level changed to "debug".
  5. WWW port was changed to 8084
  6. SSL initially disabled (not needed for me).
  7. Runing as root.
    etc.

/etc/config/domoticz:

config domoticz
	option disabled '0'
	option loglevel 'debug'
	option log '/data/logs/domoticz.log'
	# option syslog 'daemon'
	option www '8084'
	# option sslcert '/path/to/ssl.crt'
	# option sslkey '/path/to/ssl.key'
	# option sslpass 'passphrase'
	# option ssldhparam '/path/to/dhparam.pem'
	option sslwww '0'
	# CAUTION - by default, /var is not persistent accross reboots
	# Don't forget the trailing / - domoticz requires it
	option userdata '/data/domoticz/'

#config device
#	option product '658/200/0'
#	option symlink 'ttyACM-aeotec-zstick-g5'

#config device
#	option serial '526359'
#	option symlink 'ttyUSB-serial'

#config device
#	option usbif '2-1:1.0'
#	option symlink 'ttyUSB-port1'

#config device
#	option product '67b/2303/202'
#	option usbif '2-2:1.0'
#	option symlink 'ttyUSB-port2'

/etc/init.d/domoticz:

#!/bin/sh /etc/rc.common

START=99
USE_PROCD=1
PROG=/usr/bin/domoticz
PIDFILE=/var/run/domoticz.pid

start_domoticz() {
	local section="$1"
	local loglevel www log sslcert sslpass sslwww syslog userdata

	config_get loglevel "$section" "loglevel"
	config_get sslcert "$section" "sslcert"
	config_get sslkey "$section" "sslkey"
	config_get sslpass "$section" "sslpass"
	config_get ssldhparam "$section" "ssldhparam"
	config_get sslwww "$section" "sslwww"
	config_get www "$section" "www"
	config_get log "$section" "log"
	config_get syslog "$section" "syslog"
	config_get userdata "$section" "userdata"

	[ -n "$loglevel" ] && procd_append_param command -debuglevel "$loglevel"
	[ -n "$syslog" ] && procd_append_param command -syslog "$syslog"
	[ -n "log" ] && procd_append_param command -log "$log"

	[ -d "${userdata}" ] || {
		mkdir -p "${userdata}"
		findLatestDatabase "$userdata"
		chmod 0770 "$userdata"
		chown root:root "$userdata"

	}

	# By default, ${userdata}/scripts is a symlink to /etc/domoticz/scripts
	# and the two dzVents directories under there which Domoticz will actually
	# write to at runtime are symlinked back to /var/lib again.
	[ -d "${userdata}/plugins" ] || ln -sf /etc/domoticz/plugins "${userdata}/plugins"
	[ -d "${userdata}/scripts" ] || ln -sf /etc/domoticz/scripts "${userdata}/scripts"
	for DIR in data generated_scripts; do
		[ -d /data/domoticz/dzVents/$DIR ] || {
			mkdir -p /data/domoticz/dzVents/$DIR
			chown root.root /data/domoticz/dzVents/$DIR
		}
	done
	procd_append_param command -userdata "$userdata"
	procd_append_param command -www "$www"

	[ -n "$sslcert" -a "${sslwww:-0}" -gt 0 ] && {
		procd_append_param command -sslcert "$sslcert"
						[ -n "$sslkey" ] && procd_append_param command -sslkey "$sslkey"
		[ -n "$sslpass" ] && procd_append_param command -sslpass "$sslpass"
		[ -n "$ssldhparam" ] && procd_append_param command -ssldhparam "$ssldhparam"
	} || procd_append_param command -sslwww "$sslwww"
}

start_service() {
	procd_open_instance

	procd_set_param command "$PROG"
	procd_append_param command -noupdates
	procd_append_param command -approot /data/domoticz/share/
#	procd_append_param command -wwwbind 192.168.1.1

	config_load "domoticz"
	config_get_bool disabled "$section" "disabled" 0
	[ "$disabled" -gt 0 ] && return 1
	config_foreach start_domoticz domoticz

	procd_set_param pidfile "$PIDFILE"
	procd_set_param respawn
	procd_set_param stdout 0
	procd_set_param term_timeout 10
	procd_set_param user "root"

	procd_close_instance
}

findLatestDatabase() {
	destinationFolder=$1
	yourfilenames=`ls /root/domoticz*[0-9].db`
	LatestDate=0
	for eachfile in $yourfilenames
	do
   	   echo $eachfile
   	   if [[ "${eachfile//[!0-9]/}" > "$LatestDate" ]]; then
      		LatestDate=${eachfile//[!0-9]/}
   	   fi
	done
	if [ "$LatestDate" -gt "0" ]; then
	    cp "/root/domoticz${LatestDate}.db" "${destinationFolder}domoticz.db"
	fi
}

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.