freshlybrewedcode / pymee Goto Github PK
View Code? Open in Web Editor NEWa python library to interact with homee
License: MIT License
a python library to interact with homee
License: MIT License
Hi,
I'm planning some bigger changes to pymee in the near future:
Do you still want to be kept in the loop and do it via Pull requests -> release by you or shall we do it the same way as with the HA integration?
An Attribute in Homee can have options.
The currently known are:
At least the last one is useful for other applications acessing Homee. So it is desired to expose them in pymee.
There are two possible approaches:
Iterate over the options and convert the dict to an object:
def __init__(self, attributeOptions):
for key, value in attributeOptions.items():
setattr(self, key, value)
pro | con |
---|---|
- just a few lines of code | - using code must check for presence of options to avoid errors |
- only options that are present are added | - intellisense or similiar tools are not available. |
- will also add currently unknown entries |
Add getters for the known possible options and return empty values if they don't exist.
def __init__(self, attributeOptions):
self._data = attributeOptions
@property
def can_observe(self) -> list:
if "can_observe" in self._data:
return self._data["can_observe"]
...
pro | con |
---|---|
- parsing options error handling can be done here | - longer code |
- intellisense or similar tools available for applications using pymee | - unknown options will be ignored |
- every attribute has all options, but with empty values |
@FreshlyBrewedCode: Since it is your project, I want to get your opinion on which approach to use before I do a pull request
Example code of an Attribute with options:
{
'id': 38,
'node_id': 3,
'instance': 0,
'minimum': 0,
'maximum': 4, // 0 = Closed; 1 = Open; 2 = Stop; 3 = Closing; 4 = Opening
'current_value': 1.0,
'target_value': 1.0,
'last_value': 4.0,
'unit': 'n%2Fa',
'step_value': 1.0,
'editable': 1,
'type': 135, // UP_DOWN
'state': 1,
'last_changed': 1687175680,
'changed_by': 1,
'changed_by_id': 0,
'based_on': 1,
'data': '',
'name': '',
'options': {
'can_observe': [300],
'observes': [75],
'reverse_control_ui': True,
'automations': ['toggle']
}
The upload to PyPi fails in the release process:
400 User 'FreshlyBrewedCode' does not have a verified primary email address. Please add a verified primary email before attempting to upload to PyPI. See https://pypi.org/help/#verified-email for more information.
After the last update, my HA logs show the following:
2023-06-26 13:01:20.559 ERROR (MainThread) [pymee] An error occurred: invalid state
2023-06-26 13:01:25.918 ERROR (MainThread) [pymee] An error occurred: 'list' object is not an iterator
The second line gets repeated then every 5 seconds for about 20 minutes
Not sure yet where it comes from - I keep investigating.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.