Custom Capability and CLI Developer Preview

the command in DTH is:

> def setListElement(argument){
> 	sendEvent(name: "listElement", value: "${argument}")
>     make(argument)
> }

that is very simple.
then the make() command is:

def make(item) {
    sendEvent(name: "faithboard04631.coffeemachineselect.lastorder", value: "${item}", isStateChange: true, displayed: true)
	unschedule()
	runEvery1Minute(refresh)
    def hosthex = convertIPtoHex(ip).toUpperCase()
    def porthex = convertPortToHex(port).toUpperCase() 
    def path = "/coffee/$item"
    def headers = [:] 
    headers.put("HOST", "$ip:$port")
    def method = "GET"
    
    try {
    def hubAction = new physicalgraph.device.HubAction(
        method: method,
        path: path,
        headers: headers
        )
        sendHubCommand(hubAction)
    }
    catch (Exception e) {
        log.debug "Hit Exception $e on $hubAction"
    }
}

The above sendEvent seems wrong to me.

I used your capability faithboard04631.coffeemachine and the command setListElement works fine, when I check the device status, I see the value updated:

"faithboard04631.coffeemachine": {
    "listElement": {
        "value": "capuccinomix",
        "timestamp": "2020-11-09T16:25:10.068+0000"
    }
}

actually it also works for me.
but the button goes into a “working” state and after a few seconds I get the “network error” despite the fact that it actually finished its job.,
so what is this error ? why do I get it ?

ok, I included the faithboard04631.coffeemachineselect capability and both are updated, the “network error” doesn’t appear. This is how I send the events:

def setListElement(argument){
log.trace "${argument}"
	sendEvent(name: "listElement", value: "${argument}")
    sendEvent(name: "lastorder", value: "${argument}")
}

Have you verified your configuration as I mentioned here?

This is a property of the legacy events, you can see that it’s part of the events’ list filters. Due to the changes to the Events History, it can be omitted.

1 Like

I think list just took a step backwards. Anyone notice the list of commands presented now are union of the alternatives from command and state:

For example this presetation:

"detailView": [
        {
            "label": "Test label",
			"displayType": "list",
			"list": {
				"state": {
					"value": "testReport.value",
					"alternatives": [
						{
							"key": "A",
							"value": "Value A"
						}
					]
				},
				"command": {
					"name": "setTest",
					"alternatives": [
						{
							"key": "B",
							"value": "Command B"
						}
					]
				}
			}
        }
    ]
  • Earlier this used to only generate one list command “Command B”.
  • Now it seems to be consolidating the alternatives from command and state and it presents 2 commands in the list, “Value A” and “Command B” (which is incorrect).

Existing presentations aren’t impacted, but if you create a new presentation you’ll run into this issue.

this is going to be a problem. just because it’s a supported state doesn’t mean it should be a supported command in the new app UI.

might as well remove the separation of state and command then.

Yes it is because it’s not possible to make a list controls with alternatives anymore as it’s just confusing for users and calls the commands with the corresponding value for every alternative from state. @nayelyz can be a quick fix for this regression bug?

well, now I tried again and surprizingly it works with no errors. the button does not go into a working state, quickly returns to normal.
what happened ?
how was it solved ? (I did not change anything)

btw, when shall we have the pushbutton displayType working ?

@nayelyz list is severely broken!

If I do this

"detailView": [
        {
            "label": "Test label",
			"displayType": "list",
			"list": {
				"state": {
					"value": "testReport.value"
				},
				"command": {
					"name": "setTest",
					"alternatives": [
						{
							"key": "B",
							"value": "Command B"
						}
					]
				}
			}
        }
    ]

It won’t let me generate a presentation and throws an error:

[2020-11-10T13:38:10.982] [ERROR] cli - caught error Error: Request failed with status code 422: {“requestId”:“6FC2AAC4-38DB-4729-82EE-68BC6A9B4968”,“error”:{“code”:“4000000”,“message”:“must not be null at detailView.list.state.alternatives”,“details”:}}

It’s FORCING me to put in alternatives and if I put in this:

"detailView": [
        {
            "label": "Test label",
			"displayType": "list",
			"list": {
				"state": {
					"value": "testReport.value",
					"alternatives": [
						{
							"key": "A",
							"value": "Value A"
						}
					]
				},
				"command": {
					"name": "setTest",
					"alternatives": [
						{
							"key": "B",
							"value": "Command B"
						}
					]
				}
			}
        }
    ]

Now it shows Value A and Command B in the list of options (it’s consolidating the alternatives from state and command)

Whatever change was done recently has broken list severely. Please suggest a workaround or request the dev team to fix this (hopefully not in a few months but in a few days).

half of my devices for the same DTH is showing one presentation and the rest are showing another from the past. even without any DTH related changes for the last few days. so any refreshes that supposedly happen every 12 hours isn’t helping either.

and with all the posts i keep seeing with things breaking i am very hesitant to make any changes. this is seriously broken and meanwhile zero updates are being shared.

getting time to upgrade to the C7.

4 Likes

@nayelyz another bug with list. Using the below presentation:

"detailView": [
        {
            "label": "Test label",
			"displayType": "list",
			"list": {
				"state": {
					"value": "testReport.value",
					"alternatives": [
						{
							"key": "A",
							"value": "Value A"
						}
					]
				},
				"command": {
					"name": "setTest",
					"alternatives": [
						{
							"key": "B",
							"value": "Command B"
						}
					]
				}
			}
        }
    ]

The attribute is defined as:

"attributes": {
		"testReport": {
			"schema": {
				"type": "object",
				"properties": {
					"value": {
						"type": "string"
					}
				},
				"additionalProperties": false,
				"required": [
					"value"
				]
			},
			"setter": "setTest"
		}
    }

If send the following sendEvent(name: "testReport", value: "500"), it shows it as TIME 07:03 PM, or if I send a text string to it (e.g . “500 hours”), it says Invalid Date!!

If the value begins with a number (string or integer) it is treating the value (number/string) as Date / Time instead of text/numbers.


It could be that the device presentation wasn’t refreshed correctly and if you reopened the app or the device details, it was updated.

Thanks for the input. I reported the issue to our engineering department and I will keep an eye on the progress.

@nayelyz I’m using securitySystem capability, which is live and should be working but I’m getting the attached error when I use armStay or armAway … disarm works though. What could be the issue?

1 Like

I have seen this behavior as well. It would usually resolve itself in a few days. I wish the process of creating these objects was more frequent or maybe could be done on demand for a given profile? I am very nervous now changing anything on the profile I am working with now that it is working. Not good :slight_smile:

1 Like

thanks … hoping it resolves itself.

the lack of any updates is more frustrating than anything else. feels like typical big corp doing “community” without an understanding of the ethos.

2 Likes

and when shall we have working pushbuttons ?

I think this is the same issue that we previouslly reported, but we missed the fact that it does the same thing with text that starts with a number. If I remember correctly, changing 500 to 500.00 will prevent that from happening.

Once it thinks it’s a date it can also be difficult to get it to stop thinking it’s a date so after updating the value you sometimes have to re-open the device details screen and/or app multiple times.

I was attempting to display a comma separated list of hex values in a string attribute, but it kept displaying as either the expected value, a date/time, or “invalid date” depending on the first value in the list.

I ended up wrapping the value in brackets which doesn’t look great, but it solved the problem…

Does that have any impact on a custom capability and presentation like the one below.

That worked as expected and it seemed simple enough that it would be less likely for them to break so almost all of my custom capabilities are created like that.

They appear to still be working as expected, but I’m concerned that a working version might be cached and if I touch the thing it will end up breaking…

Capability:

{
    "id": "platemusic11009.hsLedMode",
    "version": 1,
    "status": "proposed",
    "name": "HS LED Mode",
    "attributes": {
        "ledMode": {
            "schema": {
                "type": "object",
                "properties": {
                    "value": {
                        "type": "string",
                        "enum": [
													"normal",
													"status"
												]
                    }
                },
                "additionalProperties": false,
                "required": [
                    "value"
                ]
            },
            "setter": "setLedMode",
            "enumCommands": []
        }
    },
    "commands": {
        "setLedMode": {
            "name": "setLedMode",
            "arguments": [
                {
                    "name": "value",
                    "optional": false,
                    "schema": {
                        "type": "string",
                        "enum": [
													"normal",
													"status"
												]
                    }
                }
            ]
        }
    }
}

Presentation:

{
    "dashboard": {
        "states": [
            {
                "label": "{{ledMode.value}}",
                "alternatives": [
                    {
                        "key": "normal",
                        "value": "Normal (load)",
                        "type": "active"
                    },
                    {
                        "key": "status",
                        "value": "Status (custom)",
                        "type": "active"
                    }
                ]
            }
        ],
        "actions": [],
        "basicPlus": []
    },
    "detailView": [
        {
            "label": "LED Mode",
            "displayType": "list",
            "list": {
                "command": {
                    "name": "setLedMode",
                    "alternatives": [
												{
														"key": "normal",
														"value": "Normal (load)",
														"type": "active"
												},
												{
														"key": "status",
														"value": "Status (custom)",
														"type": "active"
												}
									]
                },
                "state": {
                    "value": "ledMode.value",
                    "alternatives": [
											{
													"key": "normal",
													"value": "Normal (load)",
													"type": "active"
											},
											{
													"key": "status",
													"value": "Status (custom)",
													"type": "active"
											}
										]
               }
            }
        }
    ],
    "automation": {
        "conditions": [
            {
                "label": "LED Mode",
                "displayType": "list",
                "list": {
                    "alternatives": [
											{
													"key": "normal",
													"value": "Normal (load)",
													"type": "active"
											},
											{
													"key": "status",
													"value": "Status (custom)",
													"type": "active"
											}
										],
                    "value": "ledMode.value"
                }
            }
        ],
        "actions": [
            {
                "label": "LED Mode",
                "displayType": "list",
                "list": {
                    "alternatives": [
											{
                        "key": "normal",
                        "value": "Normal (load)",
                        "type": "active"
											},
											{
													"key": "status",
													"value": "Status (custom)",
													"type": "active"
											}
										],
                    "command": "setLedMode"
                }
            }
        ]
    },
    "id": "platemusic11009.hsLedMode",
    "version": 1
}