Oficial Docker Container Topic is solved

Subforum for general discussions. Do not dump your questions/problems here, but try to find the subforum where it belongs!

Moderators: leecollings, remb0

JanvdW
Posts: 118
Joined: Saturday 21 December 2019 8:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Oficial Docker Container

Post by JanvdW »

I did a fresh install of a RPI4 (64 bit OS Lite), installed the latest Docker container for Domoticz beta and tried to get Evohome via scripting (web) working, but I do not succeed.

I installed the evohome client and copied my custom config file (evoconfig.py) and py scripts to this folder with the custom startup script for the Docker Domoticz container with the following commands:

Code: Select all

sudo apt-get -y install git python3-simplejson python3-setuptools python3-pip python3-dateutil
sudo pip install requests
git clone https://github.com/watchforstock/evohome-client.git
cd /opt/domoticz/config
sudo pip install ./evohome-client
cp /opt/domoticz/userdata/scripts/python/evohome-client/* /opt/domoticz/evohome-client
Addressing the script from with a Dzvents executeShellCommand (as in my 'non-Docker' implementation) results in an error, so I tried to execute the script from the command line:

Code: Select all

docker exec -it domoticz /opt/domoticz/evohome-client/radiator_temp.py Voorkamer "5"
This results in the following errors:

Code: Select all

/opt/domoticz/evohome-client/radiator_temp.py: line 2: import: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 3: import: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 4: import: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 5: from: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 6: from: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 7: import: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 8: import: command not found
/opt/domoticz/evohome-client/radiator_temp.py: line 11: syntax error near unexpected token `('
/opt/domoticz/evohome-client/radiator_temp.py: line 11: `client = EvohomeClient(evoconfig.usr, evoconfig.pw)'
This is the radiator_temp.py:

Code: Select all

#!/bin/bash
import evoconfig
import sys
import requests
from evohomeclient2 import EvohomeClient
from datetime import datetime
import datetime
import time

# Zet de systeem status op 'Normal' als hij op 'Away' is ingesteld
client = EvohomeClient(evoconfig.usr, evoconfig.pw)
status=client.locations[0].status()
tcs=status['gateways'][0]['temperatureControlSystems'][0]
zones=tcs['zones']

# Wait to avoid that previous script is still running
time.sleep( 10 )

# Set system in the normal mode if that is not the case
currentmode = tcs['systemModeStatus']['mode']
if currentmode == "Away":
   client.set_status_normal()

# Wijzigingen doorvoeren tussen 08:00 en 21:00 uur
dt = datetime.datetime.now()
start_time = "08:00"
end_time = "21:00"
if start_time < dt.strftime("%H:%M") < end_time:
   # Aanpassen radiator temperatuur
   kamer=sys.argv[1]
   if kamer != "aanwezig":
      temp=sys.argv[2]
      zone = client.locations[0]._gateways[0]._control_systems[0].zones[kamer]
      zone.set_temperature(temp)
exit()
What's going wrong here?
User avatar
waltervl
Posts: 5770
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Oficial Docker Container

Post by waltervl »

Your python script starts with #!/bin/bash
It should start with
#!/usr/bin/python
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
JanvdW
Posts: 118
Joined: Saturday 21 December 2019 8:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Oficial Docker Container

Post by JanvdW »

When I change the shebang like that I receive this error message:

Code: Select all

OCI runtime exec failed: exec failed: unable to start container process: exec /opt/domoticz/evohome-client/radiator_temp.py: no such file or directory: unknown
User avatar
waltervl
Posts: 5770
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Oficial Docker Container

Post by waltervl »

Is it still executable? A python script needs to be executable (basic Linux, nothing to do with docker)
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
JanvdW
Posts: 118
Joined: Saturday 21 December 2019 8:36
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Oficial Docker Container

Post by JanvdW »

Sure, I did check that already:

Code: Select all

-rwxr-xr-x 1 root root  1020 Dec  4 21:42 radiator_temp.py
wizworks
Posts: 6
Joined: Tuesday 10 March 2020 3:58
Target OS: Linux
Domoticz version:
Contact:

Re: Oficial Docker Container

Post by wizworks »

I installed the latest on docker and I get this in the log when I try to add a dummy switch:

2024-01-13 14:34:23.038 Status: Domoticz V2024.1 (build 15838) (c)2012-2024 GizMoCuz
2024-01-13 14:34:23.038 Status: Build Hash: b97eb6256, Date: 2024-01-13 11:19:22
2024-01-13 14:34:23.038 Status: Startup Path: /opt/domoticz/
2024-01-13 14:34:23.056 Status: PluginSystem: Started, Python version '3.9.2', 0 plugin definitions loaded.
2024-01-13 14:34:23.058 Status: WebServer(HTTP) startup failed on address :: with port: 8080: resolve: Host not found (authoritative) [asio.netdb:1 at /usr/local/include/boost/asio/detail/resolver_service.hpp:84 in function 'resolve'], trying ::
2024-01-13 14:34:23.058 Status: WebServer(HTTP) startup failed on address :: with port: 8080: resolve: Host not found (authoritative) [asio.netdb:1 at /usr/local/include/boost/asio/detail/resolver_service.hpp:84 in function 'resolve'], trying 0.0.0.0
2024-01-13 14:34:23.058 Status: WebServer(HTTP) started on address: 0.0.0.0 with port 8080
2024-01-13 14:34:23.061 Status: WebServer(SSL) startup failed on address :: with port: 443: resolve: Host not found (authoritative) [asio.netdb:1 at /usr/local/include/boost/asio/detail/resolver_service.hpp:84 in function 'resolve'], trying ::
2024-01-13 14:34:23.061 Status: WebServer(SSL) startup failed on address :: with port: 443: resolve: Host not found (authoritative) [asio.netdb:1 at /usr/local/include/boost/asio/detail/resolver_service.hpp:84 in function 'resolve'], trying 0.0.0.0
2024-01-13 14:34:23.062 Status: WebServer(SSL) started on address: 0.0.0.0 with port 443
2024-01-13 14:34:23.063 Status: TCPServer: shared server started...
2024-01-13 14:34:23.063 Status: RxQueue: queue worker started...
2024-01-13 14:34:25.064 Status: NotificationSystem: thread started...
2024-01-13 14:34:25.064 Status: EventSystem: reset all events...
2024-01-13 14:34:25.065 Status: EventSystem: reset all device statuses...
2024-01-13 14:34:25.082 Status: Python EventSystem: Initializing event module.
2024-01-13 14:34:25.082 Status: EventSystem: Started
2024-01-13 14:34:25.082 Status: EventSystem: Queue thread started...
2024-01-13 14:35:02.797 Status: User: admin (IP: 10.1.73.111) initiated a switch command (1/TV/On)
2024-01-13 14:35:02.800 Error: Serious database error, problem getting ID from DeviceStatus!
2024-01-13 14:35:53.732 Status: User: admin (IP: 10.1.73.111) initiated a switch command (2/Unknown/Off)
2024-01-13 14:35:53.733 Error: Serious database error, problem getting ID from DeviceStatus!
2024-01-13 14:36:39.576 Error: Serious database error, problem getting ID from DeviceStatus!
Kedi
Posts: 569
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: Oficial Docker Container

Post by Kedi »

Check the write rights to the database.
It looks like the new device is not been created.
Logic will get you from A to B. Imagination will take you everywhere.
User avatar
Varazir
Posts: 380
Joined: Friday 20 February 2015 22:23
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Contact:

Re: Oficial Docker Container

Post by Varazir »

I'm getting this as well

Code: Select all

2024-02-07 20:37:59.293 Status: Domoticz V2024.4 (build 15904) (c)2012-2024 GizMoCuz
2024-02-07 20:37:59.293 Status: Build Hash: ebd7c557d, Date: 2024-02-07 08:48:05
2024-02-07 20:37:59.293 Status: Startup Path: /opt/domoticz/
2024-02-07 20:37:59.387 Status: PluginSystem: Started, Python version '3.9.2', 1 plugin definitions loaded.
2024-02-07 20:37:59.397 Status: WebServer(HTTP) startup failed on address :: with port: 8080: resolve: Host not found (authoritative) [asio.netdb:1 at /usr/local/include/boost/asio/detail/resolver_service.hpp:84 in function 'resolve'], trying ::
2024-02-07 20:37:59.398 Status: WebServer(HTTP) startup failed on address :: with port: 8080: resolve: Host not found (authoritative) [asio.netdb:1 at /usr/local/include/boost/asio/detail/resolver_service.hpp:84 in function 'resolve'], trying 0.0.0.0
2024-02-07 20:37:59.399 Status: WebServer(HTTP) started on address: 0.0.0.0 with port 8080
2024-02-07 20:37:59.413 Status: WebServer(SSL) startup failed on address :: with port: 443: resolve: Host not found (authoritative) [asio.netdb:1 at /usr/local/include/boost/asio/detail/resolver_service.hpp:84 in function 'resolve'], trying ::
2024-02-07 20:37:59.416 Status: WebServer(SSL) startup failed on address :: with port: 443: resolve: Host not found (authoritative) [asio.netdb:1 at /usr/local/include/boost/asio/detail/resolver_service.hpp:84 in function 'resolve'], trying 0.0.0.0
2024-02-07 20:37:59.420 Status: WebServer(SSL) started on address: 0.0.0.0 with port 443
Why ?
Raspberry PI 2 with RaZberry Controller 2016 ZWave+ and CC2531(zigbee)
Several IKEA devices/z-wave devices
PVerburg
Posts: 7
Joined: Sunday 16 July 2017 6:03
Target OS: Windows
Domoticz version:
Contact:

docker backup not working ??

Post by PVerburg »

Hi when I restore domoticz in my docker enviroment it starts up with no configuration if I restore a manual backup file ie the internal backup and restore that all is fine.
My question is why is the docker restore no working all the data files are there????

this is in the log file
++++++++++++++++++++
2024-04-21 14:20:39.954 Status: Domoticz V2024.4 (build 15937) (c)2012-2024 GizMoCuz
2024-04-21 14:20:39.954 Status: Build Hash: cad975ce1, Date: 2024-04-15 23:03:00
2024-04-21 14:20:39.954 Status: Startup Path: /opt/domoticz/
2024-04-21 14:20:40.737 Active notification Subsystems: fcm, http (2/13)
2024-04-21 14:20:40.942 Starting shared server on: 0.0.0.0:6144
2024-04-21 14:20:40.728 Status: PluginSystem: Started, Python version '3.9.2', 0 plugin definitions loaded.
2024-04-21 14:20:40.825 Status: WebServer(HTTP) startup failed on address :: with port: 8080: resolve: Host not found (authoritative) [asio.netdb:1 at /usr/local/include/boost/asio/detail/resolver_service.hpp:84 in function 'resolve'], trying ::
2024-04-21 14:20:40.825 Status: WebServer(HTTP) startup failed on address :: with port: 8080: resolve: Host not found (authoritative) [asio.netdb:1 at /usr/local/include/boost/asio/detail/resolver_service.hpp:84 in function 'resolve'], trying 0.0.0.0
2024-04-21 14:20:40.832 Status: WebServer(HTTP) started on address: 0.0.0.0 with port 8080
2024-04-21 14:20:40.938 Status: WebServer(SSL) startup failed on address :: with port: 443: resolve: Host not found (authoritative) [asio.netdb:1 at /usr/local/include/boost/asio/detail/resolver_service.hpp:84 in function 'resolve'], trying ::
2024-04-21 14:20:40.940 Status: WebServer(SSL) startup failed on address :: with port: 443: resolve: Host not found (authoritative) [asio.netdb:1 at /usr/local/include/boost/asio/detail/resolver_service.hpp:84 in function 'resolve'], trying 0.0.0.0
2024-04-21 14:20:40.941 Status: WebServer(SSL) started on address: 0.0.0.0 with port 443
2024-04-21 14:20:40.942 Status: TCPServer: shared server started...
2024-04-21 14:20:40.942 Status: RxQueue: queue worker started...
2024-04-21 14:20:40.102 Error: Default admin password has NOT been changed! Change it asap!
2024-04-21 14:20:42.943 Status: NotificationSystem: thread started...
2024-04-21 14:20:42.958 Status: EventSystem: reset all events...
2024-04-21 14:20:42.978 Status: EventSystem: reset all device statuses...
2024-04-21 14:20:42.992 Status: Python EventSystem: Initializing event module.
2024-04-21 14:20:42.993 Status: EventSystem: Queue thread started...
2024-04-21 14:20:42.993 Status: EventSystem: Started

thanks,
vgerwen
Posts: 4
Joined: Monday 19 May 2014 12:14
Target OS: Linux
Domoticz version: 2024.4
Contact:

Re: Oficial Docker Container

Post by vgerwen »

How did you start the container. With which options or how does compose file looks. Did you mount all volumes?
Running Domoticz 2024.4 on Intel NUC5CPYH Ubuntu Docker
Hardware: RfxComm, Zigbee2MQTT - Conbee, P1 interface usb
PVerburg
Posts: 7
Joined: Sunday 16 July 2017 6:03
Target OS: Windows
Domoticz version:
Contact:

Re: Oficial Docker Container

Post by PVerburg »

Sorry for the slow reply The problem was me I'm implementing Domoticz inside IOTstack docker solution and had trouble with the inbuilt backup solution but thats because I wasn't using the correct docker-compose file all is better now.
smatthew
Posts: 1
Joined: Sunday 26 January 2025 18:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Oficial Docker Container

Post by smatthew »

Intro
I've a Raspberry Pi 2b (512Mb) and I'm still using it. Once every few years the SD card dies losing all Domoticz data which has happened to me twice now :D.
This time I've decided to better myself and think of a way to survive the inevitable next death of the fresh replacement SD card. Retiring the Pi and replace it with a Zero is yet a bridge too far :mrgreen:

Ok, so where does Docker Domoticz come into play?
At work I overheard colleagues mentioning Docker and Kubernetes and I was googling these tools. Docker stuck in my mind as an interesting option and the SD crash prompted me to ask Co-Pilot (AI-tool of MS) for a plan of attack:
  1. Image the Pi with Raspberry Pi OS Lite.
  2. Install Docker.
  3. Configure the userdata folder as a volume in the .yml pointing to a USB stick (I was planning on asking Co-Pilot later on to schedule backups using rsync to another USB stick.)
  4. Run docker compose up -d.
This didn't work, since apparently there's no Docker image for linux/arm/v6. I expected as much, because some time before, upgrading non Docker Domoticz broke my installation.

Asked Co-Pilot what to do. The answer was to Install QEMU in order to run the Docker linux/amd64 for Domoticz in emulation mode. Did that and added platform: linux/amd64 to the .yml. Retried docker compose up -d and this time it worked! I was able to open the Domoticz dashboard and I started configuring my home devices, such as Honeywell Evohome (API), Netatmo (have a couple of 'Healthy Home Coaches') as well as Buienradar for weather stats of my surroundings.

My .yml:

Code: Select all

services:
  domoticz:
    image: domoticz/domoticz:stable
#    network_mode: host
    container_name: domoticz
    restart: unless-stopped
    ports:
      - "7478:7478"
    volumes:
      - /mnt/usb1/domoticz/userdata:/opt/domoticz/userdata
    devices:
      - "/dev/ttyUSB0:/dev/ttyUSB0"
    environment:
      - TZ=Europe/Amsterdam
    platform: linux/amd64
    command: ["/opt/domoticz/domoticz", "-www 7478", "-wwwbind 0.0.0.0", "-sslwww 7479"]
But unfortunately..
..the hardware devices didn't work including Buienradar. The log is flooded with the following errors:

Code: Select all

2025-01-26 20:03:14.182  Status: Honeywell ViiAgu: Connect to Evohome server
2025-01-26 20:03:58.171  Error: Honeywell ViiAgu: Login failed with message: Timeout was reached
2025-01-26 20:04:07.308  Error: Netatmo ViiAgu: Error connecting to Server...
2025-01-26 20:05:04.396  Error: Netatmo ViiAgu: Error connecting to Server...
2025-01-26 20:05:30.700  Error: Flevopark Temp: Error getting http data! (Check your internet connection!)
I suspected there was no internet connectivity available somehow to Domoticz running in a Docker container. Accessed the shell in the container and did a curl on Google which worked (HTTP 200 OK).

Found out through Co-Pilot that Docker by default runs in bridge mode, which enables you to run multiple instances of the same application simultaneously. Co-Pilot suggested to switch to host mode by adding a configuration line in the .yml. This didn't make a difference however after bringing the container down and back up.

So now what..
Of course I asked Co-Pilot, but the bot ran out of answers and pointed me to you guys :lol:
Is there anything I can do to make my..ehm..Co-Pilot's plan work? If not, then I'll be doing what I used to do:
  1. Install git etc. and compile Domoticz from source.
  2. Checking back after a couple days by doing a screen -dr and hoping compilation has completed.
  3. This time I'll make a symbolic link from the userdata folder to the USB stick.
  4. Re add hardware devices.
  5. Recreate scripts.
  6. Hope the SD card won't die that soon.
User avatar
gizmocuz
Posts: 2492
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Oficial Docker Container

Post by gizmocuz »

Ohhh man, please stop all this nonesence about arm v6, pi zero, qemu, please! :mrgreen:

Get yourself a RPI 4 or 5 and be happy!

And yeah, the RPI 1 + 2 are known for SD card issues

If your house will depend on it, spend some money.

Home automation ain't cheap! (avoid cheap sensors/hardware)
Quality outlives Quantity!
BarryT
Posts: 367
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Oficial Docker Container

Post by BarryT »

Hello everybody, does someone know how to do autossh with sshpass inside docker/customstart script?
I used an autossh with sshpass from local.rc before that made a connection to my remote VPS so i could connect domoticz behind NATs firewalls, but that is not working in my domoticz docker, and is the last thing it doesnt want to run from the customstart.sh script:
it gives an: sshpass no such file or directory (even after succeed install inside container)

Does anybody know how to do this from the customstart.sh script?
Thanks a lot!
BarryT
Posts: 367
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Oficial Docker Container

Post by BarryT »

Already fixed. Used an external docker with sshpass in it and mount the local to remote port. :D
It worked.
Anyway, atm im using vpn with WireGuard since i could also connect trough my local dns and do network things from outside.
akamming
Posts: 364
Joined: Friday 17 August 2018 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Oficial Docker Container

Post by akamming »

gizmocuz wrote: Monday 27 January 2025 9:16 Ohhh man, please stop all this nonesence about arm v6, pi zero, qemu, please! :mrgreen:

Get yourself a RPI 4 or 5 and be happy!

And yeah, the RPI 1 + 2 are known for SD card issues

If your house will depend on it, spend some money.

Home automation ain't cheap! (avoid cheap sensors/hardware)
I don't know if my n=1 experience is representative, but just want to mention it. I was running domoticz native on pi 4b without any issues. Then i tried running it under docker (i know, "why?!?". the answer is "why not". it is fun playing around ;-)). That went fine for about 2 weeks and then my SD card crashed. Tried on another (new) SD card, and had the same issue one week later.

Now back to a native (non docker) domoticz install and it is running fine again. Since that moment i also run a domoticz docker on another Pi 4, but with a SSD, and that also runs fine... Moral of the story:

In my N=1 experience PI4, SDcards en docker are not a happy combination. If you want it done correctly, even on Pi 4: Move away from SD cards to SSD. Will give you a performance bonus as well, cause the system is much more responsive.
User avatar
gizmocuz
Posts: 2492
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Oficial Docker Container

Post by gizmocuz »

No issues with SD cards and docker... very strange. Also make sure you have to correct type of SD card
Quality outlives Quantity!
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest