Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Software title: Domoticz Home Automation System #398

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added tools/include/images/DOM002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions tools/include/markdown/DOM001-header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Domoticz is an open-source home automation platform that allows you to control and monitor smart devices in your home. It supports a wide range of devices, including lights, sensors, thermostats, and cameras. Through its web interface or mobile app, you can set up automation rules and schedules, providing greater convenience and energy efficiency. It’s customizable, flexible, and can be run on a variety of hardware platforms supported by Armbian.

=== "Access to the web interface"

The web interface is accessible via port **8080**:

- URL: `https://<your.IP>:8080`
- Username/Password: admin / domoticz

=== "Directories"

- Config directory: `/armbian/domoticz`

=== "Advanced setup"

- Primary USB device passing through (`/dev/ttyUSB0`) to Docker container is enabled by default
- For more complex setup, please follow this comprehensive guide: <https://wiki.domoticz.com/Main_Page>
33 changes: 33 additions & 0 deletions tools/json/config.software.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,39 @@
"status": "Preview",
"author": "@igorpecovnik",
"condition": "module_haos status"
},
{
"id": "DOM001",
"description": "Domoticz open source home automation",
"about": "This operation will install Domoticz.",
"command": [
"module_domoticz install"
],
"status": "Preview",
"author": "@igorpecovnik",
"condition": "! module_domoticz status"
},
{
"id": "DOM002",
"description": "Domoticz remove",
"about": "This operation will remove Domoticz.",
"command": [
"module_domoticz remove"
],
"status": "Preview",
"author": "@igorpecovnik",
"condition": "module_domoticz status"
},
{
"id": "DOM003",
"description": "Domoticz purge with data folder",
"about": "This operation will purge Domoticz.",
"command": [
"module_domoticz purge"
],
"status": "Preview",
"author": "@igorpecovnik",
"condition": "module_domoticz status"
}
]
},
Expand Down
1 change: 1 addition & 0 deletions tools/modules/runtime/config.runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ update_sub_submenu_data "Software" "Printing" "OCT002" "http://$LOCALIPADD:${mod
# Home automation
update_sub_submenu_data "Software" "HomeAutomation" "HAB002" "http://$LOCALIPADD:${module_options["module_openhab,port"]}"
update_sub_submenu_data "Software" "HomeAutomation" "HAS002" "http://$LOCALIPADD:${module_options["module_haos,port"]}"
update_sub_submenu_data "Software" "HomeAutomation" "DOM002" "http://$LOCALIPADD:${module_options["module_domoticz,port"]}"

# DNS
update_sub_submenu_data "Software" "DNS" "DNS003" "http://$LOCALIPADD:${module_options["module_pi_hole,port"]%% *}" # removing second port from url
Expand Down
87 changes: 87 additions & 0 deletions tools/modules/software/module_domoticz.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
module_options+=(
["module_domoticz,author"]="@armbian"
["module_domoticz,maintainer"]="@igorpecovnik"
["module_domoticz,feature"]="module_domoticz"
["module_domoticz,example"]="install remove purge status help"
["module_domoticz,desc"]="Install domoticz container"
["module_domoticz,status"]="Active"
["module_domoticz,doc_link"]="https://wiki.domoticz.com"
["module_domoticz,group"]="Monitoring"
["module_domoticz,port"]="8080"
["module_domoticz,arch"]=""
)
#
# Module domoticz
#
function module_domoticz () {
local title="domoticz"
local condition=$(which "$title" 2>/dev/null)

if pkg_installed docker-ce; then
local container=$(docker container ls -a | mawk '/domoticz?( |$)/{print $1}')
local image=$(docker image ls -a | mawk '/domoticz?( |$)/{print $3}')
fi

local commands
IFS=' ' read -r -a commands <<< "${module_options["module_domoticz,example"]}"

DOMOTICZ_BASE="${SOFTWARE_FOLDER}/domoticz"

case "$1" in
"${commands[0]}")
pkg_installed docker-ce || module_docker install
[[ -d "$DOMOTICZ_BASE" ]] || mkdir -p "$DOMOTICZ_BASE" || { echo "Couldn't create storage directory: $DOMOTICZ_BASE"; exit 1; }
docker run -d \
--name=domoticz \
--pid=host \
--net=lsio \
--device /dev/ttyUSB0:/dev/ttyUSB0 \
-e PUID=1000 \
-e PGID=1000 \
-e TZ="$(cat /etc/timezone)" \
-p 8080:8080 \
-p 8443:443 \
-v "${DOMOTICZ_BASE}:/opt/domoticz/userdata" \
--restart unless-stopped \
domoticz/domoticz:stable
for i in $(seq 1 20); do
if docker inspect -f '{{ index .Config.Labels "build_version" }}' domoticz >/dev/null 2>&1 ; then
break
else
sleep 3
fi
if [ $i -eq 20 ] ; then
echo -e "\nTimed out waiting for ${title} to start, consult your container logs for more info (\`docker logs domoticz\`)"
exit 1
fi
done
;;
"${commands[1]}")
[[ "${container}" ]] && docker container rm -f "$container" >/dev/null
[[ "${image}" ]] && docker image rm "$image" >/dev/null
;;
"${commands[2]}")
${module_options["module_domoticz,feature"]} ${commands[1]}
[[ -n "${DOMOTICZ_BASE}" && "${DOMOTICZ_BASE}" != "/" ]] && rm -rf "${DOMOTICZ_BASE}"
;;
"${commands[3]}")
if [[ "${container}" && "${image}" ]]; then
return 0
else
return 1
fi
;;
"${commands[4]}")
echo -e "\nUsage: ${module_options["module_domoticz,feature"]} <command>"
echo -e "Commands: ${module_options["module_domoticz,example"]}"
echo "Available commands:"
echo -e "\tinstall\t- Install $title."
echo -e "\tstatus\t- Installation status $title."
echo -e "\tremove\t- Remove $title."
echo
;;
*)
${module_options["module_domoticz,feature"]} ${commands[4]}
;;
esac
}