Inteligentny bezpiecznik ZMB9-Z-4P z pomiarem mocy 3fazy - podłączenie do Zigbee2MQTT Home Assistant

Witajcie, zakupiłem chiński bezpiecznik z myślą o monitorowaniu zużycia energii przez przepływowy ogrzewacz wody i dodatkowo zrobienia automatyzacji - działa gdy pompa ciepła nie daje wystarczającej temperatury. Mam Home Assistant na Promoxie, dongle CC2531.

Po podłączeniu i ustawieniu w trybie Pairing Zigbee2MQTT pokazuje w logu:

usunięte, okazuje się, że log nie dotyczył tego urządzenia

Urządzenia nie znajduje przez Zigbee2MQTT, nie ma jego wspomnienia w logach.

Nie znalazłem rozwiązania poza:

Dobra, wykonałem krok naprzód i udało się połączyć. Typowe zachowanie, nie wyszukuje urządzeń nowych bez restartu. Niemniej mam logi. Urządzenie jest niewspierane… Poniżej wklejam

18:25:43: Device '0xa4c13820e5ef826c' joined
info  2022-11-05 18:25:43: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0xa4c13820e5ef826c","ieee_address":"0xa4c13820e5ef826c"},"type":"device_joined"}'
info  2022-11-05 18:25:43: MQTT publish: topic 'zigbee2mqtt/0xa4c13820e5ef826c/availability', payload '{"state":"online"}'
info  2022-11-05 18:25:43: Starting interview of '0xa4c13820e5ef826c'
info  2022-11-05 18:25:43: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0xa4c13820e5ef826c","ieee_address":"0xa4c13820e5ef826c","status":"started"},"type":"device_interview"}'
debug 2022-11-05 18:25:43: Device '0xa4c13820e5ef826c' announced itself
info  2022-11-05 18:25:43: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"friendly_name":"0xa4c13820e5ef826c","ieee_address":"0xa4c13820e5ef826c"},"type":"device_announce"}'
debug 2022-11-05 18:25:44: Received Zigbee message from '0xa4c13820e5ef826c', type 'readResponse', cluster 'genBasic', data '{"modelId":"TS0601"}' from endpoint 1 with groupID 0
debug 2022-11-05 18:25:44: Skipping message, definition is undefined and still interviewing
debug 2022-11-05 18:25:44: Received Zigbee message from '0xa4c13820e5ef826c', type 'readResponse', cluster 'genBasic', data '{"manufacturerName":"_TZE200_abatw3kj"}' from endpoint 1 with groupID 0
debug 2022-11-05 18:25:44: Skipping message, definition is undefined and still interviewing
debug 2022-11-05 18:25:44: Received Zigbee message from '0xa4c13820e5ef826c', type 'readResponse', cluster 'genBasic', data '{"powerSource":1}' from endpoint 1 with groupID 0
debug 2022-11-05 18:25:44: Skipping message, definition is undefined and still interviewing
debug 2022-11-05 18:25:44: Received Zigbee message from '0xa4c13820e5ef826c', type 'readResponse', cluster 'genBasic', data '{"zclVersion":3}' from endpoint 1 with groupID 0
debug 2022-11-05 18:25:44: Skipping message, definition is undefined and still interviewing
debug 2022-11-05 18:25:44: Received Zigbee message from '0xa4c13820e5ef826c', type 'readResponse', cluster 'genBasic', data '{"appVersion":64}' from endpoint 1 with groupID 0
debug 2022-11-05 18:25:44: Skipping message, definition is undefined and still interviewing
debug 2022-11-05 18:25:44: Received Zigbee message from '0xa4c13820e5ef826c', type 'readResponse', cluster 'genBasic', data '{"stackVersion":0}' from endpoint 1 with groupID 0
debug 2022-11-05 18:25:44: Skipping message, definition is undefined and still interviewing
debug 2022-11-05 18:25:44: Received Zigbee message from '0xa4c13820e5ef826c', type 'readResponse', cluster 'genBasic', data '{"hwVersion":1}' from endpoint 1 with groupID 0
debug 2022-11-05 18:25:44: Skipping message, definition is undefined and still interviewing
debug 2022-11-05 18:25:44: Received Zigbee message from '0xa4c13820e5ef826c', type 'readResponse', cluster 'genBasic', data '{"dateCode":""}' from endpoint 1 with groupID 0
debug 2022-11-05 18:25:44: Skipping message, definition is undefined and still interviewing
debug 2022-11-05 18:25:45: Received Zigbee message from '0xa4c13820e5ef826c', type 'readResponse', cluster 'genBasic', data '{}' from endpoint 1 with groupID 0
debug 2022-11-05 18:25:45: Skipping message, definition is undefined and still interviewing
info  2022-11-05 18:25:45: Successfully interviewed '0xa4c13820e5ef826c', device has successfully been paired
warn  2022-11-05 18:25:45: Device '0xa4c13820e5ef826c' with Zigbee model 'TS0601' and manufacturer name '_TZE200_abatw3kj' is NOT supported, please follow https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html
info  2022-11-05 18:25:45: MQTT publish: topic 'zigbee2mqtt/bridge/event', payload '{"data":{"definition":null,"friendly_name":"0xa4c13820e5ef826c","ieee_address":"0xa4c13820e5ef826c","status":"successful","supported":false},"type":"device_interview"}'

Szukam dalej…

Zajrzyj tutaj
https://github.com/Koenkk/zigbee2mqtt/issues/12828

Plik dla zewnętrznego konwertera Z2M

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 e = exposes.presets;
const ea = exposes.access;
const extend = require('zigbee-herdsman-converters/lib/extend');
const tuya = require("zigbee-herdsman-converters/lib/tuya");

const fzLocal = {
    tuya_dinrail_switch: {
        cluster: 'manuSpecificTuya',
        type: ['commandDataResponse', 'commandDataReport'],
        convert: (model, msg, publish, options, meta) => {
            for (const dpValue of msg.data.dpValues) {
                const value = tuya.getDataValue(dpValue);
                const dp = dpValue.dp
                meta.logger.info(`RECEIVED DP #${dp} -- VALUE = ${value}`);

                switch (dp) {
                    case 16: // DPID that we added to common
                        return {
                            state: value ? 'ON' : 'OFF'
                        };
                    case 1:
                        return {
                            energy: value / 100
                        };
                    case 6:   
                     return {
                            current: (value[4] / 1000), voltage: (value[1]), power: value[7]
                        };
                    case 9:{
                        meta.logger.warn(`zigbee-herdsman-converters:: NOT RECOGNIZED DP ` +
                            `#${dp} with data ${JSON.stringify(msg.data)} VALUE = ${value}`);
                    };
                    case 17:{
                        meta.logger.warn(`zigbee-herdsman-converters:: NOT RECOGNIZED DP ` +
                            `#${dp} with data ${JSON.stringify(msg.data)} VALUE = ${value}`);
                    };
                    case 18:{
                        meta.logger.warn(`zigbee-herdsman-converters:: NOT RECOGNIZED DP ` +
                            `#${dp} with data ${JSON.stringify(msg.data)} VALUE = ${value}`);
                    };
                    default: {
                        meta.logger.warn(`zigbee-herdsman-converters:: NOT RECOGNIZED DP ` +
                            `#${dp} with data ${JSON.stringify(msg.data)} VALUE = ${value}`);
                    };
                }
            }
        },
    },
};


const tzLocal = {
    state: {
        key: ['state'],
        convertSet: async (entity, key, value, meta) => {
            await tuya.sendDataPointBool(entity, 16, value === 'ON');
        },
    },


};


const definition = {
    fingerprint: [{
        modelID: 'TS0601',
        manufacturerName: '_TZE200_abatw3kj'
    }],
    model: 'ZCB16-2P',
    vendor: 'RTX',
    extend: extend.switch(),
    description: 'Circuit breaker with meter',
    fromZigbee: [fzLocal.tuya_dinrail_switch, ],
    toZigbee: [tzLocal.state],
    configure: async (device, coordinatorEndpoint, logger) => {
        const endpoint = device.getEndpoint(1);
        await reporting.bind(endpoint, coordinatorEndpoint, ['genBasic']);
    },
    exposes: [e.switch().setAccess('state', ea.STATE_SET), e.voltage(), e.power(), e.current(), e.energy()],
};

module.exports = definition;
2 polubienia

Dzięki artpc, miałem to na tapecie, myślałem że 2p nie zadziała na urządzeniu 4p. Jednak połączyło się.

Zatem udało się podłączyć urządzenie testowo (tylko zasilam jedną fazą przed finalnym montażem). Mam jednak parę wątpliwości, dlatego pochwalę się logami.

debug 2022-11-06 11:52:19: Received MQTT message on 'homeassistant/switch/0xa4c13820e5ef826c/switch/config' with data '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0xa4c13820e5ef826c/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","command_topic":"zigbee2mqtt/0xa4c13820e5ef826c/set","device":{"identifiers":["zigbee2mqtt_0xa4c13820e5ef826c"],"manufacturer":"SINOTIMER","model":"Circuit breaker 4P with meter (ZCB16-2P)","name":"0xa4c13820e5ef826c"},"name":"0xa4c13820e5ef826c","payload_off":"OFF","payload_on":"ON","state_topic":"zigbee2mqtt/0xa4c13820e5ef826c","unique_id":"0xa4c13820e5ef826c_switch_zigbee2mqtt","value_template":"{{ value_json.state }}"}'
debug 2022-11-06 11:52:19: Received MQTT message on 'homeassistant/sensor/0xa4c13820e5ef826c/voltage/config' with data '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0xa4c13820e5ef826c/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c13820e5ef826c"],"manufacturer":"SINOTIMER","model":"Circuit breaker 4P with meter (ZCB16-2P)","name":"0xa4c13820e5ef826c"},"device_class":"voltage","enabled_by_default":false,"entity_category":"diagnostic","name":"0xa4c13820e5ef826c voltage","state_class":"measurement","state_topic":"zigbee2mqtt/0xa4c13820e5ef826c","unique_id":"0xa4c13820e5ef826c_voltage_zigbee2mqtt","unit_of_measurement":"V","value_template":"{{ value_json.voltage }}"}'
debug 2022-11-06 11:52:19: Received MQTT message on 'homeassistant/sensor/0xa4c13820e5ef826c/power/config' with data '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0xa4c13820e5ef826c/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c13820e5ef826c"],"manufacturer":"SINOTIMER","model":"Circuit breaker 4P with meter (ZCB16-2P)","name":"0xa4c13820e5ef826c"},"device_class":"power","enabled_by_default":true,"entity_category":"diagnostic","name":"0xa4c13820e5ef826c power","state_class":"measurement","state_topic":"zigbee2mqtt/0xa4c13820e5ef826c","unique_id":"0xa4c13820e5ef826c_power_zigbee2mqtt","unit_of_measurement":"W","value_template":"{{ value_json.power }}"}'
debug 2022-11-06 11:52:19: Received MQTT message on 'homeassistant/sensor/0xa4c13820e5ef826c/current/config' with data '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0xa4c13820e5ef826c/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c13820e5ef826c"],"manufacturer":"SINOTIMER","model":"Circuit breaker 4P with meter (ZCB16-2P)","name":"0xa4c13820e5ef826c"},"device_class":"current","enabled_by_default":false,"entity_category":"diagnostic","name":"0xa4c13820e5ef826c current","state_class":"measurement","state_topic":"zigbee2mqtt/0xa4c13820e5ef826c","unique_id":"0xa4c13820e5ef826c_current_zigbee2mqtt","unit_of_measurement":"A","value_template":"{{ value_json.current }}"}'
debug 2022-11-06 11:52:19: Received MQTT message on 'homeassistant/sensor/0xa4c13820e5ef826c/energy/config' with data '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0xa4c13820e5ef826c/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c13820e5ef826c"],"manufacturer":"SINOTIMER","model":"Circuit breaker 4P with meter (ZCB16-2P)","name":"0xa4c13820e5ef826c"},"device_class":"energy","enabled_by_default":true,"name":"0xa4c13820e5ef826c energy","state_class":"total_increasing","state_topic":"zigbee2mqtt/0xa4c13820e5ef826c","unique_id":"0xa4c13820e5ef826c_energy_zigbee2mqtt","unit_of_measurement":"kWh","value_template":"{{ value_json.energy }}"}'
debug 2022-11-06 11:52:19: Received MQTT message on 'homeassistant/sensor/0xa4c13820e5ef826c/linkquality/config' with data '{"availability":[{"topic":"zigbee2mqtt/bridge/state","value_template":"{{ value_json.state }}"},{"topic":"zigbee2mqtt/0xa4c13820e5ef826c/availability","value_template":"{{ value_json.state }}"}],"availability_mode":"all","device":{"identifiers":["zigbee2mqtt_0xa4c13820e5ef826c"],"manufacturer":"SINOTIMER","model":"Circuit breaker 4P with meter (ZCB16-2P)","name":"0xa4c13820e5ef826c"},"enabled_by_default":false,"entity_category":"diagnostic","icon":"mdi:signal","name":"0xa4c13820e5ef826c linkquality","state_class":"measurement","state_topic":"zigbee2mqtt/0xa4c13820e5ef826c","unique_id":"0xa4c13820e5ef826c_linkquality_zigbee2mqtt","unit_of_measurement":"lqi","value_template":"{{ value_json.linkquality }}"}'

powyższe wygląda spoko, mamy jednak jeszcze:

debug 2022-11-06 11:52:20: Received Zigbee message from '0xa4c13820e5ef826c', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0],"type":"Buffer"},"datatype":1,"dp":16}],"seq":2304}' from endpoint 1 with groupID 0
info  2022-11-06 11:52:20: RECEIVED DP #16 -- VALUE = false
info  2022-11-06 11:52:20: MQTT publish: topic 'zigbee2mqtt/0xa4c13820e5ef826c', payload '{"current":null,"energy":null,"linkquality":78,"power":null,"state":"OFF","voltage":null}'
debug 2022-11-06 11:52:20: Received Zigbee message from '0xa4c13820e5ef826c', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0,0,0,0],"type":"Buffer"},"datatype":2,"dp":1}],"seq":2560}' from endpoint 1 with groupID 0
info  2022-11-06 11:52:20: RECEIVED DP #1 -- VALUE = 0
info  2022-11-06 11:52:20: MQTT publish: topic 'zigbee2mqtt/0xa4c13820e5ef826c', payload '{"current":null,"energy":0,"linkquality":78,"power":null,"state":"OFF","voltage":null}'
debug 2022-11-06 11:52:20: Received Zigbee message from '0xa4c13820e5ef826c', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0],"type":"Buffer"},"datatype":5,"dp":9}],"seq":2816}' from endpoint 1 with groupID 0
info  2022-11-06 11:52:20: RECEIVED DP #9 -- VALUE = 0
warn  2022-11-06 11:52:20: zigbee-herdsman-converters:: NOT RECOGNIZED DP #9 with data {"seq":2816,"dpValues":[{"dp":9,"datatype":5,"data":{"type":"Buffer","data":[0]}}]} VALUE = 0
debug 2022-11-06 11:52:20: Received Zigbee message from '0xa4c13820e5ef826c', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[9,96,0,0,0,0,0,0],"type":"Buffer"},"datatype":0,"dp":6}],"seq":3072}' from endpoint 1 with groupID 0
info  2022-11-06 11:52:20: RECEIVED DP #6 -- VALUE = 	`      
info  2022-11-06 11:52:20: MQTT publish: topic 'zigbee2mqtt/0xa4c13820e5ef826c', payload '{"current":0,"energy":0,"linkquality":81,"power":0,"state":"OFF","voltage":96}'
debug 2022-11-06 11:52:20: Received Zigbee message from '0xa4c13820e5ef826c', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[1,1,0,63,3,1,1,19,4,1,0,175],"type":"Buffer"},"datatype":0,"dp":18}],"seq":3328}' from endpoint 1 with groupID 0
info  2022-11-06 11:52:20: RECEIVED DP #18 -- VALUE =  ? �
warn  2022-11-06 11:52:20: zigbee-herdsman-converters:: NOT RECOGNIZED DP #18 with data {"seq":3328,"dpValues":[{"dp":18,"datatype":0,"data":{"type":"Buffer","data":[1,1,0,63,3,1,1,19,4,1,0,175]}}]} VALUE =  ? �
warn  2022-11-06 11:52:20: zigbee-herdsman-converters:: NOT RECOGNIZED DP #18 with data {"seq":3328,"dpValues":[{"dp":18,"datatype":0,"data":{"type":"Buffer","data":[1,1,0,63,3,1,1,19,4,1,0,175]}}]} VALUE =  ? �
debug 2022-11-06 11:52:20: Received Zigbee message from '0xa4c13820e5ef826c', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[69,84,85,49,45,73,79,84,45,90,105,103,98,101,101,0],"type":"Buffer"},"datatype":3,"dp":19}],"seq":3584}' from endpoint 1 with groupID 0
info  2022-11-06 11:52:20: RECEIVED DP #19 -- VALUE = ETU1-IOT-Zigbee 
warn  2022-11-06 11:52:20: zigbee-herdsman-converters:: NOT RECOGNIZED DP #19 with data {"seq":3584,"dpValues":[{"dp":19,"datatype":3,"data":{"type":"Buffer","data":[69,84,85,49,45,73,79,84,45,90,105,103,98,101,101,0]}}]} VALUE = ETU1-IOT-Zigbee 

