[90] MQTT Support

Use this forum to discuss possible implementation of a new feature before opening a ticket.
A developer shall edit the topic title with "[xxx]" where xxx is the id of the accompanying tracker id.
Duplicate posts about the same id. +1 posts are not allowed.
SchattenMann
Posts: 69
Joined: Friday 09 October 2015 19:14
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: [90] MQTT Support

Post by SchattenMann » Friday 14 October 2016 11:58

don't think you can, you'll need to use http instead

sj3fk3
Posts: 27
Joined: Sunday 22 March 2015 7:41
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: [90] MQTT Support

Post by sj3fk3 » Saturday 15 October 2016 8:05

y1ann1s wrote: The only thing I am missing is to get a list of all devices in MQTT
afaik that's not the way a message queue works. It only outputs what "you" put in there and there is no command to send all devices down the pipe. You could trigger all devices and that would make sure that all devices are updated (and put on the queue).

SchattenMann
Posts: 69
Joined: Friday 09 October 2015 19:14
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: [90] MQTT Support

Post by SchattenMann » Monday 12 December 2016 21:57

Are there any plans to continue improving MQTT supported commands such as setcolbrightnessvalue?

Vandaag
Posts: 14
Joined: Sunday 17 November 2013 0:23
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: [90] MQTT Support

Post by Vandaag » Monday 16 January 2017 22:22

Hello,

Currently I am using 2 Domoticz connected to the same MQTT broker. The problem is that I cannot make a distinction from which domoticz server the messages are originating and I am unable to direct messages to a specific domoticz server. Would there be a possibility to extent the MQTT configuration to override the default groupname if needed?

Regards,

Richard

juha
Posts: 1
Joined: Sunday 23 April 2017 18:20
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: [90] MQTT Support

Post by juha » Sunday 23 April 2017 19:55

Can someone help with this one..?

I´ve done Motorized rollerblind HW and trying to add that one to Domoticz.
https://www.instructables.com/id/Motori ... ler-Blind/

I can publish MQTT messages with my cellphone and MMQT.FX and it does work, but how to add this to Domo?
I´m totally n00b with the Domoticz as well.. Broker does work, Mosquitto installed to same RPi than Domoticz. There is an example on tutorial how to use it with OpenHAB, but how with Domoticz is not clear at all.

Item:

Dimmer masterbedr_blind1 "Rullgardin 1" <rollershutter> { mqtt=">[ohab:/house/masterbedroom/rollerblind/0/set:command:*:${command}],<[ohab:/house/masterbedroom/rollerblind/0/status:state:default]" }

Sitemap:

Slider item=masterbedr_blind1

Antori91
Posts: 27
Joined: Sunday 12 February 2017 18:12
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Contact:

Re: [90] MQTT Support

Post by Antori91 » Friday 02 June 2017 11:39

Hello,
It seems that we can't get using MQTT the SunRise SunSet Time. When I publish to domoticz/in topic the following command {"command": "getSunRiseSet"}, Domoticz don't answer to the request. Notice that my need is to get the Domoticz server date/time, so if there is another way than the getSunRiseSet command, please tell me.
Regards,

SweetPants
Posts: 1477
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8423
Location: The Netherlands
Contact:

Re: [90] MQTT Support

Post by SweetPants » Friday 02 June 2017 11:46

Read the Wiki and use JSON https://www.domoticz.com/wiki/Domoticz_ ... nset_times

/json.htm?type=command&param=getSunRiseSet

{
"ServerTime" : "Sep 30 2013 17:15:21",
"Sunrise" : "07:38:00",
"Sunset" : "19:16:00",
"status" : "OK",
"title" : "getSunRiseSet"
}

Antori91
Posts: 27
Joined: Sunday 12 February 2017 18:12
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Contact:

Re: [90] MQTT Support

Post by Antori91 » Friday 02 June 2017 12:30

SweetPants, I red the wiki and know JSON commands. I know that GetSunRise works with HTTP/JSON. I used a lot these JSON commands for a previous DIY project. For a new project, I use MQTT to interface ESP8266 boards with Domoticz, so my question is MQTT relating and NOT JSON.
By the way, do you really read the questions before answering?

SweetPants
Posts: 1477
Joined: Friday 12 July 2013 21:24
Target OS: Linux
Domoticz version: V3.8423
Location: The Netherlands
Contact:

Re: [90] MQTT Support

Post by SweetPants » Friday 02 June 2017 12:37

Antori91 wrote:Hello,
It seems that we can't get using MQTT the SunRise SunSet Time. When I publish to domoticz/in topic the following command {"command": "getSunRiseSet"}, Domoticz don't answer to the request. Notice that my need is to get the Domoticz server date/time, so if there is another way than the getSunRiseSet command, please tell me.
Regards,
Yes, i read the question you tried using MQTT {"command": "getSunRiseSet"} which does not work and asked for another way to get the server date/time, hence i answered. There is no word mentioned in your question that you used JSON already.

And if you want to use MQTT, you can't for this command

Antori91
Posts: 27
Joined: Sunday 12 February 2017 18:12
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Contact:

Re: [90] MQTT Support

Post by Antori91 » Friday 02 June 2017 16:02

OK SweetPants.


PS : my "business case" is the following. I use ESP8266 boards (nodeMCU/Lua/MQTT) to manage Heaters (power up/down and consumption measure using ACS712). They have to know which electricity meter tariff is to use depending on hours. I solve the issue by using a virtual protected selector switch. This selector switch is switched (to reflect the tariff in use) by a time event on Domoticz side. Then, the ESP8266 can know the tariff by requesting Domoticz via MQTT ({"command": "getdeviceinfo", "idx": XX }). ...This is to avoid using the RTC Time Module on ESP8266/NodeMCU side...

