Skip to content

Add support for A-OK AM25 Blind motor#11045

Merged
Koenkk merged 2 commits intoKoenkk:masterfrom
dtswk:patch-1
Dec 19, 2025
Merged

Add support for A-OK AM25 Blind motor#11045
Koenkk merged 2 commits intoKoenkk:masterfrom
dtswk:patch-1

Conversation

@dtswk
Copy link
Copy Markdown
Contributor

@dtswk dtswk commented Dec 19, 2025

My first attempt at adding to Zigbee2MQTT so hopefully ok.
There were two other AM25 devices previously however it appears the battery has changed to a new ID 13. When I made this I found the default behaviour open and closed was reversed and couldn't work out how to flip that so ended up adding in the option via options: [exposes.options.invert_cover()].

Link to picture pull request: TODO

My first attempt at adding to Zigbee2MQTT so hopefully ok.
There were two other AM25 devices previously however it appears the battery has changed to a new ID 13.   When I made this I found the default behaviour open and closed was reversed and couldn't work out how to flip that so ended up adding in the option via     options: [exposes.options.invert_cover()].
@dtswk
Copy link
Copy Markdown
Contributor Author

dtswk commented Dec 19, 2025

Full external file incase I muffed up the commit. :-)

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const modernExtend = require('zigbee-herdsman-converters/lib/modernExtend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
    // Since a lot of Tuya devices use the same modelID, but use different datapoints
    // it's necessary to provide a fingerprint instead of a zigbeeModel
    fingerprint: tuya.fingerprint("TS0301", [
        "_TZE210_m6lwazh9",
    ]),
    model: 'TS0301_a_ok',
    vendor: 'Tuya',
    description: 'A-OK AM25 Blind motor',
    options: [exposes.options.invert_cover()],
    extend: [
        tuya.modernExtend.tuyaBase({
            dp: true,
            // Enable this line in case the device has a clock, if time is incorrect with
            // `1970`, try with `2000`.
            // timeStart: "1970",
        }),
    ],
    exposes: [
        e.battery(),
        e.cover_position().setAccess("position", ea.STATE_SET),
        e.enum("reverse_direction", ea.STATE_SET, ["forward", "back"]).withDescription("Reverse the motor direction"),
        // e.enum("border", ea.STATE_SET, ["up", "down", "up_delete", "down_delete", "remove_top_bottom"]),
        // e.enum("click_control", ea.STATE_SET, ["up", "down"]).withDescription("Single motor steps"),
        // e.binary("motor_fault", ea.STATE, true, false),
    ],
    meta: {
        // All datapoints go in here
        tuyaDatapoints: [
            [
                1,
                "state",
                tuya.valueConverterBasic.lookup({
                    OPEN: tuya.enum(0),
                    STOP: tuya.enum(1),
                    CLOSE: tuya.enum(2),
                }),
            ],
            [2, "position", tuya.valueConverter.coverPosition],
            [3, "position", tuya.valueConverter.coverPosition],
            [
                5,
                "reverse_direction",
                tuya.valueConverterBasic.lookup({
                    forward: tuya.enum(0),
                    back: tuya.enum(1),
                }),
            ],
            [12, "motor_fault", tuya.valueConverter.trueFalse1],
            [13, "battery", tuya.valueConverter.raw],
            // [
            //     16,
            //     "border",
            //     tuya.valueConverterBasic.lookup({
            //         up: tuya.enum(0),
            //         down: tuya.enum(1),
            //         up_delete: tuya.enum(2),
            //         down_delete: tuya.enum(3),
            //         remove_top_bottom: tuya.enum(4),
            //     }),
            // ],
            // [
            //     107,
            //     "click_control",
            //     tuya.valueConverterBasic.lookup({
            //         up: tuya.enum(0),
            //         down: tuya.enum(1),
            //     }),
            // ],
        ],
    },
};

module.exports = definition;

@Koenkk Koenkk merged commit 9591399 into Koenkk:master Dec 19, 2025
3 checks passed
@Koenkk
Copy link
Copy Markdown
Owner

Koenkk commented Dec 19, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants