I’ve flashed a Shelly 1 Gen3 to Esphome but was assuming it was a 1PM which I ordered. Only noticed afterwards it’s in fact just the Shelly 1 gen3 (Shelly 1 Gen3) and not a PM.
Does anyone have a pinout for this? Seems like it’s loaded the esp32c3 firmware and I have temp monitoring but nothing else is showing up.
I have found that relay is GPIO5 on this model, but the switch is NOT GPIO10 and the button is NOT GPIO1.
I also do NOT have a bl0942 on GPIO6/7. So much of this looks outwardly like the Shelly 1PM Gen3 but is wired totally different.
Here is the code, I have assumed that like the 1PM Gen3 there is a current and voltage sensor, but I’m not sure. I am also experimenting with an override to prevent the switch turning off the output.
substitutions:
device_name: "Shelly Plus 1"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
logger:
api:
encryption:
key: !secret api_encryption_key
ota:
- platform: esphome
password: !secret esphome_ota_password
esphome:
name: shelly-1-plus
platformio_options:
board_build.mcu: esp32c3
board_build.variant: esp32c3
board_build.f_cpu: 160000000L
board_build.f_flash: 80000000L
board_build.flash_mode: dio
board_build.flash_size: 8MB
esp32:
variant: esp32c3
uart:
id: bl0942_uart
tx_pin: GPIO6
rx_pin:
number: GPIO7
mode:
pullup: true
input: true
baud_rate: 9600
stop_bits: 1
output:
- id: shelly_1pm_gen3_relay
platform: gpio
pin: GPIO5
switch:
# Use a template switch to allow for checking fault conditions before switching on the relay output.
- platform: template
id: shelly_1pm_gen3_output
name: Relay
device_class: outlet
restore_mode: ALWAYS_ON
turn_on_action:
if:
any:
- sensor.in_range:
id: temperature
below: 75.0
# Temperature sensor is unknown for several seconds on boot. Allow the relay to switch on anyway.
- and:
- lambda: "return isnan(id(temperature).state);"
- binary_sensor.is_off: error_overtemp
then:
- output.turn_on: shelly_1pm_gen3_relay
- binary_sensor.template.publish:
id: error_overtemp
state: OFF
- binary_sensor.template.publish:
id: error_overpower
state: OFF
- switch.template.publish:
id: shelly_1pm_gen3_output
state: ON
else:
- switch.template.publish:
id: shelly_1pm_gen3_output
state: OFF
turn_off_action:
then:
- output.turn_off: shelly_1pm_gen3_relay
- switch.template.publish:
id: shelly_1pm_gen3_output
state: OFF
binary_sensor:
- id: shelly_1pm_gen3_override_on
platform: homeassistant
entity_id: input_boolean.shelly_1pm_gen3_override_on
name: Override output to ON
- id: shelly_1pm_gen3_switch
name: Switch
platform: gpio
pin: GPIO10
filters:
- delayed_off: 50ms
on_press:
then:
- switch.turn_on: shelly_1pm_gen3_output
on_release:
if:
condition:
binary_sensor.is_off: shelly_1pm_gen3_override_on
then:
- switch.turn_off: shelly_1pm_gen3_output
- id: shelly_1pm_gen3_button
name: Button
platform: gpio
pin: GPIO1
filters:
- delayed_off: 50ms
- id: error_overtemp
name: Overheating
device_class: problem
entity_category: diagnostic
platform: template
condition:
any:
- binary_sensor.is_on: error_overtemp # Latch ON
- sensor.in_range:
id: temperature
above: 75.0
on_press:
then:
- switch.turn_off: shelly_1pm_gen3_output
- id: error_overpower
name: Overpowering
device_class: problem
entity_category: diagnostic
platform: template
condition:
any:
- binary_sensor.is_on: error_overpower # Latch ON
- for:
time: 1s
condition:
sensor.in_range:
id: sensor_current
above: 16 # This is model specific!
on_press:
then:
- switch.turn_off: shelly_1pm_gen3_output
sensor:
- id: temperature
name: Temperature
platform: ntc
sensor: temperature_sensor_resistance
icon: mdi:thermometer
entity_category: diagnostic
unit_of_measurement: °C
accuracy_decimals: 1
calibration:
b_constant: 3350
reference_resistance: 10kOhm
reference_temperature: 25°C
- id: temperature_sensor_resistance
platform: resistance
sensor: temperature_sensor_voltage
configuration: DOWNSTREAM
resistor: 10kOhm
- id: temperature_sensor_voltage
platform: adc
pin: GPIO3
attenuation: 11db
- platform: bl0942
uart_id: bl0942_uart
line_frequency: 50Hz
voltage:
name: Voltage
id: sensor_voltage
entity_category: diagnostic
current:
id: sensor_current
power:
name: Power
id: sensor_power
frequency:
name: Frequency
id: sensor_frequency
accuracy_decimals: 2
entity_category: diagnostic
energy:
name: Energy
id: sensor_energy
entity_category: diagnostic
device_class: energy
state_class: total_increasing
accuracy_decimals: 3
Sorry, GPIO4 is correct for the button (inverted) and the switch is correct but I was assuming it would detect AC live or DC + whereas in DC mode it needs to be pulled to ground. All working now, thanks for your help. Should I submit a page for the wiki?
All present except the LED, this model doesn’t seem to have an LED visible on the chassis and I can’t see anything shining through the plastic case when creating the light on GPIO0.
Simple gpio switch on 0, doesn’t give any sign of life?
I don’t remember the location, but for Shelly Plus 1 it’s near add-on header, so you see it through the “holes”.
And it’s inverted if I remember well.