Antori91
Posts: 27
Joined: Sunday 12 February 2017 18:12
Target OS: NAS (Synology & others)
Domoticz version: 3.5877
Contact:

Re: [90] MQTT Support

Post by Antori91 » Sunday 04 June 2017 11:44

Hello,
After a bad news (getSunRiseSet not supported) a good news. According to documentation, logmessage is not supposed to work with MQTT channel, but it actually works. {"command" : "addlogmessage", "message" : "MyMessage to log"} to publish. I find this usefull to publish service messages (like lwt MQTT broker message) to Domoticz log.

User avatar
mvveelen
Posts: 608
Joined: Friday 31 October 2014 11:22
Target OS: NAS (Synology & others)
Domoticz version: Beta
Location: Hoorn, The Netherlands
Contact:

Re: [90] MQTT Support

Post by mvveelen » Monday 31 July 2017 18:44

How would one use, for instance, switching in LUA ?

On my Synology I have to browse to the right folder and type:

Code: Select all

[email protected]:/volume1/@appstore/mosquitto/bin# ./mosquitto_pub -h 192.168.0.124 -t 'domoticz/in' -m '{"command": "switchlight", "idx": 4128, "switchcmd": "On"}'
How can I use the MQTT command in a LUA script ?
Synology DS414 DSM6.1 + RFXCOM rfxtrx433E + Aeon Labs Z-Stick v2 + Xiaomi Gateway + Philips HUE Lights + Nefit Easy + Dashticz v2 + Domoticz latest Beta

Wob76
Posts: 50
Joined: Wednesday 19 April 2017 6:31
Target OS: Linux
Domoticz version:
Contact:

Re: [90] MQTT Support

Post by Wob76 » Monday 07 August 2017 4:43

Hi,

Very new to both Domoticz and MQTT. So it is likely I am missing something, but I have searched as best I can.

I am using NodeRed to build some flows to talk to a webpage that controls my Aircon, I first created a flow linked to dummy switches I created in Domoticz, those switched link to the functions on the webpage and it is working great.

I am now building a flow to read the states from the webpage and update the switches to match, this way any changes made to the AC outside of Domoticz will be shown, this is handy if I use the AC App or the control panel itself. This is working, and I have a filter so MQTT messages are only sent if the unit has had a change on the since the last time I polled the page.

But, my issue is, that any update I send to Domonticz/In is then repeated on Domonticz/Out, this then causes my other flow to send updates to the web page to set the states, this is redundant, as it is where I read the states from, and I want to reduce the traffic I send to the page as much as possible. So, is it possible to stop Domoticz from sending MQTT updates for switches that have just been update via MQTT, or doesn't anyone know how I might filter these changes?

Thanks,
Wob

User avatar
mrf68
Posts: 219
Joined: Monday 23 February 2015 13:45
Target OS: Windows
Domoticz version: 3.4834
Location: Netherlands
Contact:

Re: [90] MQTT Support

Post by mrf68 » Monday 07 August 2017 7:42

Hi Wob,

you read the states of the page, so it can tell if there is a difference before sending the commands. You want to minimize the data exchange to the page, so if a message comes from domoticz/out, let node-red check wether the status you have read from the page earlier is different or not. If not, then do nothing, if things are different then update the page.

Maybe another possibility is to add a variable in node-red. When a message is sent from domoticz/in to set a specific switch or setting, set a variable to 1 and read that variable when the same switch or setting is mentioned in a message from domoticz/out. If so, don't send an update to the page but do set the variable to 0 (values 0 and 1 are examples).

Regards,
Martin
----------
3x RPi
1x W2k12 (vm)
3x RFXcom433e
1x Razberry board
KAKU: 9x APA3-1500R, 2x ACDB-7000C, 3x AMST-606, 1x APIR-2150, 1x AWS-3500, 1x ATMT-502
Z-wave: 8x Everspring AN145
Misc: 2x wireless doorbells

Wob76
Posts: 50
Joined: Wednesday 19 April 2017 6:31
Target OS: Linux
Domoticz version:
Contact:

Re: [90] MQTT Support

Post by Wob76 » Monday 07 August 2017 8:45

Hi Martin,

Thanks for the reply, I am using two different flows for data in\out of domoticz so my payload is different, being fairly new to all of this I am sure I am not doing things in the most efficient ways, but I am happy that it is talking.

I did think about storing the state of each switch in variables in nodered, but it seemed redundant since domoticz is already doing that. and I thought it odd that it would issues a MQTT update for a device that it has been updated via MQTT. Just thought I might be missing something, but if this is normal behaviour I'll look at a filtering solution in nodered.

While I am asking dumb questions, can someone just confirm my MQTT formatting.
For the AC I have a number of on\off switches, a couple of selector switches, a temperature and a thermostat.

ON\OFF are easy enough, I issue { "idx" : 30, "nvalue" : 1 } with idx = the the switch and nvalue 0 or 1 for off\on.

The selectors are { "idx" : 29, "svalue" : "10" } with the values as per the switch settings in 10 increments. I needed to ensure my svalue was sent as a strong and not a integer for it to work. I don't set the nvalue on these it just appears to stay as "2", they have no off state. Can anyone tell me what the nvalue does on selectors?

With the Thermostat, I am using the "Dummy" Thermostat, but it takes half degree changes, my AC unit does not, can anyone point me in the right direction on how I can modify it to only accept round numbers?

Thanks,
Wob

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests