diff --git a/.gitignore b/.gitignore index d8b4157..4743c26 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ # You can modify this file to suit your needs. /.esphome/ /secrets.yaml +/venv diff --git a/garten_bus_controller.yaml b/garten_bus_controller.yaml index 6fed580..f32a792 100644 --- a/garten_bus_controller.yaml +++ b/garten_bus_controller.yaml @@ -25,10 +25,10 @@ external_components: ref: master -external_components: - - source: - type: local - path: my_components +#external_components: +# - source: +# type: local +# path: my_components #wifi: # ssid: "WLAN" @@ -75,6 +75,7 @@ modbus_controller: - modbus_id: "modbus_relays" id: "relayboard32" address: 0x1 + update_interval: "60s" - modbus_id: "modbus_relays" id: "relayboard8_with_inputs" address: 0x2 @@ -91,37 +92,81 @@ packages: file: "modbus_relay.yaml" vars: cid: relayboard32 - name: "modbus-switch01" + name: "ventil-beete-nordwest" dev_addr: 0x1 register_addr: 0x01 relay02: !include file: "modbus_relay.yaml" vars: cid: relayboard32 - name: "modbus-switch02" + name: "ventil-beet-west" dev_addr: 0x1 register_addr: 0x02 relay03: !include file: "modbus_relay.yaml" vars: cid: relayboard32 - name: "modbus-switch03" + name: "ventil-sprinkler-westen" dev_addr: 0x1 register_addr: 0x03 - relay16: !include + #relay04: !include + # file: "modbus_relay.yaml" + # vars: + # cid: relayboard32 + # name: "ventil-gartenhaus-kein-rohr-angeschlossen" + # dev_addr: 0x1 + # register_addr: 0x04 + relay05: !include file: "modbus_relay.yaml" vars: cid: relayboard32 - name: "modbus-switch16" + name: "ventil-sprinkler-sud" dev_addr: 0x1 - register_addr: 0x0f - relay17: !include + register_addr: 0x05 + #relay06: !include + # file: "modbus_relay.yaml" + # vars: + # cid: relayboard32 + # name: "ventil-gartenhaus-kein-ventil-angeschlossen" + # dev_addr: 0x1 + # register_addr: 0x06 + relay07: !include file: "modbus_relay.yaml" vars: cid: relayboard32 - name: "modbus-switch17" + name: "ventil-brunnen-in-zisterne" dev_addr: 0x1 - register_addr: 0x10 + register_addr: 0x07 + #--- obere reihe + relay29: !include + file: "modbus_relay.yaml" + vars: + cid: relayboard32 + name: "poolpumpe-speed3" + dev_addr: 0x1 + register_addr: 29 + relay30: !include + file: "modbus_relay.yaml" + vars: + cid: relayboard32 + name: "poolpumpe-speed2" + dev_addr: 0x1 + register_addr: 30 + relay31: !include + file: "modbus_relay.yaml" + vars: + cid: relayboard32 + name: "poolpumpe-speed1" + dev_addr: 0x1 + register_addr: 31 + relay32: !include + file: "modbus_relay.yaml" + vars: + cid: relayboard32 + name: "poolpumpe-speed-off" + dev_addr: 0x1 + register_addr: 32 + # ------------ Relays of 8-Relay board ---- b2relay1: !include file: "modbus_relay.yaml" diff --git a/modbus_relay.yaml b/modbus_relay.yaml index 0cbf6f7..9cd6ef5 100644 --- a/modbus_relay.yaml +++ b/modbus_relay.yaml @@ -4,7 +4,8 @@ switch: modbus_controller_id: ${cid} name: ${name} register_type: holding - address: ${dev_addr} + address: ${register_addr} + force_new_range: true write_lambda: |- bool open = (x == 1); payload.push_back(${dev_addr}); // device address @@ -13,4 +14,10 @@ switch: payload.push_back(${register_addr}); // payload.push_back(open ? 0x01 : 0x02); // Command payload.push_back(0x00); - return true; \ No newline at end of file + return open; + #lambda: |- + # if(item->start_address == 0x07) + # { + # ESP_LOGW("relay_lambda", "addr %d | x=%d , (%d, %d)", item->start_address, x, data[item->offset + 0], data[item->offset + 1]); + # } + # return (x == 1); \ No newline at end of file