Skip to content
ddtlabs edited this page Jan 13, 2017 · 4 revisions

In this example there is a ESP (Sonoff) with:

  • ESP name: 'KE'
  • All ESP devices names are: 'PUMP'
  • Relay value name: 'Relay'
  • Key value name: 'Key'
  • Led value name: 'Led'
  • Sensor delay: '60'

ESP rules:

on PUMP#Key=1 do
  if [PUMP#Relay]=1
    gpio,12,0
  else
    gpio,12,1
  endif
endon
on PUMP#Relay do
  if [PUMP#Relay]=1 
    gpio,13,0
  else
    gpio,13,1
  endif
endon

FHEM settings:

attr KE_PUMP Interval 60
attr KE_PUMP alias Basement pump
attr KE_PUMP devStateIcon on:ios-on-green:off off:ios-off:on absent:10px-kreis-rot:statusRequest .*:ios-NACK:check
attr KE_PUMP eventMap /gpio 12 on:on/gpio 12 off:off/status gpio 12:check/
attr KE_PUMP icon sani_domestic_waterworks
attr KE_PUMP presenceCheck 1
attr KE_PUMP readingSwitchText 1
attr KE_PUMP setState 0
attr KE_PUMP stateFormat {ReadingsVal($name,"presence","") eq "absent" ? "absent" : ReadingsVal($name,"Relay","")}
attr KE_PUMP webCmd :

FHEM page view:

Update

Using the same device name for all devices may lead to unwanted effects. Use unique names and set FHEM ESPEasy attribut combineDevices instead.

Clone this wiki locally