I’m looking for hardware to switch lights and wall contacts in a new construction. Preferably DIN rail mounted. Will have several sub-distribution panels throughout the house, need one or two of these in each. So I need both inputs (for the pushbuttons) and outputs (for the lights or wall contacts).
Thought of using Siemens Logo PLCs (I have one running now), but that’s overkill and the interfacing with HA is not ideal. Rather have something ESPHome based.
Came across this. Could probably find a DIN rail housing. 3.3V pull-up on the inputs is not ideal, but would work.
It does not have the RX and TX exposed to have ESPHome loaded. Has anybody programmed one of these with ESPHome?
Curious why you decided against the Siemens PLC, that should be an easy integration over modbus and is going to be a more mainstream solution that could be supported by most electricians.
I was on that track because of mainstream, not more expensive, and future proof. I abandoned it because of what I read about the difficulty integrating with HA. However that seems to be improved since. Must look at that again. Would strongly prefer the Siemens hardware.
I haven’t used the modbus integration in Home Assistant, but have integrated Modbus in multiple industrial projects, it takes a bit to get used to but works very well, in my experience. If you don’t like modbus you could also look at MQTT, some Siemens PLCs support that directly as well as other manufacturers.
I have been reading up on using the Logo! with HA. There are two tracks; Modbus or (with Logo! 8.4) MQTT.
However neither seems without issues and just from reading the posts I can’t figure out if it will do what I need.
About what I think I need:
I will have push button switches around the house connected to the Logo! PLC (24V inputs) to toggle the lights (relay outputs). So all logic in the Logo and in HA must work with toggle pulses and a flip-flop (no switches).
Then I need s/w inputs on the Logo that I can toggle with a state in HA (input_boolean). And I need to be able to see the state of the Logo! relay outputs in HA (binary_sensor) also to be able to force an ‘on’ or ‘off’ state.
That should not be too difficult?
I can program basic logic (lights on/off) in the Logo(s) and more complex or global functions (all lights off, presence simulation, …) in HA.
I think you are on the right track or at least that would be my approach.
I would have the basic logic on the PLC, monitor the button presses and then toggle the relay output. That logic would all be on the PLC itself and independent of HA. From there, you can monitor and control the relay outputs from HA. Each manufacture is different I’ve done very little with Siemens, but it’s likely you can’t set or read the relay output directly and will need to create a holding register that you can write the required state from HA then a status register for HA to read the current state. So, you would also need to create that logic in the PLC, to read the holding register, set the output then set the new state back to the status register.
I think I found a solution to do exactly that with Modbus here:
Google translate for me.
It even has a trick in the Logo! program to change a switch state change in HA into a pulse on the Logo! so you can just toggle a switch rather than create a pulse.
I don’t know if you are still looking for a solution? I’m now testing this board and I added it to esphome and the relais are vissible in HomeAssistant.
This is my code:
substitutions:
name: esphome-web-89a5f4
friendly_name: ESP32LR88
esphome:
name: ${name}
friendly_name: ${friendly_name}
min_version: 2024.6.0
name_add_mac_suffix: false
project:
name: esphome.web
version: dev
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
# Allow Over-The-Air updates
ota:
- platform: esphome
# Allow provisioning Wi-Fi via serial
improv_serial:
wifi:
# Set up a wifi access point
ap: {}
# In combination with the `ap` this allows the user
# to provision wifi credentials to the device via WiFi AP.
captive_portal:
dashboard_import:
package_import_url: github://esphome/example-configs/esphome-web/esp32.yaml@main
import_full_config: true
# Sets up Bluetooth LE (Only on ESP32) to allow the user
# to provision wifi credentials to the device.
esp32_improv:
authorizer: none
# To have a "next url" for improv serial
web_server:
# Status LED
light:
- platform: status_led
name: "RelayBoard Led"
pin:
number: GPIO23
inverted: true
# 8 relay outputs, exposed as switches in Home Assistant
switch:
- platform: gpio
pin: GPIO33
name: Relay1
id: relay1
- platform: gpio
pin: GPIO25
name: Relay2
id: relay2
- platform: gpio
pin: GPIO26
name: Relay3
id: relay3
- platform: gpio
pin: GPIO27
name: Relay4
id: relay4
- platform: gpio
pin: GPIO14
name: Relay5
id: relay5
- platform: gpio
pin: GPIO12
name: Relay6
id: relay6
- platform: gpio
pin: GPIO13
name: Relay7
id: relay7
- platform: gpio
pin: GPIO2
name: Relay8
id: relay8
# Example configuration entry
binary_sensor:
- platform: gpio
pin:
number: GPIO4
inverted: true
name: INPUT1
id: INPUT1
- platform: gpio
pin:
number: GPIO16
inverted: true
name: INPUT2
id: INPUT2
- platform: gpio
pin:
number: GPIO17
inverted: true
name: INPUT3
id: INPUT3
- platform: gpio
pin:
number: GPIO5
inverted: true
name: INPUT4
id: INPUT4
- platform: gpio
pin:
number: GPIO18
inverted: true
name: INPUT5
id: INPUT5
- platform: gpio
pin:
number: GPIO19
inverted: true
name: INPUT6
id: INPUT6
- platform: gpio
pin:
number: GPIO21
inverted: true
name: INPUT7
id: INPUT7
- platform: gpio
pin:
number: GPIO22
inverted: true
name: INPUT8
id: INPUT8