-
-
Notifications
You must be signed in to change notification settings - Fork 566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Devtools exception miottemplate.py generate #885
Comments
There was few bugs in |
I'm getting the same problem, unfortunately :( |
diff --git a/devtools/containers.py b/devtools/containers.py
index e0a5cb2..465d998 100644
--- a/devtools/containers.py
+++ b/devtools/containers.py
@@ -1,5 +1,5 @@
from dataclasses import dataclass, field
-from typing import List
+from typing import Any, Dict, List, Optional
from dataclasses_json import DataClassJsonMixin, config
@@ -35,12 +35,14 @@ class Property(DataClassJsonMixin):
format: str
access: List[str]
- value_list: List = field(
+ value_list: Optional[List[Dict[str, Any]]] = field(
default_factory=list, metadata=config(field_name="value-list")
)
- value_range: List = field(default=None, metadata=config(field_name="value-range"))
+ value_range: Optional[List[Any]] = field(
+ default=None, metadata=config(field_name="value-range")
+ )
- unit: str = None
+ unit: Optional[str] = None
def __repr__(self):
return f"piid: {self.iid} ({self.description}): ({self.format}, unit: {self.unit}) (acc: {self.access}, value-list: {self.value_list}, value-range: {self.value_range})"
this will fix error, but as I see this generator outdated. Generated code is not relevant |
Yes, sorry about that :-( The generator was uploaded only as a proof-of-concept to simplify the process, but in its current state it is only helpful for parsing out the details from the json files and cannot be used as a real generator. The PR that aimed to improve the miot support and make it easier to implement the generation is #672, but I haven't had time nor do posess test devices anymore to improve it further to make it useful. Contributions are welcome on that front! I'd recommend using @IhorSyerkov feel free to create a PR to get that fix included (and maybe add a verbose warning that the generated code is not directly usable), it may still be useful! |
Describe the bug
I'm trying to add support Yeelight Smart Dual Control Module (yeelink.switch.sw1) using devtools.
http://miot-spec.org/miot-spec-v2/instance?type=urn:miot-spec-v2:device:switch:0000A003:yeelink-sw1:1:0000C809
Downloaded json using
python miottemplate.py download urn:miot-spec-v2:device:switch:0000A003:yeelink-sw1:1:0000C809
but getting error when trying to generate tempate
python miottemplate.py generate urn:miot-spec-v2:device:switch:0000A003:yeelink-sw1:1:0000C809.json
Version information (please complete the following information):
Device information:
If the issue is specific to a device [Use
miiocli device --ip <ip address> --token <token> info
]:Console output
The text was updated successfully, but these errors were encountered: