Comments (5)
What are your thoughts on "shimming" these caps definitions into the expected properties?
for example:
@property def has_relay(self) -> bool | None: """Is the outlet controllable.""" has_relay = self.raw.get("has_relay") if has_relay == None: outlet_caps = self.raw.get("outlet_caps") has_relay = outlet_caps == 3 or outlet_caps == 1 return has_relayuses the property that comes back from the API if it's available. if it's not, it uses caps to determine the result.
So right now Im not a fan of trying put too much logic into the library but rather try to keep it close to what the API exposes. I think its better we combine this data on the integration side of things.
from aiounifi.
What are your thoughts on "shimming" these caps definitions into the expected properties?
for example:@property def has_relay(self) -> bool | None: """Is the outlet controllable.""" has_relay = self.raw.get("has_relay") if has_relay == None: outlet_caps = self.raw.get("outlet_caps") has_relay = outlet_caps == 3 or outlet_caps == 1 return has_relayuses the property that comes back from the API if it's available. if it's not, it uses caps to determine the result.
So right now Im not a fan of trying put too much logic into the library but rather try to keep it close to what the API exposes. I think its better we combine this data on the integration side of things.
Other PR proposing a composite way to cover relay support https://github.com/Kane610/aiounifi/pull/185/files
from aiounifi.
I think its sound to define it like this!
from aiounifi.
What are your thoughts on "shimming" these caps definitions into the expected properties?
for example:
@property
def has_relay(self) -> bool | None:
"""Is the outlet controllable."""
has_relay = self.raw.get("has_relay")
if has_relay == None:
outlet_caps = self.raw.get("outlet_caps")
has_relay = outlet_caps == 3 or outlet_caps == 1
return has_relay
uses the property that comes back from the API if it's available. if it's not, it uses caps to determine the result.
from aiounifi.
In that case, I'll update my PR to only document the caps
from aiounifi.
Related Issues (20)
- Unifi Network 8.0.7 breaks PoE port status HOT 5
- U-LTE-PRO setup:sync messages not supported HOT 1
- Unsupported event key EVT_XG_Lost_Contact HOT 1
- Integration breaking on UDM update to Unifi OS v3.2.7/Network Appilcation v8.0.7 HOT 6
- WAN stats for unifi controller HOT 2
- Power Monitoring For Smart Power Strip HOT 6
- Add ability to activate/deactivate traffic rules HOT 4
- Control port state
- Unsupported message key usergroup:sync
- Clients connected to AP HOT 2
- Show ALL ports on a network switch HOT 1
- JSONDecodeError: Input is a zero-length, empty document HOT 1
- LAN and VPN clients connected HOT 1
- Bad JSON data '' HOT 4
- Add Support to un-/Block WLAN devices HOT 1
- Additional information regarding the state of devices HOT 3
- Unifi OS 4.03 not working (yet) with current HA HOT 11
- Gateway Outlet Control HOT 10
- unawaited response text HOT 2
- EVT_DM_Connected events HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aiounifi.