FHEM Forum

FHEM => English Corner => Thema gestartet von: kroonen am 10 April 2017, 15:34:31

Titel: on-for-timer with mqtt , useSetExtensions?
Beitrag von: kroonen am 10 April 2017, 15:34:31
Hi,

I'm using more mqtt to automate my esp devices. I want als to use to switch my lamp on-for-timer options. Is this possible, or is there another options to set a lamp on for 2 minutes? It's handy when my garage opens. So maybe it works if useSetExtensions is possible with mqtt?

I have this with a sonoff device and the tasmota  fimware

define Garageverlichting MQTT_DEVICE
attr Garageverlichting IODev mqtt
attr Garageverlichting publishSet ON OFF cmnd/Garageverlichting/POWER/set
attr Garageverlichting devStateIcon on:FS20.on off:FS20.off
attr Garageverlichting eventMap ON:on OFF:off
attr Garageverlichting room Garage
attr Garageverlichting setlist ON OFF
attr Garageverlichting stateFormat Garageverlichting
attr Garageverlichting subscribeReading_Garageverlichting stat/Garageverlichting/POWER
attr Garageverlichting webCmd ON:OFF
Titel: Antw:on-for-timer with mqtt , useSetExtensions?
Beitrag von: bugster_de am 19 Juli 2017, 14:10:01
Hi,

I'm doing this on the ESP / Arduino device itself. The device accepts "on", "off" or any integer number to be sent from FHEM. On and off is self explanatory I think and the integer number is the on time in minutes. The Arduino runs a hardware timer with interupt every 1 sek so the integer sent by FHEM translates into 60*integer as counter for the off.

So the "on-for-timer" equivalent is located in the embedded device, which has additional safety benefits: I'm switching valves for water in my case.  FHEM sends a set valve 5 via MQTT and the arduino switches on for 5 minutes. After 5 Minutes the arduino switches off himself but FHEM also sends an off command driven by an at.
Of course overkill for lamps but for water lines inside the house I prefer them to be shut.