Coder Social home page Coder Social logo

Comments (5)

Koenkk avatar Koenkk commented on August 29, 2024 1

@marc-gist that online/offline state is not accurate, if you can control the device, you can ignore this.

from zigbee-herdsman-converters.

marc-gist avatar marc-gist commented on August 29, 2024

Well, solved my own question: please check and see if i did this right (sorry, didn't do in git forked yet, please add from here if you are willing).

devices.js

// smartthings
{
    zigbeeModel: ['outlet'],
    model: 'IM6001-OTP05',
    vendor: 'Samsung',
    description: 'Smartthings Outlet',
    supports: 'on/off',
    fromZigbee: [fz.samsung_outlet, fz.samsung_outlet_report],
    toZigbee: [tz.samsung_on_off],
    configure: (ieeeAddr, shepherd, coordinator, callback) => {
            const device = shepherd.find(ieeeAddr, 1);
            const cfg = {direction: 0, attrId: 0, dataType: 16, minRepIntval: 0, maxRepIntval: 1000, repChange: 0};
                        const actions = [
                                                (cb) => device.bind('genOnOff', coordinator, cb),
                                                (cb) => device.foundation('genOnOff', 'configReport', [cfg], foundationCfg, cb),
                                            ];

                execute(device, actions, callback);
    },
},

fromZigbee.js

samsung_outlet: {
            cid: 'genOnOff',
            type: 'devChange',
            convert: (model, msg, publish, options) => {
                    //console.log(msg.data);
                    return {state: msg.data.data.onOff === 1 ? 'ON' : 'OFF'};
            },
    },
    samsung_outlet_report: {
            cid: 'genOnOff',
            type: 'attReport',
            convert: (model, msg, publish, options) => {
                    return;
            },
    },

toZigbee.js

samsung_on_off: {
key: ['state'],
convert: (key, value, message, type, postfix) => {
    const cid = 'genOnOff';
    const attrId = 'onOff';

    let state = value.toLowerCase();
    if (state === 'on' ) {
            state = 1;
    } else if ( state === 'off' ) {
            state = 0;
    } else {
            return;
    }

    if (type === 'set') {
        if (typeof value !== 'string') {
            return;
        }

        return {
            cid: cid,
            cmd: state,
            cmdType: 'functional',
            zclData: {
            },
            cfg: cfg.default,
        };
    } else if (type === 'get') {
        return {
            cid: cid,
            cmd: 'read',
            cmdType: 'foundation',
            zclData: [{attrId: zclId.attr(cid, attrId).value}],
            cfg: cfg.default,
            };
        }
    },
},    

So "get" doesn't do anything... not sure why, but do i care?

from zigbee-herdsman-converters.

marc-gist avatar marc-gist commented on August 29, 2024

added pull request on cleaned up code and fork. #286

from zigbee-herdsman-converters.

marc-gist avatar marc-gist commented on August 29, 2024

An issue I found... seems as though the plug doesn't act as a router, even though its labeled as one in the logs and on the admin. If i fetch a network map it shows as offline

from zigbee-herdsman-converters.

stale avatar stale commented on August 29, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from zigbee-herdsman-converters.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.