fixing garten_bus_controller
This commit is contained in:
parent
50779acee3
commit
a22a1dbd8a
|
@ -3,3 +3,4 @@
|
||||||
# You can modify this file to suit your needs.
|
# You can modify this file to suit your needs.
|
||||||
/.esphome/
|
/.esphome/
|
||||||
/secrets.yaml
|
/secrets.yaml
|
||||||
|
/venv
|
||||||
|
|
|
@ -25,10 +25,10 @@ external_components:
|
||||||
ref: master
|
ref: master
|
||||||
|
|
||||||
|
|
||||||
external_components:
|
#external_components:
|
||||||
- source:
|
# - source:
|
||||||
type: local
|
# type: local
|
||||||
path: my_components
|
# path: my_components
|
||||||
|
|
||||||
#wifi:
|
#wifi:
|
||||||
# ssid: "WLAN"
|
# ssid: "WLAN"
|
||||||
|
@ -75,6 +75,7 @@ modbus_controller:
|
||||||
- modbus_id: "modbus_relays"
|
- modbus_id: "modbus_relays"
|
||||||
id: "relayboard32"
|
id: "relayboard32"
|
||||||
address: 0x1
|
address: 0x1
|
||||||
|
update_interval: "60s"
|
||||||
- modbus_id: "modbus_relays"
|
- modbus_id: "modbus_relays"
|
||||||
id: "relayboard8_with_inputs"
|
id: "relayboard8_with_inputs"
|
||||||
address: 0x2
|
address: 0x2
|
||||||
|
@ -91,37 +92,81 @@ packages:
|
||||||
file: "modbus_relay.yaml"
|
file: "modbus_relay.yaml"
|
||||||
vars:
|
vars:
|
||||||
cid: relayboard32
|
cid: relayboard32
|
||||||
name: "modbus-switch01"
|
name: "ventil-beete-nordwest"
|
||||||
dev_addr: 0x1
|
dev_addr: 0x1
|
||||||
register_addr: 0x01
|
register_addr: 0x01
|
||||||
relay02: !include
|
relay02: !include
|
||||||
file: "modbus_relay.yaml"
|
file: "modbus_relay.yaml"
|
||||||
vars:
|
vars:
|
||||||
cid: relayboard32
|
cid: relayboard32
|
||||||
name: "modbus-switch02"
|
name: "ventil-beet-west"
|
||||||
dev_addr: 0x1
|
dev_addr: 0x1
|
||||||
register_addr: 0x02
|
register_addr: 0x02
|
||||||
relay03: !include
|
relay03: !include
|
||||||
file: "modbus_relay.yaml"
|
file: "modbus_relay.yaml"
|
||||||
vars:
|
vars:
|
||||||
cid: relayboard32
|
cid: relayboard32
|
||||||
name: "modbus-switch03"
|
name: "ventil-sprinkler-westen"
|
||||||
dev_addr: 0x1
|
dev_addr: 0x1
|
||||||
register_addr: 0x03
|
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"
|
file: "modbus_relay.yaml"
|
||||||
vars:
|
vars:
|
||||||
cid: relayboard32
|
cid: relayboard32
|
||||||
name: "modbus-switch16"
|
name: "ventil-sprinkler-sud"
|
||||||
dev_addr: 0x1
|
dev_addr: 0x1
|
||||||
register_addr: 0x0f
|
register_addr: 0x05
|
||||||
relay17: !include
|
#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"
|
file: "modbus_relay.yaml"
|
||||||
vars:
|
vars:
|
||||||
cid: relayboard32
|
cid: relayboard32
|
||||||
name: "modbus-switch17"
|
name: "ventil-brunnen-in-zisterne"
|
||||||
dev_addr: 0x1
|
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 ----
|
# ------------ Relays of 8-Relay board ----
|
||||||
b2relay1: !include
|
b2relay1: !include
|
||||||
file: "modbus_relay.yaml"
|
file: "modbus_relay.yaml"
|
||||||
|
|
|
@ -4,7 +4,8 @@ switch:
|
||||||
modbus_controller_id: ${cid}
|
modbus_controller_id: ${cid}
|
||||||
name: ${name}
|
name: ${name}
|
||||||
register_type: holding
|
register_type: holding
|
||||||
address: ${dev_addr}
|
address: ${register_addr}
|
||||||
|
force_new_range: true
|
||||||
write_lambda: |-
|
write_lambda: |-
|
||||||
bool open = (x == 1);
|
bool open = (x == 1);
|
||||||
payload.push_back(${dev_addr}); // device address
|
payload.push_back(${dev_addr}); // device address
|
||||||
|
@ -13,4 +14,10 @@ switch:
|
||||||
payload.push_back(${register_addr}); //
|
payload.push_back(${register_addr}); //
|
||||||
payload.push_back(open ? 0x01 : 0x02); // Command
|
payload.push_back(open ? 0x01 : 0x02); // Command
|
||||||
payload.push_back(0x00);
|
payload.push_back(0x00);
|
||||||
return true;
|
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);
|
Loading…
Reference in New Issue