Home2L - Python API v1.4-2-g83f4c (2025-08-23)
Smart Tools for a Private Home
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
CResource Class Reference

Description

Home2L Resource.

This is the most central class of the library. A 'Resource' may represent
a sensor, an actor, a stored value, a virtual device, a mutex, an event
trigger - almost anything. Resources are identified by a uniform resource
identifier (URI).

Inherits object.

Public Member Functions

 Uri (self)
 
 Gid (self)
 
 Lid (self)
 
 Is (self, *args)
 
 IsLike (self, pattern)
 
 IsWritable (self)
 
 ToStr (self, ret, pathLocal=False)
 
 Type (self)
 
 State (self)
 
 TimeStamp (self)
 
 IsValid (self)
 
 IsBusy (self)
 
 IsKnown (self)
 
 Equals (self, vs2)
 
 ValueEquals (self, vs2)
 
 Subscribe (self, subscr)
 
 Unsubscribe (self, subscr)
 
 GetRequestSet (self, ret, allowNet=True)
 
 GetRequest (self, reqGid, allowNet=True)
 
 WriteValue (self, *args)
 
 UnWrite (self, *args)
 
 SetDefault (self, *args)
 
 Unregister (self)
 
 SetUserData (self, _data)
 
 UserData (self)
 
 ReportValueState (self, _valueState)
 
 ReportTrigger (self)
 
 ReportState (self, _state)
 
 ReportBusy (self)
 
 ReportUnknown (self)
 
 RedriveValue (self, force=True)
 
 PrintInfo (self, *args)
 
 LockLocalSubscribers (self)
 
 GetLocalSubscriber (self, n)
 
 UnlockLocalSubscribers (self)
 
 LockLocalRequests (self)
 
 GetLocalRequest (self, n)
 
 UnlockLocalRequests (self)
 
 ValueState (self)
 
 Value (self)
 
 ValidValue (self, defaultVal)
 
 SetRequest (self, reqDef=None, attrs=None, value=None, id=None, priority=None, t0=None, t1=None, repeat=None, hysteresis=None, delDelay=None)
 
 SetTrigger (self, attrs=None, id=None, priority=None, t0=None, t1=None, repeat=None, hysteresis=None)
 
 DelRequest (self, reqId=None, t1=None)
 
 ReportValue (self, value, state=rcsValid)
 

Static Public Member Functions

 Get (uri, allowWait=False)
 
 GarbageCollection ()
 

Protected Member Functions

 _SetRequestFromObj (self, _request)
 
 _DelRequest (self, *args)
 

Member Function Documentation

◆ Get()

Get (   uri,
  allowWait = False 
)
static
Get(char const * uri, bool allowWait=False) -> CResource

◆ GarbageCollection()

GarbageCollection ( )
static
GarbageCollection()

◆ Uri()

Uri (   self)
Uri(CResource self) -> char const *

◆ Gid()

Gid (   self)
Gid(CResource self) -> char const *

◆ Lid()

Lid (   self)
Lid(CResource self) -> char const *

◆ Is()

Is (   self,
args 
)
    Is(CResource self, char const * uri) -> bool
    Is(CResource self, CResource rc) -> bool

◆ IsLike()

IsLike (   self,
  pattern 
)
IsLike(CResource self, char const * pattern) -> bool

◆ IsWritable()

IsWritable (   self)
IsWritable(CResource self) -> bool

◆ ToStr()

ToStr (   self,
  ret,
  pathLocal = False 
)
ToStr(CResource self, CString * ret, bool pathLocal=False) -> char const

◆ Type()

Type (   self)
Type(CResource self) -> ERcType

◆ State()

State (   self)
State(CResource self) -> ERcState

◆ TimeStamp()

TimeStamp (   self)
TimeStamp(CResource self) -> TTicks

◆ IsValid()

IsValid (   self)
IsValid(CResource self) -> bool

◆ IsBusy()

IsBusy (   self)
IsBusy(CResource self) -> bool

◆ IsKnown()

IsKnown (   self)
IsKnown(CResource self) -> bool

◆ Equals()

Equals (   self,
  vs2 
)
Equals(CResource self, CRcValueState vs2) -> bool

◆ ValueEquals()

ValueEquals (   self,
  vs2 
)
ValueEquals(CResource self, CRcValueState vs2) -> bool

◆ Subscribe()

Subscribe (   self,
  subscr 
)
Subscribe(CResource self, CRcSubscriber subscr) -> CResource

◆ Unsubscribe()

Unsubscribe (   self,
  subscr 
)
Unsubscribe(CResource self, CRcSubscriber subscr)

◆ GetRequestSet()

GetRequestSet (   self,
  ret,
  allowNet = True 
)
GetRequestSet(CResource self, CRcRequestSet * ret, bool allowNet=True) -> bool

◆ GetRequest()

GetRequest (   self,
  reqGid,
  allowNet = True 
)
GetRequest(CResource self, char const * reqGid, bool allowNet=True) -> CRcRequest

◆ WriteValue()

WriteValue (   self,
args 
)
WriteValue(CResource self, CRcValueState value, int priority=-1, char const * reqGid="write")

◆ UnWrite()

UnWrite (   self,
args 
)
UnWrite(CResource self, char const * reqGid="write")

◆ SetDefault()

SetDefault (   self,
args 
)
    SetDefault(CResource self, CRcValueState vs)
    SetDefault(CResource self, bool valBool)
    SetDefault(CResource self, int valInt)
    SetDefault(CResource self, float valFloat)
    SetDefault(CResource self, char const * valString)
    SetDefault(CResource self, TTicks valTime)

◆ Unregister()

Unregister (   self)
Unregister(CResource self)

◆ SetUserData()

SetUserData (   self,
  _data 
)
SetUserData(CResource self, void * _data)

◆ UserData()

UserData (   self)
UserData(CResource self) -> void *

◆ ReportValueState()

ReportValueState (   self,
  _valueState 
)
ReportValueState(CResource self, CRcValueState _valueState)

◆ ReportTrigger()

ReportTrigger (   self)
ReportTrigger(CResource self)

◆ ReportState()

ReportState (   self,
  _state 
)
ReportState(CResource self, ERcState _state)

◆ ReportBusy()

ReportBusy (   self)
ReportBusy(CResource self)

◆ ReportUnknown()

ReportUnknown (   self)
ReportUnknown(CResource self)

◆ RedriveValue()

RedriveValue (   self,
  force = True 
)
RedriveValue(CResource self, bool force=True)

◆ PrintInfo()

PrintInfo (   self,
args 
)
PrintInfo(CResource self, FILE * f=stdout, int verbosity=1, bool allowNet=True)

◆ LockLocalSubscribers()

LockLocalSubscribers (   self)
LockLocalSubscribers(CResource self) -> int

◆ GetLocalSubscriber()

GetLocalSubscriber (   self,
  n 
)
GetLocalSubscriber(CResource self, int n) -> CRcSubscriber

◆ UnlockLocalSubscribers()

UnlockLocalSubscribers (   self)
UnlockLocalSubscribers(CResource self)

◆ LockLocalRequests()

LockLocalRequests (   self)
LockLocalRequests(CResource self) -> int

◆ GetLocalRequest()

GetLocalRequest (   self,
  n 
)
GetLocalRequest(CResource self, int n) -> CRcRequest

◆ UnlockLocalRequests()

UnlockLocalRequests (   self)
UnlockLocalRequests(CResource self)

◆ ValueState()

ValueState (   self)
    ValueState(CResource self) -> CRcValueState
    Get the current value and state of the resource.

◆ _SetRequestFromObj()

_SetRequestFromObj (   self,
  _request 
)
protected
_SetRequestFromObj(CResource self, CRcRequest _request)

◆ _DelRequest()

_DelRequest (   self,
args 
)
protected
_DelRequest(CResource self, char const * reqGid=None, TTicks t1=NEVER)

◆ Value()

Value (   self)
Get a value ('None' if invalid) of this resource (use ValueState() to get the complete value and state).

◆ ValidValue()

ValidValue (   self,
  defaultVal 
)
Get a valid value of this resource (use ValueState() to get the complete value and state).

◆ SetRequest()

SetRequest (   self,
  reqDef = None,
  attrs = None,
  value = None,
  id = None,
  priority = None,
  t0 = None,
  t1 = None,
  repeat = None,
  hysteresis = None,
  delDelay = None 
)
Set or delete a request with selected attributes.

This method allows to set any subset of attributes in a flexible way, either by (named) function arguments
or by a textual description as accepted by the Home2L Shell or CRcRequest::SetFromStr().

If the effective value is 'None' (no value is passed), the call will delete the request with
the specified ID passing 'delDelay' as the 't1' argument of DelRequest().

See RcSetRequest() for a detailed explanation of the arguments and examples.

◆ SetTrigger()

SetTrigger (   self,
  attrs = None,
  id = None,
  priority = None,
  t0 = None,
  t1 = None,
  repeat = None,
  hysteresis = None 
)
Set a request for a trigger resource with selected attributes.

◆ DelRequest()

DelRequest (   self,
  reqId = None,
  t1 = None 
)
Delete a request by its ID.

◆ ReportValue()

ReportValue (   self,
  value,
  state = rcsValid 
)
Report a new value and optionally its state. If '_value == None', 'ReportUnknown()' is called.