From 83ef10bc7e07de1fd4e1bf241286aca6f99c75c1 Mon Sep 17 00:00:00 2001 From: <> Date: Mon, 26 Aug 2024 17:00:38 +0000 Subject: [PATCH] Deployed 8d88439 with MkDocs version: 1.6.0 --- .nojekyll | 0 404.html | 370 + api_docs/index.html | 12201 ++++++++++++++++ assets/_mkdocstrings.css | 119 + assets/images/favicon.png | Bin 0 -> 1870 bytes assets/javascripts/bundle.af256bd8.min.js | 29 + assets/javascripts/bundle.af256bd8.min.js.map | 7 + assets/javascripts/lunr/min/lunr.ar.min.js | 1 + assets/javascripts/lunr/min/lunr.da.min.js | 18 + assets/javascripts/lunr/min/lunr.de.min.js | 18 + assets/javascripts/lunr/min/lunr.du.min.js | 18 + assets/javascripts/lunr/min/lunr.el.min.js | 1 + assets/javascripts/lunr/min/lunr.es.min.js | 18 + assets/javascripts/lunr/min/lunr.fi.min.js | 18 + assets/javascripts/lunr/min/lunr.fr.min.js | 18 + assets/javascripts/lunr/min/lunr.he.min.js | 1 + assets/javascripts/lunr/min/lunr.hi.min.js | 1 + assets/javascripts/lunr/min/lunr.hu.min.js | 18 + assets/javascripts/lunr/min/lunr.hy.min.js | 1 + assets/javascripts/lunr/min/lunr.it.min.js | 18 + assets/javascripts/lunr/min/lunr.ja.min.js | 1 + assets/javascripts/lunr/min/lunr.jp.min.js | 1 + assets/javascripts/lunr/min/lunr.kn.min.js | 1 + assets/javascripts/lunr/min/lunr.ko.min.js | 1 + assets/javascripts/lunr/min/lunr.multi.min.js | 1 + assets/javascripts/lunr/min/lunr.nl.min.js | 18 + assets/javascripts/lunr/min/lunr.no.min.js | 18 + assets/javascripts/lunr/min/lunr.pt.min.js | 18 + assets/javascripts/lunr/min/lunr.ro.min.js | 18 + assets/javascripts/lunr/min/lunr.ru.min.js | 18 + assets/javascripts/lunr/min/lunr.sa.min.js | 1 + .../lunr/min/lunr.stemmer.support.min.js | 1 + assets/javascripts/lunr/min/lunr.sv.min.js | 18 + assets/javascripts/lunr/min/lunr.ta.min.js | 1 + assets/javascripts/lunr/min/lunr.te.min.js | 1 + assets/javascripts/lunr/min/lunr.th.min.js | 1 + assets/javascripts/lunr/min/lunr.tr.min.js | 18 + assets/javascripts/lunr/min/lunr.vi.min.js | 1 + assets/javascripts/lunr/min/lunr.zh.min.js | 1 + assets/javascripts/lunr/tinyseg.js | 206 + assets/javascripts/lunr/wordcut.js | 6708 +++++++++ .../workers/search.b8dbb3d2.min.js | 42 + .../workers/search.b8dbb3d2.min.js.map | 7 + assets/stylesheets/main.3cba04c6.min.css | 1 + assets/stylesheets/main.3cba04c6.min.css.map | 1 + assets/stylesheets/palette.06af60db.min.css | 1 + .../stylesheets/palette.06af60db.min.css.map | 1 + changelog/index.html | 1211 ++ index.html | 621 + objects.inv | 7 + search/search_index.json | 1 + sitemap.xml | 3 + sitemap.xml.gz | Bin 0 -> 127 bytes 53 files changed, 21823 insertions(+) create mode 100644 .nojekyll create mode 100644 404.html create mode 100644 api_docs/index.html create mode 100644 assets/_mkdocstrings.css create mode 100644 assets/images/favicon.png create mode 100644 assets/javascripts/bundle.af256bd8.min.js create mode 100644 assets/javascripts/bundle.af256bd8.min.js.map create mode 100644 assets/javascripts/lunr/min/lunr.ar.min.js create mode 100644 assets/javascripts/lunr/min/lunr.da.min.js create mode 100644 assets/javascripts/lunr/min/lunr.de.min.js create mode 100644 assets/javascripts/lunr/min/lunr.du.min.js create mode 100644 assets/javascripts/lunr/min/lunr.el.min.js create mode 100644 assets/javascripts/lunr/min/lunr.es.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.fr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.he.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hu.min.js create mode 100644 assets/javascripts/lunr/min/lunr.hy.min.js create mode 100644 assets/javascripts/lunr/min/lunr.it.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ja.min.js create mode 100644 assets/javascripts/lunr/min/lunr.jp.min.js create mode 100644 assets/javascripts/lunr/min/lunr.kn.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ko.min.js create mode 100644 assets/javascripts/lunr/min/lunr.multi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.nl.min.js create mode 100644 assets/javascripts/lunr/min/lunr.no.min.js create mode 100644 assets/javascripts/lunr/min/lunr.pt.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ro.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ru.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sa.min.js create mode 100644 assets/javascripts/lunr/min/lunr.stemmer.support.min.js create mode 100644 assets/javascripts/lunr/min/lunr.sv.min.js create mode 100644 assets/javascripts/lunr/min/lunr.ta.min.js create mode 100644 assets/javascripts/lunr/min/lunr.te.min.js create mode 100644 assets/javascripts/lunr/min/lunr.th.min.js create mode 100644 assets/javascripts/lunr/min/lunr.tr.min.js create mode 100644 assets/javascripts/lunr/min/lunr.vi.min.js create mode 100644 assets/javascripts/lunr/min/lunr.zh.min.js create mode 100644 assets/javascripts/lunr/tinyseg.js create mode 100644 assets/javascripts/lunr/wordcut.js create mode 100644 assets/javascripts/workers/search.b8dbb3d2.min.js create mode 100644 assets/javascripts/workers/search.b8dbb3d2.min.js.map create mode 100644 assets/stylesheets/main.3cba04c6.min.css create mode 100644 assets/stylesheets/main.3cba04c6.min.css.map create mode 100644 assets/stylesheets/palette.06af60db.min.css create mode 100644 assets/stylesheets/palette.06af60db.min.css.map create mode 100644 changelog/index.html create mode 100644 index.html create mode 100644 objects.inv create mode 100644 search/search_index.json create mode 100644 sitemap.xml create mode 100644 sitemap.xml.gz diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..978ebba --- /dev/null +++ b/404.html @@ -0,0 +1,370 @@ + + + +
+ + + + + + + + + + + + + + +The Nice G.O. API client for Python.
+To start, see the NiceGOApi
class.
ApiError
+
+
+
+ Bases: NiceGOError
API error.
+ + + +AuthFailedError
+
+
+
+ Bases: NiceGOError
Authentication failed. Check your credentials.
+ + + +Barrier
+
+
+
+ dataclass
+
+
+Class representing a barrier.
+ + +Attributes:
+Name | +Type | +Description | +
---|---|---|
id |
+
+ str
+ |
+
+
+
+ The ID of the barrier. + |
+
type |
+
+ str
+ |
+
+
+
+ The type of the barrier. + |
+
controlLevel |
+
+ str
+ |
+
+
+
+ The control level of the barrier. + |
+
attr |
+
+ list[dict[str, str]]
+ |
+
+
+
+ A list of attributes of the barrier. + |
+
state |
+
+ BarrierState
+ |
+
+
+
+ The state of the barrier. + |
+
api |
+
+ NiceGOApi
+ |
+
+
+
+ The NiceGO API object. + |
+
Methods:
+Name | +Description | +
---|---|
open |
+
+
+
+ Open the barrier. + |
+
close |
+
+
+
+ Close the barrier. + |
+
light_on |
+
+
+
+ Turn on the light of the barrier. + |
+
light_off |
+
+
+
+ Turn off the light of the barrier. + |
+
get_attr |
+
+
+
+ Get the value of an attribute. + |
+
src/nice_go/_barrier.py
62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 |
|
close() -> bool
+
+
+ async
+
+
+Close the barrier.
+ + +Returns:
+Type | +Description | +
---|---|
+ bool
+ |
+
+
+
+ A boolean indicating whether the command was successful. + |
+
get_attr(key: str) -> str
+
+
+ async
+
+
+Get the value of an attribute.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
key |
+
+ str
+ |
+
+
+
+ The key of the attribute. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ str
+ |
+
+
+
+ The value of the attribute. + |
+
Raises:
+Type | +Description | +
---|---|
+ KeyError
+ |
+
+
+
+ If the attribute with the given key is not found. + |
+
src/nice_go/_barrier.py
light_off() -> bool
+
+
+ async
+
+
+Turn off the light of the barrier.
+ + +Returns:
+Type | +Description | +
---|---|
+ bool
+ |
+
+
+
+ A boolean indicating whether the command was successful. + |
+
light_on() -> bool
+
+
+ async
+
+
+Turn on the light of the barrier.
+ + +Returns:
+Type | +Description | +
---|---|
+ bool
+ |
+
+
+
+ A boolean indicating whether the command was successful. + |
+
open() -> bool
+
+
+ async
+
+
+Open the barrier.
+ + +Returns:
+Type | +Description | +
---|---|
+ bool
+ |
+
+
+
+ A boolean indicating whether the command was successful. + |
+
vacation_mode_off() -> None
+
+
+ async
+
+
+vacation_mode_on() -> None
+
+
+ async
+
+
+BarrierState
+
+
+
+ dataclass
+
+
+Class representing the state of a barrier.
+ + +Attributes:
+Name | +Type | +Description | +
---|---|---|
deviceId |
+
+ str
+ |
+
+
+
+ The device ID of the barrier. + |
+
desired |
+
+ dict[str, Any]
+ |
+
+
+
+ The desired state of the barrier. + |
+
reported |
+
+ dict[str, Any]
+ |
+
+
+
+ The reported state of the barrier. + |
+
timestamp |
+
+ str
+ |
+
+
+
+ The timestamp of the last update. + |
+
version |
+
+ str
+ |
+
+
+
+ The version of the barrier. + |
+
connectionState |
+
+ ConnectionState | None
+ |
+
+
+
+ The connection state of the barrier. + |
+
src/nice_go/_barrier.py
ConnectionState
+
+
+
+ dataclass
+
+
+Class representing the connection state of a barrier.
+ + +Attributes:
+Name | +Type | +Description | +
---|---|---|
connected |
+
+ bool
+ |
+
+
+
+ A boolean indicating whether the barrier is connected. + |
+
updatedTimestamp |
+
+ datetime
+ |
+
+
+
+ The timestamp of the last update. + |
+
src/nice_go/_barrier.py
NiceGOApi
+
+
+A class to interact with the Nice G.O. API.
+This class provides methods to authenticate, connect to the WebSocket API, +and interact with barriers.
+ + +Attributes:
+Name | +Type | +Description | +
---|---|---|
id_token |
+
+ str | None
+ |
+
+
+
+ The ID token. + |
+
Methods:
+Name | +Description | +
---|---|
event |
+
+
+
+ Decorator to add an event listener. + |
+
authenticate_refresh |
+
+
+
+ Authenticate using a refresh token. + |
+
authenticate |
+
+
+
+ Authenticate using username and password. + |
+
connect |
+
+
+
+ Connect to the WebSocket API. + |
+
subscribe |
+
+
+
+ Subscribe to a receiver. + |
+
unsubscribe |
+
+
+
+ Unsubscribe from a receiver. + |
+
close |
+
+
+
+ Close the connection. + |
+
get_all_barriers |
+
+
+
+ Get all barriers. + |
+
src/nice_go/nice_go_api.py
46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612 +613 +614 +615 +616 +617 +618 +619 +620 +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631 +632 +633 +634 +635 +636 +637 +638 +639 +640 +641 +642 +643 +644 +645 +646 +647 +648 +649 +650 +651 +652 +653 +654 +655 +656 +657 +658 +659 +660 +661 +662 +663 +664 +665 +666 +667 +668 +669 +670 +671 +672 +673 +674 +675 +676 +677 +678 +679 +680 +681 +682 +683 +684 +685 +686 +687 +688 +689 +690 +691 +692 +693 +694 +695 +696 +697 +698 +699 +700 +701 +702 +703 +704 +705 +706 +707 +708 +709 +710 +711 +712 +713 +714 +715 +716 +717 +718 +719 +720 +721 +722 +723 +724 +725 +726 +727 +728 +729 +730 +731 +732 +733 +734 +735 +736 +737 +738 +739 +740 +741 +742 +743 +744 +745 +746 +747 +748 +749 +750 +751 +752 +753 +754 +755 +756 +757 +758 +759 +760 +761 +762 +763 +764 +765 +766 +767 +768 +769 +770 +771 +772 +773 +774 +775 +776 +777 +778 +779 +780 +781 +782 +783 +784 +785 +786 +787 +788 +789 +790 +791 +792 +793 +794 +795 +796 +797 +798 +799 +800 +801 +802 +803 +804 +805 +806 +807 +808 +809 +810 +811 +812 +813 +814 +815 +816 +817 +818 +819 +820 +821 |
|
closed: bool
+
+
+ property
+
+
+Check if the connection is closed.
+__authenticate(user_name: str | None, password: str | None, refresh_token: str | None) -> str | None
+
+
+ async
+
+
+Authenticate using username and password or refresh token.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
user_name |
+
+ str | None
+ |
+
+
+
+ The username. + |
+ + required + | +
password |
+
+ str | None
+ |
+
+
+
+ The password. + |
+ + required + | +
refresh_token |
+
+ str | None
+ |
+
+
+
+ The refresh token. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ str | None
+ |
+
+
+
+ The refresh token. + |
+
Raises:
+Type | +Description | +
---|---|
+ AuthFailedError
+ |
+
+
+
+ If the authentication fails. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 |
|
__init__() -> None
+
+Initialize the NiceGOApi object.
+ +src/nice_go/nice_go_api.py
authenticate(user_name: str, password: str, session: aiohttp.ClientSession) -> str | None
+
+
+ async
+
+
+Authenticate using username and password.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
user_name |
+
+ str
+ |
+
+
+
+ The username. + |
+ + required + | +
password |
+
+ str
+ |
+
+
+
+ The password. + |
+ + required + | +
session |
+
+ ClientSession
+ |
+
+
+
+ The client session to use. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ str | None
+ |
+
+
+
+ The refresh token. + |
+
Raises:
+Type | +Description | +
---|---|
+ AuthFailedError
+ |
+
+
+
+ If the authentication fails. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
authenticate_refresh(refresh_token: str, session: aiohttp.ClientSession) -> None
+
+
+ async
+
+
+Authenticate using a previous obtained refresh token.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
refresh_token |
+
+ str
+ |
+
+
+
+ The refresh token. + |
+ + required + | +
session |
+
+ ClientSession
+ |
+
+
+
+ The client session to use. + |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ AuthFailedError
+ |
+
+
+
+ If the authentication fails. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
close() -> None
+
+
+ async
+
+
+Close the connection.
+ + +Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
src/nice_go/nice_go_api.py
close_barrier(barrier_id: str) -> bool
+
+
+ async
+
+
+Close a barrier.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
barrier_id |
+
+ str
+ |
+
+
+
+ The ID of the barrier to close. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ bool
+ |
+
+
+
+ Whether the barrier was closed successfully. + |
+
src/nice_go/nice_go_api.py
connect(*, reconnect: bool = True) -> None
+
+
+ async
+
+
+Connect to the WebSocket API.
+ + +No events will be dispatched until you subscribe to a receiver.
+Typically, you should pass the organization
attribute of a barrier
+object to the subscribe
method to start receiving data. Don't ask me
+why organization
specifically, I don't know either.
This method will block the event loop until the connection is closed. +If you want to run this method in the background, you should run it in a +separate thread or process.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
reconnect |
+
+ bool
+ |
+
+
+
+ Whether to reconnect if the connection is lost. + |
+
+ True
+ |
+
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
+ WebSocketError
+ |
+
+
+
+ If an error occurs while connecting. + |
+
src/nice_go/nice_go_api.py
361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 |
|
event(coro: CoroT) -> CoroT
+
+Decorator to add an event listener. Just a wrapper around listen
.
This can only decorate coroutine functions.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
coro |
+
+ CoroT
+ |
+
+
+
+ The coroutine function to decorate. + |
+ + required + | +
Examples:
+You can use this decorator to add event listeners to the API object. +Some events include but are not limited to:
+connection_lost
: Triggered when the connection to the WebSocket API is
+ lost.connected
: Triggered when the connection to the WebSocket API is
+ established.data
: Triggered when data is received from an active subscription.
+ See subscribe
.>>> @api.event
+... async def on_data(
+... data: dict[str, Any] | None = None,
+... ) -> None:
+... if data is not None:
+... print(data)
+
src/nice_go/nice_go_api.py
get_all_barriers() -> list[Barrier]
+
+
+ async
+
+
+Get all barriers.
+ + +Returns:
+Type | +Description | +
---|---|
+ list[Barrier]
+ |
+
+
+
+ A list of all barriers. + |
+
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ValueError
+ |
+
+
+
+ If the ClientSession or Endpoints are not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 |
|
light_off(barrier_id: str) -> bool
+
+
+ async
+
+
+Turn the light off.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
barrier_id |
+
+ str
+ |
+
+
+
+ The ID of the barrier to turn the light off. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ bool
+ |
+
+
+
+ Whether the light was turned off successfully. + |
+
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ValueError
+ |
+
+
+
+ If the ClientSession or Endpoints are not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
light_on(barrier_id: str) -> bool
+
+
+ async
+
+
+Turn the light on.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
barrier_id |
+
+ str
+ |
+
+
+
+ The ID of the barrier to turn the light on. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ bool
+ |
+
+
+
+ Whether the light was turned on successfully. + |
+
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ValueError
+ |
+
+
+
+ If the ClientSession or Endpoints are not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
listen(event_name: str, coro: CoroT) -> Callable[[], None]
+
+Add an event listener.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
event_name |
+
+ str
+ |
+
+
+
+ The name of the event. + |
+ + required + | +
coro |
+
+ CoroT
+ |
+
+
+
+ The coroutine to run when the event is dispatched. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ Callable[[], None]
+ |
+
+
+
+ A function to remove the event listener. + |
+
Examples:
+You can use this method to add event listeners to the API object. +Some events include but are not limited to:
+connection_lost
: Triggered when the connection to the WebSocket API is
+ lost.connected
: Triggered when the connection to the WebSocket API is
+ established.data
: Triggered when data is received from an active subscription.
+ See subscribe
.>>> def on_data(data: dict[str, Any] | None = None) -> None:
+... if data is not None:
+... print(data)
+...
+>>> remove_listener = api.listen("data", on_data)
+
src/nice_go/nice_go_api.py
on_device_connected() -> None
+
+
+ async
+
+
+Handle the device connected event.
+ +src/nice_go/nice_go_api.py
on_events_connected() -> None
+
+
+ async
+
+
+Handle the events connected event.
+ +src/nice_go/nice_go_api.py
open_barrier(barrier_id: str) -> bool
+
+
+ async
+
+
+Open a barrier.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
barrier_id |
+
+ str
+ |
+
+
+
+ The ID of the barrier to open. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ bool
+ |
+
+
+
+ Whether the barrier was opened successfully. + |
+
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ValueError
+ |
+
+
+
+ If the ClientSession or Endpoints are not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
subscribe(receiver: str) -> list[str]
+
+
+ async
+
+
+Subscribe to a receiver.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
receiver |
+
+ str
+ |
+
+
+
+ The receiver to subscribe to. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ list[str]
+ |
+
+
+
+ The subscription IDs. You can pass this into the |
+
Raises:
+Type | +Description | +
---|---|
+ WebSocketError
+ |
+
+
+
+ If no WebSocket connection is available. + |
+
src/nice_go/nice_go_api.py
unsubscribe(subscription_id: str) -> None
+
+
+ async
+
+
+Unsubscribe from a receiver.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
subscription_id |
+
+ str
+ |
+
+
+
+ The subscription ID to unsubscribe from. + |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ WebSocketError
+ |
+
+
+
+ If no WebSocket connection is available + |
+
src/nice_go/nice_go_api.py
vacation_mode_off(barrier_id: str) -> None
+
+
+ async
+
+
+Turn vacation mode off.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
barrier_id |
+
+ str
+ |
+
+
+
+ The ID of the barrier to turn vacation mode off. + |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ValueError
+ |
+
+
+
+ If the ClientSession or Endpoints are not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
vacation_mode_on(barrier_id: str) -> None
+
+
+ async
+
+
+Turn vacation mode on.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
barrier_id |
+
+ str
+ |
+
+
+
+ The ID of the barrier to turn vacation mode on. + |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ValueError
+ |
+
+
+
+ If the ClientSession or Endpoints are not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
NiceGOError
+
+
+NoAuthError
+
+
+
+ Bases: NiceGOError
Not authenticated exception.
+ + + +WebSocketError
+
+
+
+ Bases: NiceGOError
WebSocket error.
+ + + +nice_go_api
+
+
+Parses data from the Nice G.O. API.
+This module provides a class to interact +with the Nice G.O. API. It allows the user +to authenticate, connect to the WebSocket +API, and interact with barriers.
+ + +Classes:
+Name | +Description | +
---|---|
NiceGOApi |
+
+
+
+ A class to interact with the Nice G.O. API. + |
+
NiceGOApi
+
+
+A class to interact with the Nice G.O. API.
+This class provides methods to authenticate, connect to the WebSocket API, +and interact with barriers.
+ + +Attributes:
+Name | +Type | +Description | +
---|---|---|
id_token |
+
+ str | None
+ |
+
+
+
+ The ID token. + |
+
Methods:
+Name | +Description | +
---|---|
event |
+
+
+
+ Decorator to add an event listener. + |
+
authenticate_refresh |
+
+
+
+ Authenticate using a refresh token. + |
+
authenticate |
+
+
+
+ Authenticate using username and password. + |
+
connect |
+
+
+
+ Connect to the WebSocket API. + |
+
subscribe |
+
+
+
+ Subscribe to a receiver. + |
+
unsubscribe |
+
+
+
+ Unsubscribe from a receiver. + |
+
close |
+
+
+
+ Close the connection. + |
+
get_all_barriers |
+
+
+
+ Get all barriers. + |
+
src/nice_go/nice_go_api.py
46 + 47 + 48 + 49 + 50 + 51 + 52 + 53 + 54 + 55 + 56 + 57 + 58 + 59 + 60 + 61 + 62 + 63 + 64 + 65 + 66 + 67 + 68 + 69 + 70 + 71 + 72 + 73 + 74 + 75 + 76 + 77 + 78 + 79 + 80 + 81 + 82 + 83 + 84 + 85 + 86 + 87 + 88 + 89 + 90 + 91 + 92 + 93 + 94 + 95 + 96 + 97 + 98 + 99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612 +613 +614 +615 +616 +617 +618 +619 +620 +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631 +632 +633 +634 +635 +636 +637 +638 +639 +640 +641 +642 +643 +644 +645 +646 +647 +648 +649 +650 +651 +652 +653 +654 +655 +656 +657 +658 +659 +660 +661 +662 +663 +664 +665 +666 +667 +668 +669 +670 +671 +672 +673 +674 +675 +676 +677 +678 +679 +680 +681 +682 +683 +684 +685 +686 +687 +688 +689 +690 +691 +692 +693 +694 +695 +696 +697 +698 +699 +700 +701 +702 +703 +704 +705 +706 +707 +708 +709 +710 +711 +712 +713 +714 +715 +716 +717 +718 +719 +720 +721 +722 +723 +724 +725 +726 +727 +728 +729 +730 +731 +732 +733 +734 +735 +736 +737 +738 +739 +740 +741 +742 +743 +744 +745 +746 +747 +748 +749 +750 +751 +752 +753 +754 +755 +756 +757 +758 +759 +760 +761 +762 +763 +764 +765 +766 +767 +768 +769 +770 +771 +772 +773 +774 +775 +776 +777 +778 +779 +780 +781 +782 +783 +784 +785 +786 +787 +788 +789 +790 +791 +792 +793 +794 +795 +796 +797 +798 +799 +800 +801 +802 +803 +804 +805 +806 +807 +808 +809 +810 +811 +812 +813 +814 +815 +816 +817 +818 +819 +820 +821 |
|
closed: bool
+
+
+ property
+
+
+Check if the connection is closed.
+__authenticate(user_name: str | None, password: str | None, refresh_token: str | None) -> str | None
+
+
+ async
+
+
+Authenticate using username and password or refresh token.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
user_name |
+
+ str | None
+ |
+
+
+
+ The username. + |
+ + required + | +
password |
+
+ str | None
+ |
+
+
+
+ The password. + |
+ + required + | +
refresh_token |
+
+ str | None
+ |
+
+
+
+ The refresh token. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ str | None
+ |
+
+
+
+ The refresh token. + |
+
Raises:
+Type | +Description | +
---|---|
+ AuthFailedError
+ |
+
+
+
+ If the authentication fails. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 |
|
__init__() -> None
+
+Initialize the NiceGOApi object.
+ +src/nice_go/nice_go_api.py
authenticate(user_name: str, password: str, session: aiohttp.ClientSession) -> str | None
+
+
+ async
+
+
+Authenticate using username and password.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
user_name |
+
+ str
+ |
+
+
+
+ The username. + |
+ + required + | +
password |
+
+ str
+ |
+
+
+
+ The password. + |
+ + required + | +
session |
+
+ ClientSession
+ |
+
+
+
+ The client session to use. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ str | None
+ |
+
+
+
+ The refresh token. + |
+
Raises:
+Type | +Description | +
---|---|
+ AuthFailedError
+ |
+
+
+
+ If the authentication fails. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
authenticate_refresh(refresh_token: str, session: aiohttp.ClientSession) -> None
+
+
+ async
+
+
+Authenticate using a previous obtained refresh token.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
refresh_token |
+
+ str
+ |
+
+
+
+ The refresh token. + |
+ + required + | +
session |
+
+ ClientSession
+ |
+
+
+
+ The client session to use. + |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ AuthFailedError
+ |
+
+
+
+ If the authentication fails. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
close() -> None
+
+
+ async
+
+
+Close the connection.
+ + +Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
src/nice_go/nice_go_api.py
close_barrier(barrier_id: str) -> bool
+
+
+ async
+
+
+Close a barrier.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
barrier_id |
+
+ str
+ |
+
+
+
+ The ID of the barrier to close. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ bool
+ |
+
+
+
+ Whether the barrier was closed successfully. + |
+
src/nice_go/nice_go_api.py
connect(*, reconnect: bool = True) -> None
+
+
+ async
+
+
+Connect to the WebSocket API.
+ + +No events will be dispatched until you subscribe to a receiver.
+Typically, you should pass the organization
attribute of a barrier
+object to the subscribe
method to start receiving data. Don't ask me
+why organization
specifically, I don't know either.
This method will block the event loop until the connection is closed. +If you want to run this method in the background, you should run it in a +separate thread or process.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
reconnect |
+
+ bool
+ |
+
+
+
+ Whether to reconnect if the connection is lost. + |
+
+ True
+ |
+
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
+ WebSocketError
+ |
+
+
+
+ If an error occurs while connecting. + |
+
src/nice_go/nice_go_api.py
361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 |
|
event(coro: CoroT) -> CoroT
+
+Decorator to add an event listener. Just a wrapper around listen
.
This can only decorate coroutine functions.
+Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
coro |
+
+ CoroT
+ |
+
+
+
+ The coroutine function to decorate. + |
+ + required + | +
Examples:
+You can use this decorator to add event listeners to the API object. +Some events include but are not limited to:
+connection_lost
: Triggered when the connection to the WebSocket API is
+ lost.connected
: Triggered when the connection to the WebSocket API is
+ established.data
: Triggered when data is received from an active subscription.
+ See subscribe
.>>> @api.event
+... async def on_data(
+... data: dict[str, Any] | None = None,
+... ) -> None:
+... if data is not None:
+... print(data)
+
src/nice_go/nice_go_api.py
get_all_barriers() -> list[Barrier]
+
+
+ async
+
+
+Get all barriers.
+ + +Returns:
+Type | +Description | +
---|---|
+ list[Barrier]
+ |
+
+
+
+ A list of all barriers. + |
+
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ValueError
+ |
+
+
+
+ If the ClientSession or Endpoints are not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 |
|
light_off(barrier_id: str) -> bool
+
+
+ async
+
+
+Turn the light off.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
barrier_id |
+
+ str
+ |
+
+
+
+ The ID of the barrier to turn the light off. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ bool
+ |
+
+
+
+ Whether the light was turned off successfully. + |
+
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ValueError
+ |
+
+
+
+ If the ClientSession or Endpoints are not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
light_on(barrier_id: str) -> bool
+
+
+ async
+
+
+Turn the light on.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
barrier_id |
+
+ str
+ |
+
+
+
+ The ID of the barrier to turn the light on. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ bool
+ |
+
+
+
+ Whether the light was turned on successfully. + |
+
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ValueError
+ |
+
+
+
+ If the ClientSession or Endpoints are not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
listen(event_name: str, coro: CoroT) -> Callable[[], None]
+
+Add an event listener.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
event_name |
+
+ str
+ |
+
+
+
+ The name of the event. + |
+ + required + | +
coro |
+
+ CoroT
+ |
+
+
+
+ The coroutine to run when the event is dispatched. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ Callable[[], None]
+ |
+
+
+
+ A function to remove the event listener. + |
+
Examples:
+You can use this method to add event listeners to the API object. +Some events include but are not limited to:
+connection_lost
: Triggered when the connection to the WebSocket API is
+ lost.connected
: Triggered when the connection to the WebSocket API is
+ established.data
: Triggered when data is received from an active subscription.
+ See subscribe
.>>> def on_data(data: dict[str, Any] | None = None) -> None:
+... if data is not None:
+... print(data)
+...
+>>> remove_listener = api.listen("data", on_data)
+
src/nice_go/nice_go_api.py
on_device_connected() -> None
+
+
+ async
+
+
+Handle the device connected event.
+ +src/nice_go/nice_go_api.py
on_events_connected() -> None
+
+
+ async
+
+
+Handle the events connected event.
+ +src/nice_go/nice_go_api.py
open_barrier(barrier_id: str) -> bool
+
+
+ async
+
+
+Open a barrier.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
barrier_id |
+
+ str
+ |
+
+
+
+ The ID of the barrier to open. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ bool
+ |
+
+
+
+ Whether the barrier was opened successfully. + |
+
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ValueError
+ |
+
+
+
+ If the ClientSession or Endpoints are not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
subscribe(receiver: str) -> list[str]
+
+
+ async
+
+
+Subscribe to a receiver.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
receiver |
+
+ str
+ |
+
+
+
+ The receiver to subscribe to. + |
+ + required + | +
Returns:
+Type | +Description | +
---|---|
+ list[str]
+ |
+
+
+
+ The subscription IDs. You can pass this into the |
+
Raises:
+Type | +Description | +
---|---|
+ WebSocketError
+ |
+
+
+
+ If no WebSocket connection is available. + |
+
src/nice_go/nice_go_api.py
unsubscribe(subscription_id: str) -> None
+
+
+ async
+
+
+Unsubscribe from a receiver.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
subscription_id |
+
+ str
+ |
+
+
+
+ The subscription ID to unsubscribe from. + |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ WebSocketError
+ |
+
+
+
+ If no WebSocket connection is available + |
+
src/nice_go/nice_go_api.py
vacation_mode_off(barrier_id: str) -> None
+
+
+ async
+
+
+Turn vacation mode off.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
barrier_id |
+
+ str
+ |
+
+
+
+ The ID of the barrier to turn vacation mode off. + |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ValueError
+ |
+
+
+
+ If the ClientSession or Endpoints are not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py
vacation_mode_on(barrier_id: str) -> None
+
+
+ async
+
+
+Turn vacation mode on.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
barrier_id |
+
+ str
+ |
+
+
+
+ The ID of the barrier to turn vacation mode on. + |
+ + required + | +
Raises:
+Type | +Description | +
---|---|
+ NoAuthError
+ |
+
+
+
+ If the ID token is not available. + |
+
+ ValueError
+ |
+
+
+
+ If the ClientSession or Endpoints are not available. + |
+
+ ApiError
+ |
+
+
+
+ If an API error occurs. + |
+
src/nice_go/nice_go_api.py