Skip to content

Instantly share code, notes, and snippets.

@xirixiz
Last active January 9, 2022 22:07
Show Gist options
  • Save xirixiz/a3ac757bd671dbdb37cf8769d95a80f9 to your computer and use it in GitHub Desktop.
Save xirixiz/a3ac757bd671dbdb37cf8769d95a80f9 to your computer and use it in GitHub Desktop.
ESP Home - Mertik Maxcontrol - HASS - Home Assistant - Bellfires
ESPeasy rules
//GIO14 == Relay 1 = blauw
//GPIO12 == Relay 2 = geel
//GPIO13 == Relay 3 = oranje
on IGNITION do
// Close relays contacts
gpio,14,1
gpio,13,1
timerSet 1,1 // 1 second delay
Publish,/fireplace/status,event,IGNITION
endon
On Rules#Timer=1 do
///Open relays contacts
gpio,14,0
gpio,12,0
gpio,13,0
endon
on FIRE_OFF do
// Close relays contacts
gpio,14,1
gpio,12,1
gpio,13,1
timerSet 1,1 // 1 second delay
Publish,/fireplace/status,event,FIRE_OFF
endon
on SECONDBURNER_ON do
// Close relays contacts
gpio,14,1
gpio,12,1
timerSet 1,1 // 1 second delay
Publish,/fireplace/status/centerfire,event,SECONDBURNER_ON
endon
on SECONDBURNER_OFF do
// Close relays contacts
gpio,12,1
gpio,13,1
timerSet 1,1 // 1 second delay
Publish,/fireplace/status/centerfire,event,SECONDBURNER_OFF
endon
on INCREASE_FIRE do
// Close relays contacts
gpio,14,1
timerSet 1,3 // 1 second delay
endon
on DECREASE_FIRE do
// Close relays contacts
gpio,13,1
timerSet 1,3 // 1 second delay
endon
esphome:
name: fireplace
esp8266:
board: nodemcuv2
substitutions:
devicename: Fireplace
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
domain: .skynet.local
manual_ip:
static_ip: x.x.x.x
gateway: x.x.x.x
subnet: x.x.x.x
ap:
ssid: "${devicename} - ESP fallback hotspot"
password: !secret ota_wifi_password
captive_portal:
logger:
api:
password: !secret ota_wifi_password
ota:
password: !secret ota_wifi_password
web_server:
port: 80
time:
- platform: homeassistant
id: homeassistant_time
text_sensor:
- platform: version
name: "${devicename} - ESPHome version"
- platform: wifi_info
ip_address:
name: "${devicename} - IP"
ssid:
name: "${devicename} - SSID"
bssid:
name: "${devicename} - BSSID"
sensor:
- platform: uptime
name: "${devicename} - Uptime"
- platform: wifi_signal
name: "${devicename} - WiFi signal"
update_interval: 60s
switch:
- platform: restart
name: "${devicename} - ESP reboot"
- platform: gpio
name: "${devicename} - Power button"
pin: GPIO12 #D6
id: POWER
on_turn_on:
- delay: 2s
- switch.turn_off: POWER
- platform: gpio
name: "${devicename} - Increase flame"
pin: GPIO13 #D7
id: INCREASE
interlock: [DECREASE]
- platform: gpio
name: "${devicename} - Decrease flame"
pin: GPIO14 #D5
id: DECREASE
interlock: [INCREASE]
- platform: gpio
name: "${devicename} - Dummy"
pin: GPIO15 #D8
id: DUMMY
restore_mode: RESTORE_DEFAULT_ON
- platform: template
name: "${devicename} - On/Off"
id: fireplace
#lambda: 'return id(DUMMY).state;'
turn_on_action:
if:
condition:
switch.is_off:
id: fireplace
then:
- switch.template.publish:
id: fireplace
state: ON
- switch.turn_off: INCREASE
- switch.turn_off: POWER
- switch.turn_off: DECREASE
- delay: 15s
- switch.turn_on: POWER
- delay: 500ms
- switch.turn_on: INCREASE
- delay: 3s
- switch.turn_off: INCREASE
- switch.turn_off: POWER
- delay: 60s
- switch.template.publish:
id: fireplace_burner_limit
state: ON
- switch.turn_on: DECREASE
- delay: 100ms
- switch.turn_on: POWER
- delay: 2s
- switch.turn_off: INCREASE
- switch.turn_off: POWER
- switch.turn_off: DECREASE
- switch.template.publish:
id: fireplace_cosy
state: ON
- switch.turn_on: DECREASE
- delay: 15s
- switch.turn_on: INCREASE
- delay: 5s
- switch.turn_off: INCREASE
turn_off_action:
if:
condition:
switch.is_on:
id: fireplace
then:
- switch.template.publish:
id: fireplace
state: OFF
- switch.template.publish:
id: fireplace_burner_limit
state: OFF
- switch.turn_on: POWER
- delay: 3s
- switch.turn_off: POWER
- switch.turn_off: INCREASE
- switch.turn_off: DECREASE
- platform: template
name: "${devicename} - Limit burner"
id: fireplace_burner_limit
#lambda: 'return id(DUMMY).state;'
turn_on_action:
if:
condition:
switch.is_on:
id: fireplace
then:
- switch.template.publish:
id: fireplace_burner_limit
state: ON
- switch.turn_on: DECREASE
- delay: 100ms
- switch.turn_on: POWER
- delay: 2s
- switch.turn_off: INCREASE
- switch.turn_off: POWER
- switch.turn_off: DECREASE
turn_off_action:
if:
condition:
switch.is_on:
id: fireplace
then:
- switch.template.publish:
id: fireplace_burner_limit
state: OFF
- switch.turn_on: INCREASE
- delay: 100ms
- switch.turn_on: POWER
- delay: 2s
- switch.turn_off: INCREASE
- switch.turn_off: POWER
- switch.turn_off: DECREASE
- platform: template
name: "${devicename} - Cosy"
id: fireplace_cosy
turn_on_action:
if:
condition:
switch.is_on:
id: fireplace
then:
- switch.template.publish:
id: fireplace_cosy
state: ON
- switch.turn_on: DECREASE
- delay: 15s
- switch.turn_on: INCREASE
- delay: 5s
- switch.turn_off: INCREASE
turn_off_action:
if:
condition:
switch.is_on:
id: fireplace
then:
- switch.template.publish:
id: fireplace_cosy
state: OFF
- switch.turn_on: DECREASE
- delay: 15s
- switch.turn_off: DECREASE
- platform: template
name: "${devicename} - Cosy plus"
id: fireplace_cosy_plus
turn_on_action:
if:
condition:
switch.is_on:
id: fireplace
then:
- switch.template.publish:
id: fireplace_cosy_plus
state: ON
- switch.turn_on: DECREASE
- delay: 15s
- switch.turn_on: INCREASE
- delay: 7s
- switch.turn_off: INCREASE
turn_off_action:
if:
condition:
switch.is_on:
id: fireplace
then:
- switch.template.publish:
id: fireplace_cosy_plus
state: OFF
- switch.turn_on: DECREASE
- delay: 15s
- switch.turn_off: DECREASE
- platform: template
name: "${devicename} - Pilot"
id: fireplace_pilot
turn_on_action:
if:
condition:
switch.is_on:
id: fireplace
then:
- switch.template.publish:
id: fireplace_pilot
state: ON
- switch.turn_on: DECREASE
- delay: 15s
- switch.template.publish:
id: fireplace_pilot
state: OFF
- switch.turn_off: DECREASE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment