arachnetech / homebridge-mqttthing

A plugin for Homebridge allowing the integration of many different accessory types using MQTT.
Apache License 2.0
462 stars 104 forks source link

Sonoff Zigbee2Tasmota Log Entries #372

Open fototeddy opened 3 years ago

fototeddy commented 3 years ago

Hi,

ich habe a Sonoff Zigbee Bridge with Zigbee2Tasmota Firmware. As Devices I have several Temperature Sensors and 2 TRADFRI Lights.

My Config to get Stats looks like this:

 "accessory": "mqttthing",
"type": "lightbulb",
            "name": "IkeaC",
            "url": "mqtt://192.168.5.102:1883",
            "topics": {
                "getOn": {
                    "topic": "tele/zbb/SENSOR",
                    "apply": "return JSON.parse(message).ZbReceived['IkeaC'].Power;"
                },
                "setOn": {
                    "topic": "cmnd/zbb/ZbSend",
                    "apply": "return '{\"device\":\"IkeaC\", \"send\":{\"Power\":' + message + '}}'"
                },
                "getBrightness": {
                    "topic": "tele/zbb/SENSOR",
                    "apply": "return Math.round(JSON.parse(message).ZbReceived['IkeaC'].Dimmer /2.55)"
                },
                "setBrightness": {
                    "topic": "cmnd/zbb/ZbSend",
                    "apply": "return '{\"device\":\"IkeaC\", \"send\":{\"Dimmer\":' + Math.round(message * 2.55) + '}}'"
                }
            },
            "onValue": "1",
            "offValue": "0"
        },

IkeaC is the Name of the device.

Another Device is called IkeaH and Temp1 till Temp4

Now my HomebridgeLog is full of this entries:

[IkeaC] Decode function apply( message) { return Math.round(JSON.parse(message).ZbReceived['IkeaC'].Dimmer /2.55) } failed for topic tele/zbb/SENSOR with message {"ZbReceived":{"IkeaH":{"Device":"0xBE80","Name":"IkeaH","Power":0,"Endpoint":1,"LinkQuality":31}}} - TypeError: Cannot read property 'Dimmer' of undefined

Is there another way to apply on the Get Topics to avoid these amount auf LogEntries?

tesarm commented 3 years ago

This might help you

https://tasmota.github.io/docs/Commands/#setoption89

SetOption89 Configure MQTT topic for Zigbee devices (also see SensorRetain)0 = single tele/%topic%/SENSOR topic (default)1 = unique device topic based on Zigbee device ShortAddrExample: tele/Zigbee/5ADF/SENSOR = {"ZbReceived":{"0x5ADF":{"Dimmer":254,"Endpoint":1,"LinkQuality":70}}}