l hass zigbee: update with new adapter
This commit is contained in:
parent
4fcf00d9bb
commit
2cbed4cab9
@ -1,7 +1,24 @@
|
|||||||
{config, pkgs, lib, ...}: let
|
{config, pkgs, lib, ...}: let
|
||||||
|
|
||||||
zigbee2mqtt_cfg = pkgs.writeText "zigbee2mqtt.json" (builtins.toJSON {
|
unstable-pkgs = import <nixpkgs-unstable> {};
|
||||||
|
|
||||||
|
in {
|
||||||
|
# symlink the zigbee controller
|
||||||
|
services.udev.extraRules = ''
|
||||||
|
SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dialout"
|
||||||
|
SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", SYMLINK+="cc2652", MODE="0660", GROUP="dialout"
|
||||||
|
'';
|
||||||
|
|
||||||
|
# needed to use unstable package
|
||||||
|
systemd.services.zigbee2mqtt.environment.ZIGBEE2MQTT_DATA = "/var/lib/zigbee2mqtt";
|
||||||
|
|
||||||
|
services.zigbee2mqtt = {
|
||||||
|
enable = true;
|
||||||
|
package = unstable-pkgs.zigbee2mqtt;
|
||||||
|
config = {
|
||||||
homeassistant = true;
|
homeassistant = true;
|
||||||
|
frontend.port = 1337;
|
||||||
|
experimental.new_api = true;
|
||||||
permit_join = false;
|
permit_join = false;
|
||||||
mqtt = {
|
mqtt = {
|
||||||
discovery = true;
|
discovery = true;
|
||||||
@ -10,29 +27,14 @@
|
|||||||
user = "gg23";
|
user = "gg23";
|
||||||
password = "gg23-mqtt";
|
password = "gg23-mqtt";
|
||||||
};
|
};
|
||||||
serial.port = "/dev/cc2531";
|
serial = {
|
||||||
});
|
port = "/dev/cc2652";
|
||||||
|
# disable_led = true;
|
||||||
in {
|
};
|
||||||
# symlink the zigbee controller
|
advanced = {
|
||||||
services.udev.extraRules = ''
|
pan_id = 4222;
|
||||||
SUBSYSTEM=="tty", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16a8", SYMLINK+="cc2531", MODE="0660", GROUP="dailout"
|
};
|
||||||
'';
|
};
|
||||||
|
|
||||||
system.activationScripts.installZigbee = ''
|
|
||||||
install -d /var/lib/zigbee2mqtt
|
|
||||||
install ${zigbee2mqtt_cfg} /var/lib/zigbee2mqtt/configuration.yaml
|
|
||||||
'';
|
|
||||||
|
|
||||||
# hack to restart docker container on config change
|
|
||||||
systemd.services.docker-zigbee2mqtt.environment.cfg = zigbee2mqtt_cfg;
|
|
||||||
|
|
||||||
docker-containers.zigbee2mqtt = {
|
|
||||||
image = "koenkk/zigbee2mqtt";
|
|
||||||
extraDockerOptions = [
|
|
||||||
"--device=/dev/cc2531:/dev/cc2531"
|
|
||||||
];
|
|
||||||
volumes = ["/var/lib/zigbee2mqtt:/app/data"];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
services.home-assistant.config = {
|
services.home-assistant.config = {
|
||||||
@ -93,7 +95,6 @@ in {
|
|||||||
{
|
{
|
||||||
id = "zigbee_join_enabled";
|
id = "zigbee_join_enabled";
|
||||||
alias = "";
|
alias = "";
|
||||||
hide_entity = "true";
|
|
||||||
trigger = {
|
trigger = {
|
||||||
platform = "state";
|
platform = "state";
|
||||||
entity_id = "switch.zigbee2mqtt_join";
|
entity_id = "switch.zigbee2mqtt_join";
|
||||||
@ -107,7 +108,6 @@ in {
|
|||||||
# Automation to stop timer when switch turned off and turn off switch when timer finished
|
# Automation to stop timer when switch turned off and turn off switch when timer finished
|
||||||
{
|
{
|
||||||
id = "zigbee_join_disabled";
|
id = "zigbee_join_disabled";
|
||||||
hide_entity = "true";
|
|
||||||
trigger = [
|
trigger = [
|
||||||
{
|
{
|
||||||
platform = "event";
|
platform = "event";
|
||||||
|
Loading…
Reference in New Issue
Block a user