Created
December 8, 2022 17:56
-
-
Save gretel/85481f811f06dc048d698284f20eccc6 to your computer and use it in GitHub Desktop.
ESPHome on Gosund P1 (and clone clones)
This file contains 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 -s devicename kitchenstrip -s upper_devicename KitchenStrip -s restore_from_flash True run gosund_strip.yaml --device /dev/cu.usbserial-2230 | |
--- | |
substitutions: | |
devicename: 'gosundstrip' | |
upper_devicename: 'GosundStrip' | |
devicecomment: 'https://www.amazon.de/gp/product/B09JVSB9LD?psc=1' | |
logger_level: 'WARN' | |
restore_from_flash: 'False' | |
esp8266: | |
board: esp8285 | |
restore_from_flash: ${restore_from_flash} | |
esphome: | |
name: ${devicename} | |
comment: ${devicecomment} | |
project: | |
name: "jitter.eu" | |
version: "0.4.0" | |
preferences: | |
flash_write_interval: 5min | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_pass | |
domain: !secret domain | |
fast_connect: on | |
ota: | |
logger: | |
baud_rate: 0 | |
level: ${logger_level} | |
# logs: | |
# adc: INFO | |
# web_server: | |
# port: 80 | |
api: | |
encryption: | |
key: !secret gosund_strip_key | |
time: | |
- platform: homeassistant | |
id: homeassistant_time | |
status_led: | |
pin: | |
number: GPIO02 | |
inverted: True | |
uart: | |
tx_pin: GPIO01 | |
rx_pin: GPIO03 | |
baud_rate: 4800 | |
sensor: | |
- platform: uptime | |
name: "${upper_devicename} Uptime" | |
update_interval: 60s | |
icon: "mdi:clock-start" | |
- platform: wifi_signal | |
name: "${upper_devicename} WiFi Signal" | |
update_interval: 15s | |
icon: "mdi:wifi" | |
- platform: cse7766 | |
current: | |
name: "${upper_devicename} Ampere" | |
unit_of_measurement: A | |
accuracy_decimals: 3 | |
icon: mdi:flash-outline | |
voltage: | |
name: "${upper_devicename} Volt" | |
unit_of_measurement: V | |
accuracy_decimals: 1 | |
icon: mdi:flash-outline | |
filters: | |
- lambda: return x * 2.34245; | |
power: | |
name: "${upper_devicename} Watt" | |
unit_of_measurement: W | |
id: "${upper_devicename}_wattage" | |
icon: mdi:flash-outline | |
filters: | |
- lambda: return x * 2.34245; | |
update_interval: 3s | |
- platform: total_daily_energy | |
name: "${upper_devicename} Daily Energy" | |
power_id: "${upper_devicename}_wattage" | |
filters: | |
# multiplication factor for W to kW is 0.001 | |
- multiply: 0.001 | |
unit_of_measurement: kWh | |
icon: mdi:clock-alert | |
- platform: adc | |
pin: GPIO17 | |
id: gpio17 | |
internal: true | |
update_interval: 0.1s | |
filters: | |
- lambda: |- | |
if(x >= 0.60 && x < 0.90){ | |
id(buttonrelay1).publish_state(true); | |
} else if(x >= 0.30 && x < 0.60){ | |
id(buttonrelay2).publish_state(true); | |
} | |
else if(x > 0.10 && x < 0.30){ | |
id(buttonrelay3).publish_state(true); | |
} else { | |
id(buttonrelay1).publish_state(false); | |
id(buttonrelay2).publish_state(false); | |
id(buttonrelay3).publish_state(false); | |
} | |
return{}; | |
binary_sensor: | |
- platform: status | |
name: "${upper_devicename} Status" | |
- platform: gpio | |
id: button | |
internal: true | |
pin: | |
number: GPIO16 | |
mode: INPUT | |
inverted: true | |
filters: | |
- delayed_on: 20ms | |
- delayed_off: 100ms | |
# on_press: | |
# - switch.toggle: relay4 | |
- platform: template | |
id: buttonrelay1 | |
internal: true | |
on_press: | |
- switch.toggle: relay1 | |
filters: | |
- delayed_on: 20ms | |
- delayed_off: 100ms | |
- platform: template | |
id: buttonrelay2 | |
internal: true | |
on_press: | |
- switch.toggle: relay2 | |
filters: | |
- delayed_on: 20ms | |
- delayed_off: 100ms | |
- platform: template | |
id: buttonrelay3 | |
internal: true | |
on_press: | |
- switch.toggle: relay3 | |
filters: | |
- delayed_on: 20ms | |
- delayed_off: 100ms | |
switch: | |
- platform: restart | |
name: "${upper_devicename} Restart" | |
icon: "mdi:restart" | |
- platform: gpio | |
pin: GPIO14 | |
id: relay1 | |
name: '${upper_devicename} Relay 1' | |
icon: mdi:power-socket-eu | |
- platform: gpio | |
pin: GPIO12 | |
id: relay2 | |
name: '${upper_devicename} Relay 2' | |
icon: mdi:power-socket-eu | |
- platform: gpio | |
pin: GPIO13 | |
id: relay3 | |
name: '${upper_devicename} Relay 3' | |
icon: mdi:power-socket-eu | |
- platform: gpio | |
pin: GPIO05 | |
id: relay4 | |
name: '${upper_devicename} Relay USB' | |
icon: mdi:usb | |
inverted: yes | |
text_sensor: | |
- platform: version | |
name: "${upper_devicename} Version" | |
icon: "mdi:exponent-box" | |
- platform: wifi_info | |
ip_address: | |
name: "${upper_devicename} IP Address" | |
icon: "mdi:counter" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment