Wie attribute mit at setzen ?

Begonnen von Bäschdler, 17 August 2024, 22:53:24

Vorheriges Thema - Nächstes Thema

Bäschdler

Hallo,

ich möchte mittels at-Befehl den Wert eines Attributes setzen / ändern.

Den at-Befehl mit der Definition "set attr EG_KiZ_Roll ASC_Time_Down_late 19:30" konnte ich anlegen, bekomme in STATE nun aber die Meldun "Wrong timespec set: either HH:MM:SS or {perlcode}". Leider habe ich keine Möglichkeit gefunden, wie FHEM die Definition haben möchte, egal was ich mit modify ändern möchte nimmt FHEM nicht an.

An anderer Stelle habe ich einen DOIF am Laufen der "(attr OG_KiZ_Roll ASC_Time_Up_Early 7:00)" problemlos ausführt.

Was muss ich bei dem at-Befehl eingeben, dass das Attribut entsprechend gesetzt wird?


Danke und Grüsse
Bäschdler

rabehd

Wie wäre es mit einem List Deines at-Devices und EG_KiZ_Roll?

Auch funktionierende Lösungen kann man hinterfragen.

betateilchen

Zitat von: Bäschdler am 17 August 2024, 22:53:24set attr EG_KiZ_Roll ASC_Time_Down_late 19:30

Entweder set oder attr - irgendwas ist da zuviel.
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

Bäschdler

Hier das List vom Rolladen-Device

Internals:
   DEF        7385EA
   FUUID      62dfd1ed-f33f-c344-3ad9-44723ef51489d25a
   IODev      myHmUART
   LASTInputDev myHmUART
   MSGCNT     1
   NAME       OG_KiZ_Roll
   NR         951
   NTFY_ORDER 48-OG_KiZ_Roll
   STATE      off
   TYPE       CUL_HM
   chanNo     01
   disableNotifyFn 1
   eventCount 58
   lastMsg    No:1E - t:10 s:7385EA d:123456 060100004B
   myHmUART_MSGCNT 1
   myHmUART_RAWMSG 050100401EA4107385EA123456060100004B
   myHmUART_RSSI -64
   myHmUART_TIME 2024-08-18 18:33:41
   protLastRcv 2024-08-18 18:33:41
   protRcv    1 last_at:2024-08-18 18:33:41
   protSnd    2 last_at:2024-08-18 18:33:41
   protState  CMDs_done
   rssi_at_myHmUART cnt:1 min:-64 max:-64 avg:-64 lst:-64
   rssi_myHmUART cnt:1 min:-75 max:-75 avg:-75 lst:-75
   READINGS:
     2024-04-08 13:04:13   ASC_Enable      on
     2024-08-18 19:32:46   ASC_ShadingMessage INFO: current shading status is 'out' - next check in 10m
     2024-08-18 18:33:41   ASC_ShuttersLastDrive manual
     2024-08-18 18:32:04   ASC_Time_DriveDown 18.08.2024 - 20:15
     2024-08-18 18:32:04   ASC_Time_DriveUp 19.08.2024 - 09:30
     2024-08-18 18:32:04   ASC_Time_PrivacyDriveDown 18.08.2024 - 20:10
     2024-08-18 08:16:43   CommandAccepted yes
     2024-04-08 13:00:50   D-firmware      2.11
     2024-04-08 13:00:50   D-serialNr      REQ1549534
     2024-08-18 18:33:41   IODev           myHmUART
     2024-04-08 13:07:26   PairedTo        0x123456
     2024-04-08 13:07:26   RegL_00.        00:00 02:01 0A:12 0B:34 0C:56 15:FF 18:00
     2024-04-08 13:07:32   RegL_01.        00:00 08:00 09:00 0A:00 0B:00 0C:F0 0D:00 0E:E6 0F:05 10:00 30:06 56:00 57:24
     2024-08-18 18:32:01   associatedWith  ASC
     2024-04-08 13:07:20   cfgState        updating
     2024-08-18 18:33:41   commState       CMDs_done
     2024-08-18 18:33:41   deviceMsg       off (to VCCU)
     2024-08-18 18:33:41   level           0
     2024-08-18 18:33:41   motor           stop:off
     2024-08-18 19:32:46   myBrightness    173
     2024-08-18 19:32:46   myBrightnessForShadingCloudy 3500
     2024-08-18 19:32:46   myBrightnessForShadingSunny 4000
     2024-08-18 19:32:46   myShadingPASS_GreaterBrightnessSunny False
     2024-08-18 19:32:46   myShadingPASS_GreaterSunAzimuthLeft True
     2024-08-18 19:32:46   myShadingPASS_GreaterSunElevationMin False
     2024-08-18 19:32:46   myShadingPASS_GreaterTemperatureExternMin True
     2024-08-18 19:32:46   myShadingPASS_LowerBrightnessCloudy False
     2024-08-18 19:32:46   myShadingPASS_LowerSunAzimuthRight False
     2024-08-18 19:32:46   myShadingPASS_LowerSunElevationMax True
     2024-08-18 19:32:46   mySunAzimuth    279.5
     2024-08-18 19:32:46   mySunAzimuthLeft 90
     2024-08-18 19:32:46   mySunAzimuthRight 220
     2024-08-18 19:32:46   mySunElevation  9.1
     2024-08-18 19:32:46   mySunElevationForShadingMax 100
     2024-08-18 19:32:46   mySunElevationForShadingMin 15
     2024-08-18 19:32:46   myTemperatureExtern 20
     2024-08-18 19:32:46   myTemperatureExternForShadingMin 15
     2024-08-18 18:33:41   pct             0
     2024-08-18 18:33:41   recentStateType info
     2024-08-18 18:33:41   state           off
     2024-08-18 18:33:41   timedOn         off
     2024-08-18 08:16:43   trigLast        fhem:02
   helper:
     HM_CMDNR   30
     cSnd       ,011234567385EA010E
     lastMsgTm  1723998821.55326
     mId        0005
     peerFriend peerSens,peerVirt
     peerIDsState complete
     peerOpt    3:blindActuator
     regLst     0,1,3p
     rxType     1
     supp_Pair_Rep 0
     cmds:
       TmplKey    :no:1723998722.12001
       TmplTs     1723998722.12001
       cmdKey     1:1:0::OG_KiZ_Roll:0005:01:
       cmdLst:
         assignHmKey noArg
         clear      [({msgErrors}|msgEvents|rssi|attack|trigger|register|oldRegs|readings|all)]
         deviceRename -newName-
         down       'change:'[(0..100;1|{10})] [(-ontime-|{})] [(-ramptime-|{})]
         fwUpdate   -filename- [-bootTime-]
         getConfig  noArg
         getDevInfo noArg
         getRegRaw  (List0|List1|List2|List3|List4|List5|List6|List7) [-peerChn-]
         getVersion noArg
         inhibit    [(on|{off})]
         off        noArg
         on         noArg
         pair       noArg
         pct        -value- [-ontime-]
         peerBulk   -peer1,peer2,...- [({set}|unset)]
         peerIODev  [IO] -btn- [({set}|unset)] 'not for future use'
         press      [(long|{short})] [(-peer-|{self01})] [(-repCount-|{0})] [(-repDelay-|{0.25})]
         raw        -data- [...]
         regBulk    -list-.-peerChn- -addr1:data1- [-addr2:data2-]...
         regSet     [(prep|{exec})] -regName- -value- [-peerChn-]
         reset      noArg
         sign       [(on|{off})]
         statusRequest noArg
         stop       noArg
         toggle     noArg
         toggleDir  noArg
         tplDel     -tplDel-
         unpair     noArg
         up         'change:'[(0..100;1|{10})] [(-ontime-|{})] [(-ramptime-|{})]
       lst:
         condition  slider,0,1,255
         peer       
         peerOpt   
         tplDel     
       rtrvLst:
         cmdList    [({short}|long)]
         deviceInfo [({short}|long)]
         list       [({normal}|full)]
         param      -param-
         reg        -addr- -list- [-peerChn-]
         regList    noArg
         regTable   noArg
         regVal     -addr- -list- [-peerChn-]
         saveConfig [-filename-]
         tplInfo    noArg
     dir:
       cur        stop
     expert:
       def        0
       det        0
       raw        1
       tpl        0
     io:
       flgs       0
       newChn     +7385EA,00,00,00
       nextSend   1723998821.83257
       rxt        0
       vccu       VCCU
       p:
         7385EA
         00
         00
         00
       prefIO:
         myHmUART
     mRssi:
       mNo        1E
       io:
         myHmUART:
           -60
           -60
     peerIDsH:
       00000000   broadcast
     prt:
       bErr       0
       sProc      0
       rspWait:
       tryMsg:
     q:
       qReqConf   
       qReqStat   
     role:
       chn        1
       dev        1
       prs        1
     rpt:
       IO         myHmUART
       flg        A
       ts         1723998821.55326
       ack:
         HASH(0x463b7f8)
         1E80021234567385EA00
     rssi:
       at_myHmUART:
         avg        -64
         cnt        1
         lst        -64
         max        -64
         min        -64
       myHmUART:
         avg        -75
         cnt        1
         lst        -75
         max        -75
         min        -75
     tmpl:
Attributes:
   ASC        2
   ASC_Antifreeze off
   ASC_Antifreeze_Pos 15
   ASC_AutoAstroModeEvening HORIZON
   ASC_AutoAstroModeEveningHorizon -1
   ASC_AutoAstroModeMorning HORIZON
   ASC_AutoAstroModeMorningHorizon -1
   ASC_BlockingTime_afterManual 120
   ASC_BlockingTime_beforeDayOpen 3600
   ASC_BlockingTime_beforeNightClose 3600
   ASC_BrightnessSensor ESPEasy_OG_Wohnzimmer_BH1750_Lux_sued:Lux 5000:10000
   ASC_Closed_Pos 100
   ASC_ComfortOpen_Pos 80
   ASC_Down   astro
   ASC_Drive_Delay -1
   ASC_Drive_DelayStart -1
   ASC_GuestRoom off
   ASC_LockOut off
   ASC_Mode_Down always
   ASC_Mode_Up always
   ASC_Open_Pos 0
   ASC_Partymode off
   ASC_Pos_Reading pct
   ASC_PrivacyDownValue_beforeNightClose 300
   ASC_PrivacyDown_Pos 5
   ASC_Roommate_Device OG_Kinderzimmer
   ASC_Roommate_Reading state
   ASC_Shading_InOutAzimuth 90:220
   ASC_Shading_MinMax_Elevation 15
   ASC_Shading_Min_OutsideTemperature 15
   ASC_Shading_Mode always
   ASC_Shading_Pos 60
   ASC_Shading_StateChange_SunnyCloudy 4000:3500
   ASC_Shading_WaitingPeriod 1200
   ASC_TempSensor ESPEasy_OG_Wohnzimmer_DHT11_outdoor:temperature
   ASC_Time_Down_Early 15:30
   ASC_Time_Down_Late 20:15
   ASC_Time_Up_Early 9:30
   ASC_Time_Up_Late 10:00
   ASC_Time_Up_WE_Holiday 8:30
   ASC_Up     astro
   ASC_Ventilate_Pos 30
   ASC_Ventilate_Window_Open on
   ASC_WiggleValue 5
   ASC_WindowRec_subType twostate
   IOgrp      VCCU:myHmUART
   autoReadReg 4_reqStatus
   devStateIcon off:fts_shutter_10@green on:fts_shutter_100@black 9\d.*:fts_shutter_90@#8b4513 8\d.*:fts_shutter_80@#8b4513 7\d.*:fts_shutter_70@#d2691e 6\d.*:fts_shutter_60@#d2691e 5\d.*:fts_shutter_50@#cd853f 4\d.*:fts_shutter_40@#cd853f 3\d.*:fts_shutter_30@#f4a460 2\d.*:fts_shutter_20@#f4a460 1\d.*:fts_shutter_10@#deb887 1:fts_shutter_10 1.\d.*:fts_shutter_10 2:fts_shutter_10 2.\d.*:fts_shutter_10 3:fts_shutter_10 3.\d.*:fts_shutter_10 4:fts_shutter_10 4.\d.*:fts_shutter_10 5:fts_shutter_10 5.\d.*:fts_shutter_10 6:fts_shutter_10 6.\d.*:fts_shutter_10 7:fts_shutter_10 7.\d.*:fts_shutter_10 8:fts_shutter_10 8.\d.*:fts_shutter_10 9:fts_shutter_10 9.\d.*:fts_shutter_10
   expert     rawReg
   firmware   2.11
   group      Rolladen OG
   model      HM-LC-BL1-FM
   peerIDs    00000000
   room       OG_Rolladen,OG_Rolladen_alle
   serialNr   REQ1549534
   subType    blindActuator
   userReadings myBrightness {ascAPIget('BrightnessAverage',$NAME)},
myBrightnessForShadingCloudy {ascAPIget('ShadingStateChangeCloudy',$NAME)},
myBrightnessForShadingSunny {ascAPIget('ShadingStateChangeSunny',$NAME)},
myTemperatureExtern {ascAPIget('OutTemp',$NAME)},
myTemperatureExternForShadingMin {AttrVal("$NAME", "ASC_Shading_Min_OutsideTemperature","")},
mySunAzimuth {ascAPIget('Azimuth')},
mySunAzimuthLeft {ascAPIget('ShadingAzimuthLeft',$NAME)},
mySunAzimuthRight {ascAPIget('ShadingAzimuthRight',$NAME)},
mySunElevation {ascAPIget('Elevation')},
mySunElevationForShadingMin {ascAPIget('ShadingMinElevation',$NAME)},
mySunElevationForShadingMax {ascAPIget('ShadingMaxElevation',$NAME)},
myShadingPASS_GreaterBrightnessSunny {if (ReadingsNum("$NAME","myBrightness",0) > ReadingsNum("$NAME","myBrightnessForShadingSunny",0)) {"True"} else {"False"}},
myShadingPASS_LowerBrightnessCloudy {if (ReadingsNum("$NAME","myBrightness",0) > ReadingsNum("$NAME","myBrightnessForShadingCloudy",0)) {"True"} else {"False"}},
myShadingPASS_GreaterSunAzimuthLeft {if (ReadingsNum("$NAME","mySunAzimuth",0) > ReadingsNum("$NAME","mySunAzimuthLeft",0)) {"True"} else {"False"}},
myShadingPASS_LowerSunAzimuthRight {if (ReadingsNum("$NAME","mySunAzimuth",0) < ReadingsNum("$NAME","mySunAzimuthRight",0)) {"True"} else {"False"}},
myShadingPASS_GreaterSunElevationMin {if (ReadingsNum("$NAME","mySunElevation",0) > ReadingsNum("$NAME","mySunElevationForShadingMin",0)) {"True"} else {"False"}},
myShadingPASS_LowerSunElevationMax {if (ReadingsNum("$NAME","mySunElevation",0) < ReadingsNum("$NAME","mySunElevationForShadingMax",0)) {"True"} else {"False"}},
myShadingPASS_GreaterTemperatureExternMin {if (ReadingsNum("$NAME","myTemperatureExtern",0) > ReadingsNum("$NAME","myTemperatureExternForShadingMin",0)) {"True"} else {"False"}}
   userattr   ASC_Adv:on,off ASC_Antifreeze:off,soft,hard,am,pm ASC_Antifreeze_Pos:5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100 ASC_AutoAstroModeEvening:REAL,CIVIL,NAUTIC,ASTRONOMIC,HORIZON ASC_AutoAstroModeEveningHorizon:-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9 ASC_AutoAstroModeMorning:REAL,CIVIL,NAUTIC,ASTRONOMIC,HORIZON ASC_AutoAstroModeMorningHorizon:-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9 ASC_BlockingTime_afterManual ASC_BlockingTime_beforeDayOpen ASC_BlockingTime_beforeNightClose ASC_BrightnessSensor ASC_Closed_Pos:0,10,20,30,40,50,60,70,80,90,100 ASC_ComfortOpen_Pos:0,10,20,30,40,50,60,70,80,90,100 ASC_CommandTemplate ASC_Down:time,astro,brightness,roommate ASC_DriveUpMaxDuration ASC_Drive_Delay ASC_Drive_DelayStart ASC_ExternalTrigger ASC_GuestRoom:on,off ASC_LockOut:soft,hard,off ASC_LockOut_Cmd:inhibit,blocked,protection ASC_Mode_Down:absent,always,off,home ASC_Mode_Up:absent,always,off,home ASC_Open_Pos:0,10,20,30,40,50,60,70,80,90,100 ASC_Partymode:on,off ASC_Pos_Reading ASC_PrivacyDownValue_beforeNightClose ASC_PrivacyDown_Pos ASC_PrivacyUpValue_beforeDayOpen ASC_PrivacyUp_Pos ASC_RainProtection:on,off ASC_Roommate_Device ASC_Roommate_Reading ASC_Self_Defense_AbsentDelay ASC_Self_Defense_Mode:absent,gone,off ASC_Shading_BetweenTheTime ASC_Shading_InOutAzimuth ASC_Shading_MinMax_Elevation ASC_Shading_Min_OutsideTemperature ASC_Shading_Mode:absent,always,off,home ASC_Shading_Pos:10,20,30,40,50,60,70,80,90,100 ASC_Shading_StateChange_SunnyCloudy ASC_Shading_WaitingPeriod ASC_Shutter_IdleDetection ASC_ShuttersPlace:window,terrace,awning,EG_window ASC_SlatPosCmd_SlatDevice ASC_Sleep_Pos:0,10,20,30,40,50,60,70,80,90,100 ASC_TempSensor ASC_Time_Down_Early ASC_Time_Down_Late ASC_Time_Up_Early ASC_Time_Up_Late ASC_Time_Up_WE_Holiday ASC_Up:time,astro,brightness,roommate ASC_Ventilate_Pos:10,20,30,40,50,60,70,80,90,100 ASC_Ventilate_Window_Open:on,off ASC_WiggleValue ASC_WindParameters ASC_WindProtection:on,off ASC_WindowRec ASC_WindowRec_PosAfterDayClosed:open,lastManual ASC_WindowRec_subType:twostate,threestate alle_OG_Sued_Roll alle_OG_Sued_Roll_map structexclude
   webCmd     statusRequest:stop:off:10:20:30:40:50:60:70:80:90:on

und hier vom at:

Internals:
   COMMAND    { if ($wday == 7)
{
fhem (" attr OG_KiZ_Roll ASC_Time_Down_late 20:00 ") ;
}
}
   DEF        *15:01:00
{ if ($wday == 7)
{
fhem (" attr OG_KiZ_Roll ASC_Time_Down_late 20:00 ") ;
}
}
   FUUID      66c10ee5-f33f-c344-acf5-774786df4c293564
   NAME       timer_weekly_7_sunday_15_01_KiZ_Down_Late
   NR         956
   PERIODIC   yes
   RELATIVE   no
   REP        -1
   STATE      Next: 15:01:00
   TIMESPEC   15:01:00
   TRIGGERTIME 1724072460
   TRIGGERTIME_FMT 2024-08-19 15:01:00
   TYPE       at
   eventCount 2
   READINGS:
     2024-08-18 19:32:28   state           Next: 15:01:00
Attributes:

tobi01001

Zitat von: Bäschdler am 18 August 2024, 19:35:19ASC_Time_Down_Late 20:15
ist nicht
Zitat von: Bäschdler am 18 August 2024, 19:35:19fhem (" attr OG_KiZ_Roll ASC_Time_Down_late 20:00 ") ;


Außerdem müsste man die Attribut-Änderung ja immer durch ein "save" speichern da sie sonst z.B. einen Neustart nicht überlebt. Hat es einen Grund, warum du die ganzen veränderlichen Werte als Userattribut angelegt hast und z.B. nicht über das Attribut setlist als set-Befehl verfübar machst? Dann ginge im at ein "set OG_KiZ_Roll ASC_Time_Down_Late 20:00"?!
FHEM@UbuntuServer on Lenovo ThinkCentre M900 [i5-6500T / 8GB RAM] MySQL-DbLog, Grafana, FTUI3 / HmIP incl. CCU3 / LGESS / Wärempumpe über TA CMI und CANoE / Shellies u.v.m.

Bäschdler

Ah, das grosse und kleine "L" > Danke.
Habe das jetzt im at geändert, den Wochentag probeweise auf 1 geändert und mit set "execNow" gestartet. Leider wurde das attribut damit noch immer nicht gesetzt.
Dann habe ich die Uhrzeit auf aktuell +2 Minuten gesetzt und die 2 Minuten abgewartet und: voila, es hat funktioniert.

Du meinst die ganzen attribute mit my....? Die sind um in einer anderen Ansicht für eine "Ampelgrafik" um zu sehen welche Bedingungen für die Abschattung erfüllt / nicht erfüllt sind. Habe das aus einem Beispiel hier im Netz übernommen. Kenne mich leider mit der Programmierung nicht so prall aus... ;-(

Danke für die Hilfe und liebe Grüsse
Bäschdler (Ralf)