feat(shelly): add terraform_shelly workspace for Taupi-4.0 dew point ventilation
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
locals {
|
||||
templated_code = templatefile("${path.module}/scripts/Taupi-4.0.js", {
|
||||
sensor_aussen_mac = var.sensor_aussen_mac
|
||||
sensor_innen_mac = var.sensor_innen_mac
|
||||
taupunktschwelle = var.taupunktschwelle
|
||||
mindesttemperatur = var.mindesttemperatur
|
||||
mindesthumi = var.mindesthumi
|
||||
schaltzeit = var.schaltzeit
|
||||
battery_warngrenze = var.battery_warngrenze
|
||||
lost_connection = var.lost_connection
|
||||
})
|
||||
}
|
||||
|
||||
resource "local_file" "templated_script" {
|
||||
content = local.templated_code
|
||||
filename = "${path.module}/scripts/Taupi-4.0.templated.js"
|
||||
}
|
||||
|
||||
resource "shelly_script_config" "taupi" {
|
||||
ip = var.shelly_ip
|
||||
id = 1
|
||||
name = "Taupi-4.0"
|
||||
enable = true
|
||||
}
|
||||
|
||||
resource "null_resource" "upload_script" {
|
||||
triggers = {
|
||||
code_hash = sha256(local_file.templated_script.content)
|
||||
ip = var.shelly_ip
|
||||
}
|
||||
|
||||
provisioner "local-exec" {
|
||||
command = "python3 ${path.module}/scripts/upload.py ${var.shelly_ip} 1 ${local_file.templated_script.filename}"
|
||||
}
|
||||
|
||||
depends_on = [shelly_script_config.taupi]
|
||||
}
|
||||
Reference in New Issue
Block a user