[miio] allow for comments to channels in json db (#8666)

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
This commit is contained in:
Marcel 2020-10-05 01:56:36 +02:00 committed by GitHub
parent 7b2d184676
commit a857592f07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1582 additions and 1568 deletions

File diff suppressed because it is too large Load Diff

View File

@ -65,6 +65,9 @@ public class MiIoBasicChannel {
@SerializedName("actions")
@Expose
private @Nullable List<MiIoDeviceAction> miIoDeviceActions = new ArrayList<>();
@SerializedName("readmeComment")
@Expose
private @Nullable String readmeComment;
public String getProperty() {
final String property = this.property;
@ -184,6 +187,15 @@ public class MiIoBasicChannel {
this.transfortmation = transfortmation;
}
public String getReadmeComment() {
final String readmeComment = this.readmeComment;
return (readmeComment != null) ? readmeComment : "";
}
public void setReadmeComment(String readmeComment) {
this.readmeComment = readmeComment;
}
@Override
public String toString() {
return "[ Channel = " + getChannel() + ", friendlyName = " + getFriendlyName() + ", type = " + getType()

View File

@ -13,6 +13,7 @@
"property": "",
"friendlyName": "Enable Telnet",
"channel": "telnetEnable",
"readmeComment": "Access the device with telnet to further unlock developer mode. See forum",
"type": "Switch",
"refresh": false,
"actions": [

View File

@ -115,12 +115,13 @@ public class ReadmeHelper {
String link = device.getModel().replace(".", "-");
sw.write("### " + device.getDescription() + " (" + "<a name=\"" + link + "\">" + device.getModel()
+ "</a>" + ") Channels\r\n" + "\r\n");
sw.write("| Channel | Type | Description |\r\n");
sw.write("|------------------|---------|-------------------------------------|\r\n");
sw.write("| Channel | Type | Description | Comment |\r\n");
sw.write("|------------------|---------|-------------------------------------|------------|\r\n");
for (MiIoBasicChannel ch : dev.getDevice().getChannels()) {
sw.write("| " + minLengthString(ch.getChannel(), 16) + " | " + minLengthString(ch.getType(), 7)
+ " | " + minLengthString(ch.getFriendlyName(), 35) + " |\r\n");
+ " | " + minLengthString(ch.getFriendlyName(), 35) + " | "
+ minLengthString(ch.getReadmeComment(), 10) + " |\r\n");
}
sw.write("\r\n");