esphome-configs icon indicating copy to clipboard operation
esphome-configs copied to clipboard

Shelly 1PM

Open jonathanadams opened this issue 4 years ago • 2 comments

https://shelly.cloud/shelly-1pm-wifi-smart-relay-home-automation/

jonathanadams avatar May 02 '20 00:05 jonathanadams

Here is a partial config from mine. I did get temp sensing working.

Not a clue if it is accurate or not, however, the provided value matches what I would expect. I borrowed the code from somewhere else on the internet.

sensor: 
  - platform: hlw8012
    cf_pin: GPIO05
    cf1_pin: GPIO13 # not used because it is not available on the 1PM but it is needed to compile
    sel_pin: GPIO14 # not used because it is not available on the 1PM but it is needed to compile
    power:
      name: "${name_a} Watts"
      unit_of_measurement: W
      id: "${devicename}_power"
      icon: mdi:flash-circle
      accuracy_decimals: 0
      filters:
      # Map from sensor -> measured value
      - calibrate_linear:
          - 0.0 -> 1.0
          - 110.33186 -> 20.62
          - 131.01909 -> 24.32
          - 341.33920 -> 62.08
          - 5561.41553 -> 1000.0
          - 2975.51221 -> 535.7
          - 9612.66309 -> 1720.0
          - 14891.35352 -> 2679.0      
      # Make everything below 2W appear as just 0W.
      # Furthermore it corrects 1.0W for the power usage of the plug.
      - lambda: if (x < (2 + 1)) return 0; else return (x - 1);
    update_interval: 3s
  # Wifi Signal Sensor
  - platform: wifi_signal
    name: "${devicename} WiFi Signal"
    update_interval: 60s

  # NTC Temperature
  - platform: ntc
    sensor: temp_resistance_reading
    name: ${devicename} Temperature
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    icon: "mdi:thermometer"
    calibration:
      b_constant: 3350
      reference_resistance: 10kOhm
      reference_temperature: 298.15K
    on_value_range:
      - above: 85.0
        then:
          # - light.turn_off: lightid1
          # - fan.turn_off: fanid1
          - homeassistant.event:
              event: esphome.overheat
              data:
                title: ${devicename} has overheated.
  - platform: resistance
    id: temp_resistance_reading
    sensor: temp_analog_reading
    configuration: DOWNSTREAM
    resistor: 32kOhm
  - platform: adc
    id: temp_analog_reading
    pin: A0
binary_sensor:
  # Binary sensor for the button press
  - platform: gpio
    name: button
    pin:
      number: GPIO4
    on_state:
      - switch.toggle: relay
    internal: true
output:
  # Relay state led
  - platform: esp8266_pwm
    id: state_led
    pin:
      number: GPIO00
      inverted: true

XtremeOwnageDotCom avatar Jul 02 '20 02:07 XtremeOwnageDotCom

@XtremeOwnageDotCom do you mind adding a pull request with your config.

jonathanadams avatar Jul 14 '20 19:07 jonathanadams