Page 15 of 19

Re: [90] MQTT Support

Posted: Friday 14 October 2016 11:58
by SchattenMann
don't think you can, you'll need to use http instead

Re: [90] MQTT Support

Posted: Saturday 15 October 2016 8:05
by sj3fk3
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).

Re: [90] MQTT Support

Posted: Monday 12 December 2016 20:57
by SchattenMann
Are there any plans to continue improving MQTT supported commands such as setcolbrightnessvalue?

Re: [90] MQTT Support

Posted: Monday 16 January 2017 21:22
by Vandaag
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

Re: [90] MQTT Support

Posted: Sunday 23 April 2017 19:55
by juha
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

Re: [90] MQTT Support

Posted: Friday 02 June 2017 11:39
by Antori91
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,

Re: [90] MQTT Support

Posted: Friday 02 June 2017 11:46
by SweetPants
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"
}

Re: [90] MQTT Support

Posted: Friday 02 June 2017 12:30
by Antori91
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?

Re: [90] MQTT Support

Posted: Friday 02 June 2017 12:37
by SweetPants
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

Re: [90] MQTT Support

Posted: Friday 02 June 2017 16:02
by Antori91
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...

Re: [90] MQTT Support

Posted: Sunday 04 June 2017 11:44
by Antori91
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.

Re: [90] MQTT Support

Posted: Monday 31 July 2017 18:44
by mvveelen
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

root@DiskStation:/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 ?

Re: [90] MQTT Support

Posted: Monday 07 August 2017 4:43
by Wob76
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

Re: [90] MQTT Support

Posted: Monday 07 August 2017 7:42
by mrf68
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

Re: [90] MQTT Support

Posted: Monday 07 August 2017 8:45
by Wob76
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

Re: [90] MQTT Support

Posted: Saturday 21 October 2017 17:00
by salopette
Hello, can someone help me remove my device from domoticz?
It was a virtual switch 205, which I have from the hardware etnfertn, but it still come complaining about MQTT purely.
How can I delete this?

RFLink Detected, Version: 1.1 Revision: 48 Build: 4
2017-10-21 16:36:41.301 MQTT: Subscribed
2017-10-21 16:36:41.402 MQTT: Topic: domoticz/in, Message: {"idx": 205, "nvalue": 0, "svalue": ""}
2017-10-21 16:36:41.402 Error: MQTT: unknown idx received!

I can not find this switch nowhere!
And also other switches do not have this IDx 205

Thank you!

Re: [90] MQTT Support

Posted: Sunday 22 October 2017 12:10
by wim57
Well, something other than Domoticz (maybe ESP8266?) may be publishing a message for idx 205.

Re: [90] MQTT Support

Posted: Sunday 22 October 2017 12:13
by salopette
No I have no other devices on the net which communicate via Mqtt.
the problem but already solved I believe!

sudo service mosquitto stop
sudo rm /var/lib/mosquitto/mosquitto.db
sudo service mosquitto start

Re: [90] MQTT Support

Posted: Saturday 04 November 2017 19:14
by mvveelen
mvveelen wrote: 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

root@DiskStation:/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 ?
Anyone?

The problem I'm facing: I have a Sonoff with Tasmota which is switched from Domoticz using MQTT (at least, I THINK it works that way, because I don't have any http URL's in the On / OFF settings of the switch). Sometimes the Sonoff loses the connection to my WiFi network and when Domoticz tells the Sonoff to switch, this switching isn't issued when the Sonoff comes back online in the WiFi network. I would expect it to issue the last switch command , but it doesn't.

How to fix ?

Re: [90] MQTT Support

Posted: Sunday 05 November 2017 11:33
by SweetPants
mvveelen wrote: Saturday 04 November 2017 19:14 The problem I'm facing: I have a Sonoff with Tasmota which is switched from Domoticz using MQTT (at least, I THINK it works that way, because I don't have any http URL's in the On / OFF settings of the switch). Sometimes the Sonoff loses the connection to my WiFi network and when Domoticz tells the Sonoff to switch, this switching isn't issued when the Sonoff comes back online in the WiFi network. I would expect it to issue the last switch command , but it doesn't.

How to fix ?
You have to send the message as a retained message so the broker can send it after re-connect. Domoticz itself does not know that your sonoff was disconnected