Skip to content

Instantly share code, notes, and snippets.

@boozeman
Last active February 19, 2024 11:33
Show Gist options
  • Save boozeman/d7c5499fdc59ba0cf7b1fa9e42b7f534 to your computer and use it in GitHub Desktop.
Save boozeman/d7c5499fdc59ba0cf7b1fa9e42b7f534 to your computer and use it in GitHub Desktop.
ESPHome Configuration for Nedis WIFIP121FWT
esphome:
name: nedis-esp-004
substitutions:
device_name: nedis_esp_004
friendly_name: Nedis ESP 004
# Nedis WIFIPO121FWT with bk7231N
# Nedis WIFIPO120FWT with bk7231N chip has markings "10T40 and µ" on it's label
# Nedis WIFIPO120FWT with bk7231T chip has no those markings on it's label
# Create HA input Helper (example 0-7200 seconds) with device friendly_name for pulsetime Function
# DISCLAIMER: The Rear Lights Warranty is on. Use at your own risk!
bk72xx:
board: generic-bk7231n-qfn32-tuya
logger:
web_server:
captive_portal:
ota:
password: !secret ota_password
mdns:
api:
encryption:
key: "Generate API-key: https://esphome.io/components/api.html?highlight=randomly%20generated"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "${friendly_name} Fallback Hotspot"
password: !secret ap_password
text_sensor:
- platform: libretiny
version:
name: ${device_name} LibreTiny Version
binary_sensor:
- platform: gpio
id: ${device_name}_binary_switch_1
pin:
number: P7
inverted: false
mode: INPUT_PULLUP
on_press:
then:
- switch.toggle: ${device_name}_switch_1
switch:
- platform: gpio
id: ${device_name}_switch_1
name: ${friendly_name} Relay 1
pin: P8
on_turn_on:
- light.turn_on: ${device_name}_red_light_status
- script.execute: pulsetime # Initialize pulsetime script
on_turn_off:
- light.turn_off: ${device_name}_red_light_status
- script.stop: pulsetime # Initialize pulsetime script
light:
- platform: status_led
id: ${device_name}_blue_light_status
pin:
number: P10
inverted: false
- platform: status_led
id: ${device_name}_red_light_status
pin:
number: P6
inverted: false
sensor:
- platform: hlw8012
model: BL0937
cf_pin:
number: P26
inverted: true
cf1_pin:
number: P24
inverted: true
sel_pin:
number: P11
inverted: true
current:
name: ${friendly_name} Current
id: ${device_name}_current
voltage:
name: ${friendly_name} Voltage
id: ${device_name}_voltage
filters:
# Map from sensor -> measured value
- calibrate_linear:
- 0.0 -> 0.0
- 579.0 -> 235.7
power:
name: ${friendly_name} Power
id: ${device_name}_power
filters:
- calibrate_linear:
- 0.0 -> 0.0
- 717.11688 -> 265.8
energy:
name: ${friendly_name} Energy
id: ${device_name}_energy
voltage_divider: 1881 # 4 * 470K resistors upstream and 1k resistor downstream for voltage divider (4 x 470 000 + 1000) / 1000
current_resistor: 0.001 ohm
update_interval: 60s
# Example configuration entry with 2 sensors and filter
- platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
name: "${friendly_name} WiFi Signal dB"
id: ${device_name}_wifi_signal_db
update_interval: 60s
entity_category: "diagnostic"
# Input helper as sensor for pulsetime script
- platform: homeassistant
name: "${friendly_name} Pulsetime"
id: ${device_name}_pulsetime
entity_id: input_number.${device_name}_pulsetime #The entity of input_number in HA
# Tasmota like pulsetime script
script:
- id: pulsetime
then:
- if:
condition:
lambda: 'return id(${device_name}_pulsetime).state > 0;'
then:
- delay: !lambda |-
return id(${device_name}_pulsetime).state * 1000;
- switch.turn_off: ${device_name}_switch_1
@ChristianRonningen
Copy link

Yes, noticed that after getting readings of 550volt.
Used a cheap "kill-a-watt" and this https://esphome.io/components/sensor/hlw8012.html#hlw8012-power-sensor wedsite, so if anyone find this in the future then know where to look for help on that too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment