Skip to content
This repository has been archived by the owner on Oct 31, 2020. It is now read-only.

Shelly 1PM #96

Open
jonathanadams opened this issue May 2, 2020 · 2 comments
Open

Shelly 1PM #96

jonathanadams opened this issue May 2, 2020 · 2 comments
Labels
missing device Common device that is missing

Comments

@jonathanadams
Copy link
Owner

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

@jonathanadams jonathanadams added the missing device Common device that is missing label May 2, 2020
@XtremeOwnageDotCom
Copy link

XtremeOwnageDotCom commented Jul 2, 2020

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

@jonathanadams
Copy link
Owner Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
missing device Common device that is missing
Projects
None yet
Development

No branches or pull requests

2 participants