NodeJS Module: node-domoticz-mqtt

Client tools or tools that can connect with Domoticz. Tools for Windows, iOS, Android, Linux etc.

Moderator: leecollings

User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: NodeJS Module: node-domoticz-mqtt

Post by emme »

uh... switch off and back on doesn't work... got to try this!!! :D
do you have any error in domoticz log?

the strange thing is..... I do NOT have this issue with scenarios (that goes only ON ) or groups (that can be go OFF either)
The most dangerous phrase in any language is:
"We always done this way"
Charley
Posts: 24
Joined: Tuesday 06 March 2018 12:20
Target OS: Raspberry Pi / ODroid
Domoticz version: V3.9030
Location: Netherlands
Contact:

Re: NodeJS Module: node-domoticz-mqtt

Post by Charley »

Now the On and Off are both working.
But I may have found the problem with setting the color

Code: Select all

2018-07-12 17:04:08.079 MQTT: Topic: domoticz/in, Message: {"command":"switchlight","idx":59,"switchcmd":"Off"}
2018-07-12 17:04:23.754 MQTT: Topic: domoticz/in, Message: {"command":"switchlight","idx":59,"switchcmd":"On"}
2018-07-12 17:04:28.752 MQTT: Topic: domoticz/in, Message: {"command":"setcolbrightnessvalue","idx":59,"hex":"FF0B85","brightness":90,"iswhite":false}
2018-07-12 17:04:28.752 Status: MQTT: setcolbrightnessvalue: ID: 3b, bri: 100, color: '{m: 3, RGB: ff0a84, CWWW: 0000, CT: 0}'
2018-07-12 17:04:42.385 MQTT: Topic: domoticz/in, Message: {"command":"switchlight","idx":59,"switchcmd":"On"}
2018-07-12 17:05:30.416 MQTT: Topic: domoticz/in, Message: {"command":"switchlight","idx":59,"switchcmd":"Off"}
2018-07-12 17:05:41.778 MQTT: Topic: domoticz/in, Message: {"command":"switchlight","idx":59,"switchcmd":"On"}
2018-07-12 17:05:53.740 MQTT: Topic: domoticz/in, Message: {"command":"setcolbrightnessvalue","idx":59,"hex":"FF0B85","brightness":90,"iswhite":false}
2018-07-12 17:05:53.740 Status: MQTT: setcolbrightnessvalue: ID: 3b, bri: 100, color: '{m: 3, RGB: ff0a84, CWWW: 0000, CT: 0}'
Domoticz uses hex for the idx
and the color on status MQTT is different
khouloud
Posts: 1
Joined: Wednesday 24 April 2019 9:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: NodeJS Module: node-domoticz-mqtt

Post by khouloud »

Hello
need your help please
I have a setup domoticz on my raspberry pi I get the value H / T, Brightness, window status, air conditioner state. and now I want to create a platform web to visualize this data the question:
It is possible to exploit this data from domoticz via node.js or node Red to send them on the web platform
they are tuto to help me ?
help me please
Kenneth9
Posts: 1
Joined: Friday 20 September 2019 11:15
Target OS: -
Domoticz version:
Contact:

Re: NodeJS Module: node-domoticz-mqtt

Post by Kenneth9 »

This is a great function for node-red and I got it working www.subway.com However I struggle to see how I can get this data into domoticz? I have setup the MQTT in domoticz and it is subscribed but I'm not sure where to go from there.
Last edited by Kenneth9 on Saturday 21 September 2019 10:49, edited 1 time in total.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: NodeJS Module: node-domoticz-mqtt

Post by waaren »

Kenneth9 wrote: Friday 20 September 2019 11:18 This is a great function for node-red and I got it working. However I struggle to see how I can get this data into domoticz? I have setup the MQTT in domoticz and it is subscribed but I'm not sure where to go from there.
Did you find this wiki page on MQTT <-> domoticz ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
FireWizard
Posts: 1863
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: NodeJS Module: node-domoticz-mqtt

Post by FireWizard »

Hi,

In addition to waaren's link to the MQTT wiki, I also recommend reading the information in this link: https://piandmore.wordpress.com/.

Regards
User avatar
Westcott
Posts: 423
Joined: Tuesday 09 December 2014 17:04
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: UK - Glos
Contact:

Re: NodeJS Module: node-domoticz-mqtt

Post by Westcott »

Hiya Nayr,
Thanks for writing this library!
For my first-ever Node.js project, it's part of a Tuya devices control script.
I've had to modify your library library slightly to catch bad JSON reads.

Code: Select all

 SyntaxError: Unexpected token O in JSON at position 1

Code: Select all

domoMQTT.on('message', function (topic, message) {
                try {
                        var jsonData = JSON.parse(message)
                        if (TRACE) { console.log('MQTT IN: ' + message.toString()) };
                        if (IDX.contains(jsonData.idx)) {
                                self.mqttData(jsonData);
                        }
                } catch(e) {
                        console.log('MQTT IN: ' + e);
                }
        });
Zwave - Sigma Z+ stick, Fibaro, Horstmann, Neo Coolcam, EUROtronic
RFlink - IR detectors and temperatures
Wifi - YeeLights, ESP32s, Anoop sockets
Zigbee - lots with zigbee2mqtt and ZbBridge
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest