mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-11 07:10:39 +02:00
fix: modbus for amtron updates
This commit is contained in:
parent
f70e9e83f8
commit
40ce6c041e
3 changed files with 13 additions and 13 deletions
|
@ -9,26 +9,25 @@
|
||||||
{
|
{
|
||||||
delay = 1;
|
delay = 1;
|
||||||
host = globals.net.home-lan.vlans.devices.hosts.wallbox.ipv4;
|
host = globals.net.home-lan.vlans.devices.hosts.wallbox.ipv4;
|
||||||
name = "Amtron Xtra 22 C2";
|
name = "amtron_xtra_22_c2";
|
||||||
port = 502;
|
port = 502;
|
||||||
retries = 1;
|
timeout = 10;
|
||||||
retry_on_empty = true;
|
message_wait_milliseconds = 100;
|
||||||
|
type = "tcp";
|
||||||
sensors = [
|
sensors = [
|
||||||
{
|
{
|
||||||
address = 768;
|
address = 768;
|
||||||
count = 38;
|
count = 38;
|
||||||
data_type = "custom";
|
data_type = "custom";
|
||||||
input_type = "input";
|
input_type = "input";
|
||||||
lazy_error_count = 1;
|
|
||||||
name = "Amtron Registers";
|
name = "Amtron Registers";
|
||||||
precision = 0;
|
precision = 0;
|
||||||
scan_interval = 120;
|
scan_interval = 30;
|
||||||
slave = 255;
|
slave = 255;
|
||||||
structure = ">2h15H22B10H";
|
structure = ">2h15H22B10H";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
address = 1024;
|
address = 1024;
|
||||||
count = 1;
|
|
||||||
data_type = "uint16";
|
data_type = "uint16";
|
||||||
device_class = "current";
|
device_class = "current";
|
||||||
input_type = "holding";
|
input_type = "holding";
|
||||||
|
@ -39,7 +38,6 @@
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
address = 1025;
|
address = 1025;
|
||||||
count = 1;
|
|
||||||
data_type = "uint16";
|
data_type = "uint16";
|
||||||
input_type = "holding";
|
input_type = "holding";
|
||||||
name = "Amtron Change Charge State";
|
name = "Amtron Change Charge State";
|
||||||
|
@ -47,8 +45,6 @@
|
||||||
unique_id = "amtron_change_charge_state";
|
unique_id = "amtron_change_charge_state";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
timeout = 10;
|
|
||||||
type = "tcp";
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
template = [
|
template = [
|
||||||
|
@ -229,9 +225,9 @@
|
||||||
{% set ns = namespace(name = ''') -%}
|
{% set ns = namespace(name = ''') -%}
|
||||||
{% set input = states('sensor.amtron_registers').split(',')[17:40] -%}
|
{% set input = states('sensor.amtron_registers').split(',')[17:40] -%}
|
||||||
{% for i in range(0,11) -%}
|
{% for i in range(0,11) -%}
|
||||||
{% set ns.name = ns.name ~ \"%c\"%input[i*2+1]|int ~ \"%c\"%input[i*2]|int -%}
|
{% set ns.name = ns.name ~ "%c"%input[i*2+1]|int ~ "%c"%input[i*2]|int -%}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{{ ns.name.replace('\\x00',''') }}
|
{{ ns.name.replace('\x00',''') }}
|
||||||
'';
|
'';
|
||||||
unique_id = "amtron_wallbox_name";
|
unique_id = "amtron_wallbox_name";
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,6 +125,7 @@ in
|
||||||
adguardhome
|
adguardhome
|
||||||
dwdwfsapi
|
dwdwfsapi
|
||||||
fritzconnection
|
fritzconnection
|
||||||
|
getmac
|
||||||
gtts
|
gtts
|
||||||
psycopg2
|
psycopg2
|
||||||
pyatv
|
pyatv
|
||||||
|
@ -140,6 +141,9 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.home-assistant = {
|
systemd.services.home-assistant = {
|
||||||
|
serviceConfig.LoadCredential = [
|
||||||
|
"hass-influxdb-token:${config.age.secrets.hass-influxdb-token.path}"
|
||||||
|
];
|
||||||
preStart = lib.mkBefore ''
|
preStart = lib.mkBefore ''
|
||||||
if [[ -e ${config.services.home-assistant.configDir}/secrets.yaml ]]; then
|
if [[ -e ${config.services.home-assistant.configDir}/secrets.yaml ]]; then
|
||||||
rm ${config.services.home-assistant.configDir}/secrets.yaml
|
rm ${config.services.home-assistant.configDir}/secrets.yaml
|
||||||
|
@ -147,7 +151,7 @@ in
|
||||||
|
|
||||||
# Update influxdb token
|
# Update influxdb token
|
||||||
# We don't use -i because it would require chown with is a @privileged syscall
|
# We don't use -i because it would require chown with is a @privileged syscall
|
||||||
INFLUXDB_TOKEN="$(cat ${config.age.secrets.hass-influxdb-token.path})" \
|
INFLUXDB_TOKEN="$(cat "$CREDENTIALS_DIRECTORY/hass-influxdb-token")" \
|
||||||
${lib.getExe pkgs.yq-go} '.influxdb_token = strenv(INFLUXDB_TOKEN)' \
|
${lib.getExe pkgs.yq-go} '.influxdb_token = strenv(INFLUXDB_TOKEN)' \
|
||||||
${
|
${
|
||||||
config.age.secrets."home-assistant-secrets.yaml".path
|
config.age.secrets."home-assistant-secrets.yaml".path
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
age.secrets.hass-influxdb-token = {
|
age.secrets.hass-influxdb-token = {
|
||||||
generator.script = "alnum";
|
generator.script = "alnum";
|
||||||
mode = "440";
|
mode = "440";
|
||||||
group = "hass";
|
group = "influxdb2";
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.persistence."/persist".directories = [
|
environment.persistence."/persist".directories = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue