1

我有一个用于智能家居窗帘的 Alexa 项目,其中包括两个范围控制器、一个亮度控制器和每个端点上的一个切换控制器。

两个范围控制器、切换控制器和亮度控制器都有不同的实例和友好名称。

向 Alexa 发出命令时,无论命令的措辞如何,任何包含百分比的内容都默认为亮度控制器。如果我完全移除亮度控制器并尝试发出旋转命令(范围控制器),取决于设备,我会得到非常不一致的结果,说明它不知道如何设置设置。有些设备一开始可以工作 90% 左右,然后会突然出现持续故障。其他设备根本无法工作。没有设备始终如一地工作。

如果我减少到任何一项功能,它几乎 100% 的时间都有效。

有没有其他人经历过这种行为,有什么解决办法吗?

能力代码:

export const ROTATE_CAPABILITY = {
    type: "AlexaInterface",
    interface: "Alexa.RangeController",
    version: "3",
    instance: "Blind.Rotate",
    properties: {
        supported: [{ name: "rangeValue" }],
        proactivelyReported: false,
        retrievable: true,
    },
    capabilityResources: {
        friendlyNames: [
            {
                "@type": "text",
                value: {
                    text: "Vane",
                    locale: "en-US"
                }
            },
            {
                "@type": "text",
                value: {
                    text: "Tilt",
                    locale: "en-US"
                }
            },
            {
                "@type": "text",
                value: {
                    text: "Angle",
                    locale: "en-US"
                }
            }
        ]
    },
    configuration: {
        supportedRange: {
            minimumValue: 0,
            maximumValue: 100,
            precision: 1,
        },
        unitOfMeasure: "Alexa.Unit.Percent"
    }
}

export const BRIGHTNESS_CAPABILITY = {
    type: "AlexaInterface",
    interface: "Alexa.BrightnessController",
    version: "3",
    instance: "Blind.Brightness",
    properties: {
        supported: [
            {
                name: "brightness"
            }
        ],
        proactivelyReported: false,
        retrievable: true
    }
}

export const BRIGHTNESS_TOGGLE = {
    type: "AlexaInterface",
    interface: "Alexa.ToggleController",
    instance: "Blind.Light",
    version: "3",
    properties: {
        supported: [
            {
                name: "toggleState"
            }
        ],
        proactivelyReported: false,
        retrievable: true,
        nonControllable: false
    },
    capabilityResources: {
        friendlyNames: [
            {
                "@type": "text",
                value: {
                    text: "Shade Light",
                    locale: "en-US"
                }
            },
            {
                "@type": "text",
                value: {
                    text: "Light",
                    locale: "en-US"
                }
            }
        ]
    }
}

export const MAIN_CAPABILITY = {
    type: "AlexaInterface",
    interface: "Alexa.RangeController",
    instance: "Blind.Lift",
    version: "3",
    properties: {
        supported: [{
            name: "rangeValue",
        },],
        proactivelyReported: false,
        retrievable: true,
    },
    capabilityResources: {
        friendlyNames: [
            {
                "@type": "text",
                value: {
                    text: "Shade",
                    locale: "en-US"
                }
            }
        ],
    },
    configuration: {
        supportedRange: {
            minimumValue: 0,
            maximumValue: 100,
            precision: 1,
        },
        unitOfMeasure: "Alexa.Unit.Percent",
    },
    semantics: {
        actionMappings: [{
            "@type": "ActionsToDirective",
            actions: ["Alexa.Actions.Close"],
            directive: {
                name: "SetRangeValue",
                payload: {
                    rangeValue: 0,
                },
            },
        },
        {
            "@type": "ActionsToDirective",
            actions: ["Alexa.Actions.Open"],
            directive: {
                name: "SetRangeValue",
                payload: {
                    rangeValue: 100,
                },
            },
        },
        {
            "@type": "ActionsToDirective",
            actions: ["Alexa.Actions.Lower"],
            directive: {
                name: "AdjustRangeValue",
                payload: {
                    rangeValueDelta: -10,
                    rangeValueDeltaDefault: false,
                },
            },
        },
        {
            "@type": "ActionsToDirective",
            actions: ["Alexa.Actions.Raise"],
            directive: {
                name: "AdjustRangeValue",
                payload: {
                    rangeValueDelta: 10,
                    rangeValueDeltaDefault: false,
                },
            },
        },
        ],
        stateMappings: [{
            "@type": "StatesToValue",
            states: ["Alexa.States.Closed"],
            value: 0,
        },
        {
            "@type": "StatesToRange",
            states: ["Alexa.States.Open"],
            range: {
                minimumValue: 1,
                maximumValue: 100,
            },
        },
        ],
    },
}
4

0 回答 0