rename readings and use impulse output for relays

Begonnen von claudio, 26 Dezember 2021, 16:38:03

Vorheriges Thema - Nächstes Thema

TomLee

I'm not sure what you mean with rename ?

Maybe cmdalias ? Look in commandref and the Wiki

claudio

Zitat von: TomLee am 27 Dezember 2021, 00:19:45
I'm not sure what you mean with rename ?

Maybe cmdalias ? Look in commandref and the Wiki
I have a clickable link named "on-for-timer 0.3" in DeviceOverview, I would like to change it's name like "move the gate" instead. There's no cmdalias in the menu

TomLee

I don't think it is possible to define a command with spaces:

attr Demo eventMap /on-for-timer 0.3:move.the.gate/

claudio

#18
Zitat von: TomLee am 27 Dezember 2021, 00:55:32
I don't think it is possible to define a command with spaces:

attr Demo eventMap /on-for-timer 0.3:move.the.gate/

I meant changing the name of the webCmd

nevermind, I found it

this is the working solution:

Internals:
   DEF        MCP23017_3:PortA3
   DEVICE     MCP23017_3
   FUUID      61c89241-f33f-d74b-28c7-037bd2f9e20dc25f
   NAME       relay_out_1
   NOTIFYDEV  MCP23017_3,global
   NR         152
   NTFY_ORDER 50-relay_out_1
   READING    PortA3
   STATE      off
   TYPE       readingsProxy
   CONTENT:
     MCP23017_3 1
   OLDREADINGS:
   READINGS:
     2021-12-27 01:03:50   lastCmd         off
     2021-12-27 01:03:50   state           off
Attributes:
   alias      Ouvre / Ferme PORTAIL
   devStateIcon .*::noFhemwebLink
   eventMap   /on-for-timer 0.3:actionne/
   group      Alarme
   room       Securite
   setFn      {($CMD eq "on") ? "PortA3 on":"PortA3 off"}
   setList    on off
   webCmd     actionne

TomLee

I understood, and i mean you didn't defined the eventMap and understand what it does.

claudio

Zitat von: TomLee am 27 Dezember 2021, 01:05:22
I understood, and i mean you didn't defined the eventMap and understand what it does.

thanks you very much for your help TomLee!

Beta-User

If you never need the pure "on" but always want to have a pulse sent, I'd recommend to remap the "on" command useing the complex form (see commandref frame, eventMap). Should work like this (untested):
attr relay_out_1 eventMap { usr=>{'on'=>'on-for-timer 0.3'} }
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

claudio

Zitat von: Beta-User am 27 Dezember 2021, 06:03:39
If you never need the pure "on" but always want to have a pulse sent, I'd recommend to remap the "on" command useing the complex form (see commandref frame, eventMap). Should work like this (untested):
attr relay_out_1 eventMap { usr=>{'on'=>'on-for-timer 0.3'} }

Hi !
I do see the point of replacing on by on-for-timer and indeed this is always what I want. But

attr relay_out_1 eventMap { usr=>{'on'=>'on-for-timer 0.3'} }

appear to freeze fhem, messages of deep recursion of subroutine after fhem restarted itself:

2021.12.27 21:47:17.572 1:  PERL WARNING: Deep recursion on subroutine "main::CallFn" at fhem.pl line 5853.
2021.12.27 21:47:17.573 1:  PERL WARNING: Deep recursion on subroutine "main::CallFn" at fhem.pl line 1939.
2021.12.27 21:47:17.573 1:  PERL WARNING: Deep recursion on subroutine "main::AnalyzeCommand" at FHEM/SetExtensions.pm line 39.
2021.12.27 21:47:17.573 1:  PERL WARNING: Deep recursion on subroutine "main::CommandSet" at fhem.pl line 1265.
2021.12.27 21:47:17.574 1:  PERL WARNING: Deep recursion on subroutine "main::DoSet" at fhem.pl line 1971.
2021.12.27 21:47:17.574 1:  PERL WARNING: Deep recursion on subroutine "main::readingsProxy_Set" at fhem.pl line 3890.
2021.12.27 21:47:17.574 1:  PERL WARNING: Deep recursion on subroutine "main::SetExtensions" at ./FHEM/33_readingsProxy.pm line 248.
2021.12.27 21:47:17.574 1:  PERL WARNING: Deep recursion on subroutine "main::SE_DoSet" at FHEM/SetExtensions.pm line 127.
2021.12.27 21:47:49 1:  PERL WARNING: Useless use of private variable in void context at ./FHEM/99_myUtils.pm line 212.

Beta-User

Ups, sorry for that. Then you may have to use a different command to activate the on-for-timer version.

You may do another experiment first with more exact regexp like
attr relay_out_1 eventMap { usr=>{'^on$'=>'on-for-timer 0.3'} }but I'm afraid this won't work either, as SetExtension also internaly uses "on" (and "off) commands to implement on-for-timer etc..
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors