rename readings and use impulse output for relays

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

Vorheriges Thema - Nächstes Thema

claudio

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

Beta-User

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

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

Beta-User

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.
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

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

TomLee


claudio

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.

TomLee


claudio

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

TomLee

therefore I wrote that it can only be on and off in the list

claudio

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

TomLee

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.

claudio

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

TomLee

#13
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"}

claudio

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!