Hi guys,
I'm searching a way to rename the individuals readings PortA0 to PortB7 with a more user friendly name because portXX doesn't give any clues. I've have 3 mcp23017 like this, 2 are inputs and 1 is output.
Also, I've haven't found a proper way to make some output ports to act as an impulse (on for 0.2s and then off for exemple), the module doesn't support on-for-timer extension. Any ideas ?
Internals:
DEF 0x22
FUUID 61c4d009-f33f-d74b-7774-db4ad004f44848b6
I2C_Address 34
IODev raspi_i2c_1
NAME MCP23017_3
NR 148
STATE Ok
TYPE I2C_MCP23017
raspi_i2c_1_SENDSTAT Ok
READINGS:
2021-12-26 16:24:36 IODev raspi_i2c_1
2021-12-25 01:46:46 PortA0 off
2021-12-25 01:47:35 PortA1 off
2021-12-25 01:48:12 PortA2 off
2021-12-26 16:05:36 PortA3 off
2021-12-25 01:34:40 PortA4 off
2021-12-25 01:34:54 PortA5 off
2021-12-25 01:35:10 PortA6 off
2021-12-25 01:35:32 PortA7 off
2021-12-25 02:09:15 PortB0 off
2021-12-25 01:50:29 PortB1 off
2021-12-25 01:50:22 PortB2 off
2021-12-25 01:50:34 PortB3 off
2021-12-23 20:37:45 PortB4 off
2021-12-23 20:37:45 PortB5 off
2021-12-23 20:37:45 PortB6 off
2021-12-23 20:37:45 PortB7 off
2021-12-23 20:37:58 state Ok
Attributes:
IODev raspi_i2c_1
OutputPorts A0,A1,A2,A3,A4,A5,A6,A7,B0,B1,B2,B3,B4,B5,B6,B7
alias Sorties RELAIS
room TESTS
suppressReading state
readingsProxy might help.
thanks
I would like to change the readings names of the device itself, moreover, adding a reading proxy doesn't seem to make on-for-timer available
I'm pretty sure rP offers SetExtension functionality, and anyhow it makes handling in FHEM easier when having a seperate device for each switching channel.
I can't seem to setup impulse type for reading proxy, do you have exemples ?
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-26 22:09:16 lastCmd PortA3
2021-12-26 22:09:16 state off
Attributes:
room Securite
setList PortA3:on,off
webCmd PortA3
attr MCP23017_3 setList on off
;)
Zitat von: TomLee am 26 Dezember 2021, 22:19:44
attr MCP23017_3 setList on off
;)
there is no setlist in attributes menu for MCP23017_3 of type I2C_MCP23017
MCP23017_3: unknown attribute setList. Type 'attr MCP23017_3 ?' for a detailed list.
sry
attr relay_out_1 setList on off
Zitat von: TomLee am 26 Dezember 2021, 22:43:21
sry
attr relay_out_1 setList on off
I already have it in the attributes of reading proxy :
setList PortA3:on,off
the relay is actionned but I can't use on-for-timer. I just want to click one time and the relay should do ON then OFF
therefore I wrote that it can only be on and off in the list
Zitat von: TomLee am 26 Dezember 2021, 23:04:11
therefore I wrote that it can only be on and off in the list
yep, as written in the first post, I'm looking for a way to activate the relay in "impulse mode", on then off automatically after a defined timeout
I think we're still talking past each other. Have you just tried on and off in the setList? The setextensions are only active if these two setters also appear in the list.Then on-for-timer is also available in the selection list.
Zitat von: TomLee am 26 Dezember 2021, 23:22:29
I think we're still talking past each other. Have you just tried on and off in the setList? The setextensions are only active if these two setters also appear in the list.Then on-for-timer is also available in the selection list.
yes,
if I only put on off in setlist, I can't activate the relay:
Unknown argument on, choose one of PortA0:off,on PortA1:off,on PortA2:off,on PortA3:off,on PortA4:off,on PortA5:off,on PortA6:off,on PortA7:off,on PortB0:off,on PortB1:off,on PortB2:off,on PortB3:off,on PortB4:off,on PortB5:off,on PortB6:off,on PortB7:off,on
list relay_out_1 :
Internals:
DEF MCP23017_3:PortA3
DEVICE MCP23017_3
FUUID 61c89241-f33f-d74b-28c7-037bd2f9e20dc25f
NAME relay_out_1
NOTIFYDEV global,MCP23017_3
NR 152
NTFY_ORDER 50-relay_out_1
READING PortA3
STATE off
TYPE readingsProxy
CONTENT:
MCP23017_3 1
OLDREADINGS:
READINGS:
2021-12-26 23:33:26 lastCmd on
2021-12-26 22:48:54 state off
Attributes:
devStateIcon on:ios-on-green off:ios-off
group Alarme
room Securite
setList on off
attr relay_out_1 setFn { return 'PortA3 on' if( $CMD eq 'on' );return 'PortA3 off' if( $CMD eq 'off' )}
?
edit:
a little shorter:
{($CMD eq "on")?"PortA3 1 on":"PortA3 1 off"}
Zitat von: TomLee am 26 Dezember 2021, 23:47:00
attr relay_out_1 setFn { return 'PortA3 on' if( $CMD eq 'on' );return 'PortA3 off' if( $CMD eq 'off' )}
?
edit:
a little shorter:
{($CMD eq "on")?"PortA3 1 on":"PortA3 1 off"}
thats pretty much it!
except the 1's in the second
now, how do I create a command "set relay_out_1 on-for-timer 0.3" with a friendly name in the GUI ?
I've added
attr relay_out_1 webCmd on-for-timer 0.3
but How do I change the name ?
Thanks you very much!
I'm not sure what you mean with rename ?
Maybe cmdalias ? Look in commandref and the Wiki (https://wiki.fhem.de/wiki/Cmdalias)
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 (https://wiki.fhem.de/wiki/Cmdalias)
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
I don't think it is possible to define a command with spaces:
attr Demo eventMap /on-for-timer 0.3:move.the.gate/
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
I understood, and i mean you didn't defined the eventMap and understand what it does.
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!
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'} }
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.
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..