Page 2 of 3

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Friday 09 April 2021 19:00
by waaren
Gravityz wrote: Friday 09 April 2021 18:37 lot's of other errors which look like an old problem. i am using the latest docker build 13149
The JSON.lua file does reside in <domoticz dir>/scripts/lua/
Same for similar xml2lua.lua, XmlParser.lua and subdirectory xmlhandler

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Friday 09 April 2021 19:23
by Gravityz
yes i know but apparently the container can not find it

when i login the container it is in
/opt/domoticz/scripts/lua

the path /opt/domoticz/userdata also contains a script directory but that one is missing the lua directory.

the errors i am getting is it tries to search in the userdata directory instead of the default directory

maybe there is a problem with the docker build because i am testing with a clean image with a brand new database

edit: i think the mapping outside the container is screwing up the default path inside the container.
if i place a copy of the JSON.lua outside the container in /docker/domoticz/scripts/dzvents the problem is gone.

it still is strange that mapping is causing this
i believe the opt/domoticz/scripts and the opt/domoticz/userdata/scripts inside the container image should be the same to avoid these problems

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Wednesday 21 April 2021 12:28
by smaus
where can i find my domoticz dir in docker, i cant find it.

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Wednesday 21 April 2021 12:42
by Gravityz
/opt/domoticz

you get there by selecting the container from synology
press details
press terminal
presh create (a bash entry appears)
click the bash entry and you are inside the container and can modify stuff, copy things and install packages with apt-get

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Saturday 24 April 2021 15:52
by smaus
when i look with winCSP i dont have /opt/domoticz/ i have only containerd

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Saturday 24 April 2021 16:51
by EddyG
smaus wrote: Saturday 24 April 2021 15:52 when i look with winCSP i dont have /opt/domoticz/ i have only containerd
Carefully read the above and do those steps, don't use WinSCP but DSM

Code: Select all

you get there by .....

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Saturday 24 April 2021 16:52
by Gravityz
read the instructions again. you can not get to the container from winscp(at least not easy)

you need to login the container through the terminal function in docker

so from the synology
goto docker
container
select the container domoticz

select details
select terminal
press create(bash will appear)
click on bash and you are logged into the container

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Sunday 25 April 2021 16:19
by smaus
Reading the instructions attentively, and it works. :oops: :oops:

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Sunday 25 April 2021 16:44
by Gravityz
nice.
now you can change things inside the container and they will be kept.

i use curl in my scripts but because docker continers can not start things outside the container it needs to be inside the container.

apt-get -qq update
apt-get -qq -y install curl

also my normal synology scripts use ash but docker uses bash so you need to xhange that in your old linux scripts




smaus wrote: Sunday 25 April 2021 16:19 Reading the instructions attentively, and it works. :oops: :oops:

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Tuesday 27 April 2021 17:48
by knireis
I changed my docker from the demydiuk/domoticz repo to the new official domoticz/domoticz one.

I had to import the database but further all ok exept i also have the issue that a simple DzVents script i created (to switch on a device after start of domoticz) is not running. I read this topic and the topic about the docker version but i have no clue what to do about this.

Is there a solution? If yes, can someone explain in simple steps how to achieve this?

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Tuesday 27 April 2021 19:00
by waaren
knireis wrote: Tuesday 27 April 2021 17:48 A simple DzVents script i created (to switch on a device after start of domoticz) is not running. I read this topic and the topic about the docker version but i have no clue what to do about this.
Did you create the dzVents script using the internal event editor? If not copy paste your script into the event editor, save it and try again.

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Wednesday 28 April 2021 18:54
by knireis
yes it is made with the internal editor

before the change to the new docker image i see this in the log of the switch: EventSystem//opt/domoticz/dzVents/runtime/dzVents.lua
now there is nothing exept for when i turn it on manual.

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Wednesday 28 April 2021 20:03
by waaren
knireis wrote: Wednesday 28 April 2021 18:54 yes it is made with the internal editor
Can you share the loglines from domoticz start and from around the time you would expect the script to be executed?
Do you have other dzVents scripts that do work?

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Thursday 29 April 2021 10:43
by knireis
sorry, where can i find the log? there is nothing in the /config or /userdata

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Thursday 29 April 2021 10:47
by waaren
knireis wrote: Thursday 29 April 2021 10:43 sorry, where can i find the log? there is nothing in the /config or /userdata
If you have not configured it, you can only see it in the GUI. [Setup][Log]

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Thursday 29 April 2021 10:50
by knireis
2021-04-28 19:14:56.883 Status: Domoticz V2021.1 (build 13240) (c)2012-2021 GizMoCuz
2021-04-28 19:14:56.883 Status: Build Hash: d626bc52f, Date: 2021-04-28 07:52:07
2021-04-28 19:14:56.883 Status: Startup Path: /opt/domoticz/
2021-04-28 19:14:56.916 Status: PluginSystem: Started, Python version '3.7.3'.
2021-04-28 19:14:56.916 Status: : Using poll interval of 2 secs.
2021-04-28 19:14:56.919 Status: WebServer(HTTP) started on address: 0.0.0.0 with port 8080
2021-04-28 19:14:56.923 Status: WebServer(SSL) started on address: 0.0.0.0 with port 443
2021-04-28 19:14:56.925 Status: Proxymanager started.
2021-04-28 19:14:56.926 Status: TCPServer: shared server started...
2021-04-28 19:14:56.926 Status: RxQueue: queue worker started...
2021-04-28 19:14:58.926 Status: (Evohome) Worker started...
2021-04-28 19:14:58.926 Status: rfxcom: Worker started...
2021-04-28 19:14:58.926 Status: Hue: Worker started...
2021-04-28 19:14:58.927 Status: NotificationSystem: thread started...
2021-04-28 19:14:58.927 Status: EventSystem: reset all events...
2021-04-28 19:14:58.932 Status: dzVents: Write file: /opt/domoticz/userdata/scripts/dzVents/generated_scripts/linphone-init.lua
2021-04-28 19:14:58.932 Status: EventSystem: reset all device statuses...
2021-04-28 19:14:58.975 Status: Python EventSystem: Initalizing event module.
2021-04-28 19:14:58.975 Status: EventSystem: Started
2021-04-28 19:14:58.975 Status: EventSystem: Queue thread started...
2021-04-28 19:14:59.927 Status: rfxcom: Using serial port: /dev/ttyUSB0
2021-04-28 19:15:08.927 Status: (Evohome) connect to Evohome server
2021-04-28 19:15:27.058 Status: PROXY: Authenticate result: success.
2021-04-28 19:16:18.958 Status: (Evohome) connect to Evohome server

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Thursday 29 April 2021 10:59
by waaren
knireis wrote: Thursday 29 April 2021 10:50 2021-04-28 19:14:58.932 Status: dzVents: Write file: /opt/domoticz/userdata/scripts/dzVents/generated_scripts/linphone-init.lua
So I assume linphone-init.lua is the script you refer to. Can you share it?

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Thursday 29 April 2021 11:10
by knireis

Code: Select all

return
{
    on =
    {
        system =
        {
            'start',
        },
    },

    logging =
    {   
        level = domoticz.LOG_DEBUG,
        marker = 'start',
    },

    execute = function(dz)
        dz.devices('Linphone-S').switchOn().afterSec(10)
    end
}

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Thursday 29 April 2021 11:34
by waaren
This should work, or at least show some loglines.

Is dzVents still enabled in [Setup][Setttings][Other]?
dzVents .png
dzVents .png (16.41 KiB) Viewed 1984 times

Re: Using Docker and userscripts (Lua, DzVents, Python)

Posted: Thursday 29 April 2021 11:45
by knireis
2021-04-29 11:42:14.346 Error: EventSystem: problem writing file: /opt/domoticz/userdata/scripts/dzVents/generated_scripts/linphone-init.lua

Seems to be an access issue?