Created
November 9, 2023 19:24
-
-
Save dunkelstern/9b2a615243ca38373a858c9ef0127458 to your computer and use it in GitHub Desktop.
NOUS A1T ESPHome template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esphome: | |
name: "nousa1t0" | |
friendly_name: NousA1T0 | |
comment: "Wohnzimmer" | |
project: | |
name: "NOUS.Smart-Wifi-Socket_001" | |
version: "A1T" | |
# | |
# Original Tasmota Template: | |
# {"NAME":"NOUS A1T","GPIO":[32,0,0,0,2720,2656,0,0,2624,320,224,0,0,0],"FLAG":0,"BASE":49} | |
# | |
# Based on: Neo Coolcam (49) | |
# GPIO0: Button (1) | |
# GPIO4: BL937 CF | |
# GPIO5: HLWBL CF1 | |
# GPIO12: HLWBL SEL_i | |
# GPIO13: LED_i (1) | |
# GPIO14: Relay (1) | |
esp8266: | |
board: esp8285 | |
restore_from_flash: false | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
encryption: | |
key: "***" | |
ota: | |
password: "***" | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
manual_ip: | |
static_ip: 10.0.32.10 | |
gateway: 10.0.1.1 | |
subnet: 255.255.0.0 | |
dns1: 10.0.1.1 | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "Nousa1T0 Fallback Hotspot" | |
password: "***" | |
captive_portal: | |
substitutions: | |
devicename: "NOUS A1T 0" | |
# Higher value gives lower watt readout | |
current_res: "0.00280" | |
# Lower value gives lower voltage readout | |
voltage_div: "724" | |
# see: https://esphome.io/components/time.html | |
time: | |
- platform: homeassistant | |
id: homeassistant_time | |
light: | |
- platform: status_led | |
id: led | |
pin: | |
number: GPIO13 | |
inverted: true | |
binary_sensor: | |
- platform: status | |
name: "${devicename} - Status" | |
# toggle relay on/off | |
- platform: gpio | |
pin: | |
number: GPIO00 | |
mode: INPUT_PULLUP | |
id: "button_state" | |
on_press: | |
- switch.toggle: "button_switch" | |
switch: | |
- platform: template | |
name: "${devicename} - Switch" | |
icon: mdi:power | |
optimistic: true | |
restore_mode: RESTORE_DEFAULT_ON | |
id: "button_switch" | |
lambda: |- | |
if (id(relay).state) { | |
return true; | |
} else { | |
return false; | |
} | |
turn_on_action: | |
- switch.turn_on: relay | |
- light.turn_on: led | |
turn_off_action: | |
- switch.turn_off: relay | |
- light.turn_off: led | |
- platform: gpio | |
restore_mode: RESTORE_DEFAULT_ON | |
pin: GPIO14 | |
id: relay | |
sensor: | |
- platform: total_daily_energy | |
name: "${devicename} - Electric Consumption [kWh]" | |
power_id: "nous_a1t_watt" | |
filters: | |
# Multiplication factor from W to kW is 0.001 | |
- multiply: 0.001 | |
unit_of_measurement: kWh | |
icon: mdi:calendar-clock | |
- platform: adc | |
pin: VCC | |
name: "${devicename} - VCC Volt" | |
icon: mdi:flash-outline | |
- platform: hlw8012 | |
sel_pin: | |
number: GPIO12 | |
inverted: True | |
cf_pin: GPIO04 | |
cf1_pin: GPIO05 | |
change_mode_every: 4 | |
current_resistor: ${current_res} | |
voltage_divider: ${voltage_div} | |
update_interval: 3s | |
current: | |
name: "${devicename} - Current" | |
unit_of_measurement: A | |
accuracy_decimals: 3 | |
icon: mdi:current-ac | |
voltage: | |
name: "${devicename} - Voltage" | |
unit_of_measurement: V | |
accuracy_decimals: 1 | |
icon: mdi:flash-outline | |
power: | |
name: "${devicename} - Power" | |
id: "nous_a1t_watt" | |
unit_of_measurement: W | |
icon: mdi:gauge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Attention: If you OTA update the Socket it will turn off for about 100ms on reboot even if
restore_mode
isRESTORE_DEFAULT_ON