File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,9 @@ available context is limited however to `device_attrs`.
83
83
84
84
### ` password `
85
85
86
- Indicates a password to supply for authentication.
86
+ Indicates a password to supply for authentication. The value is in fact a template that can be customized following the
87
+ rules described in [ Template Notifications] ( https://github.com/qtoggle/qtoggleserver/wiki/Template-Notifications ) . The
88
+ available context is limited however to ` device_attrs ` .
87
89
88
90
* type: ` string `
89
91
* default: ` null `
Original file line number Diff line number Diff line change @@ -84,6 +84,8 @@ def __init__(
84
84
self ._client_id_template : Template = self .make_template (self .client_id )
85
85
if self .username :
86
86
self ._username_template = self .make_template (self .username )
87
+ if self .password :
88
+ self ._password_template = self .make_template (self .password )
87
89
88
90
self .client_logger : logging .Logger = self .logger .getChild ('client' )
89
91
if not self .client_logging :
@@ -109,12 +111,15 @@ async def _client_loop(self) -> None:
109
111
username = None
110
112
if self ._username_template :
111
113
username = await self ._username_template .render_async (template_context )
114
+ password = None
115
+ if self ._password_template :
116
+ password = await self ._password_template .render_async (template_context )
112
117
async with aiomqtt .Client (
113
118
hostname = self .server ,
114
119
port = self .port ,
115
120
tls_context = tls_context ,
116
121
username = username ,
117
- password = self . password ,
122
+ password = password ,
118
123
client_id = client_id ,
119
124
logger = self .client_logger ,
120
125
) as client :
You can’t perform that action at this time.
0 commit comments