Rozumiem, że wynika to z tego, że są przesyłane nieskonfigurowane w konwerterze dane na innych kanałach? Jak się do tego dobrać? Urządzenie ma mieć również nastaw zabezpieczenia, przy którym wyrzuca zabezpieczenie. Dobrze byłoby to zidentyfikować.

Witajcie, u mnie temat podobny, bezpiecznik 1 fazowy i mam w logach:

2023-07-27 16:47:49Received Zigbee message from '0xa4c1384c97edfb66', type 'commandDataReport', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[1,1,0,16,3,1,1,19,4,1,0,175],"type":"Buffer"},"datatype":0,"dp":18}],"seq":4376}' from endpoint 1 with groupID null
2023-07-27 16:47:49TypeError: tuya.getDataValue is not a function at Object.convert (/app/data/extension/externally-loaded.js:17:36) at Receive.onDeviceMessage (/app/lib/extension/receive.ts:150:51) at EventEmitter.emit (node:events:525:35) at EventBus.emitDeviceMessage (/app/lib/eventBus.ts:102:22) at Controller.<anonymous> (/app/lib/zigbee.ts:106:27) at Controller.emit (node:events:513:28) at Controller.selfAndDeviceEmit (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:515:14) at Controller.onZclOrRawData (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:726:18) at DeconzAdapter.<anonymous> (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:144:70) at DeconzAdapter.emit (node:events:513:28)

dodam tylko ze to hassio + zigbee2mqtt edge add-on.

a error:

Exception while calling fromZigbee converter: tuya.getDataValue is not a function}

Bezpiecznik działa ?

Sam fizycznie działa, natomiast brak jest możliwości sterowania nim z HA, nie ma pomiaru, nie można konfigurować ani sterować samym switchem.

Ten błąd co masz możesz rozwiązać dodając do swojego konwertera

(na górze)

const legacy = require('zigbee-herdsman-converters/lib/legacy');

i zmień

tuya.getDataValue

na

legacy.getDataValue

W ten sposób urządzenie już coś tam udostępnia niestety dane wyglądają na śmieciowe (konwerter jest od warsji 1-fazowej)

W logach Z2M będzie sporo warningów o nierozpoznanych datapointach.
Gdyby udało nam się rozgryźć, co jest od czego to może udałoby się w końcu stworzyć działający konwerter dla tego urządzenia :slight_smile:

Pozdrawiam

1 polubienie

Poniżej działający kod dla bezpieczników. Podstawowe informacje i możliwość włączania wyłączania.

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 {Buffer} = require('buffer');

const phaseVariantNew = {
    from: (v) => {
        const buf = Buffer.from(v, 'base64');
        return {
        voltage: (   (buf[0] << 8)  | buf[1]    ) / 10,
        current: (   (buf[2] << 16) |  (buf[3] << 8)  |  buf[4]   ) / 1000,
        power : (    (buf[5] << 16) |  (buf[6] << 8)  |  buf[7]   )
        }; 
    },
  };


const definition = {
    fingerprint: [
        {
            modelID: 'TS0601',
            manufacturerName: '_TZE200_abatw3kj',
        },
    ],
    model: 'TS0601_badz3redition',
    vendor: 'RTX',
    description: 'Circuit breaker with meter',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    onEvent: tuya.onEventSetTime,
    configure: tuya.configureMagicPacket,
    exposes: [e.switch(),e.energy(),e.current(),e.voltage(),e.power(),

    ],
    meta: {
        // All datapoints go in here
        tuyaDatapoints: [
            [1,'energy',tuya.valueConverter.divideBy100],
            [6, null, phaseVariantNew],
            [16, 'state', tuya.valueConverter.onOff],
        ],
    },
    extend: [
        // A preferred new way of extending functionality.
    ],
};

module.exports = definition;

ha