MQTT integration

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

pepijn
Posts: 251
Joined: Friday 12 July 2013 13:19
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: The Netherlands
Contact:

Re: MQTT integration

Post by pepijn »

Did you know GPIO is supported native by Domoticz?
Andrex
Posts: 92
Joined: Thursday 18 February 2016 9:11
Target OS: Linux
Domoticz version:
Contact:

Re: MQTT integration

Post by Andrex »

Yes, I see that but my relays are on a separate Pi.
By the way, is there a way to invert the state of the ON/OFF GPIO?
Because my relay board turns ON the relays when the GPIO is 0, so the Domoticz act contrariwise (the switches are all OFF but the relays are all ON).
Thanks!
User avatar
nayr
Posts: 354
Joined: Tuesday 11 November 2014 18:42
Target OS: Linux
Domoticz version: github
Location: Denver, CO - USA
Contact:

Re: MQTT integration

Post by nayr »

Domoticz supports a Master/Slave configuration so you can hook multiple Domo's together and have remote nodes.

and for inverting gpio, try: echo 1> /sys/class/gpio/gpioN/active_low
Debian Jessie: CuBox-i4 (Primary) w/Static Routed IP and x509 / BeagleBone with OpenSprinkler / BeagleBone Planted Aquarium / 3x Raspbery Pi2b GPIO Slaves
Elemental Theme - node-domoticz-mqtt - Home Theatre Controller - AndroidTV Simple OSD Remote - x509 TLS Auth
Andrex
Posts: 92
Joined: Thursday 18 February 2016 9:11
Target OS: Linux
Domoticz version:
Contact:

Re: MQTT integration

Post by Andrex »

Thanks Nayr, the inversion of the GPIO works!!!
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: MQTT integration

Post by Derik »

mmm

What can i do more with MQTT
I did make a MQTT broker with mysensors...
Only i do not understand what i can do with MQTT

What are the settings :
ScreenShot061.jpg
ScreenShot061.jpg (88.93 KiB) Viewed 3492 times
And what are the best/beautiful options that in can make, with this...

And it is always so simple ;) what can i do with MQTT and Node red??
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
salvacalatayud
Posts: 112
Joined: Monday 26 June 2017 21:16
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Spain
Contact:

Re: MQTT integration

Post by salvacalatayud »

I'm new in all this domoticz things. What I want to know is how to translate the domoticz mqtt in order to manage a modbus plc. What I want is to integrate a plc into domoticz via node red.

Thanks
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: MQTT integration

Post by salopette »

Hello, I have a question if someone can help me?
Please excuse me for my English, I use Google Translate.

How can I connect this sketch with domoticz and controll?

https://github.com/thexperiments/esp826 ... tt_gateway



Thank you!
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: MQTT integration

Post by salopette »

Can someone tell me
How can I control this in Domoticz?

Default topic is /ZB40_GATEWAY. You can controll it via MQTT with the following topics.

Topic Payload (only one at a time)
/ZB40_GATEWAY/ALL/ up, down, stop
/ZB40_GATEWAY/1/ up, down, stop
/ZB40_GATEWAY/2/ up, down, stop
/ZB40_GATEWAY/3/ up, down, stop
SweetPants

Re: MQTT integration

Post by SweetPants »

salopette wrote: Tuesday 17 October 2017 22:50 Can someone tell me
How can I control this in Domoticz?

Default topic is /ZB40_GATEWAY. You can controll it via MQTT with the following topics.

Topic Payload (only one at a time)
/ZB40_GATEWAY/ALL/ up, down, stop
/ZB40_GATEWAY/1/ up, down, stop
/ZB40_GATEWAY/2/ up, down, stop
/ZB40_GATEWAY/3/ up, down, stop
If you have a (mosquitto) MQTT broker installed and working, you can create dummy switches and send commands using mosquitto_pub
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: MQTT integration

Post by salopette »

Yes I have Mqtt Brocker installed on Raspberry.
and I control my Sonoff relay with it.
Have also created virtual switches, but I do not understand where and how I must insert the lines with Domoticz.
/ZB40_GATEWAY/ALL/ up, down, stop

Image

Could someone describe it to me exactly?

Thank you
SweetPants

Re: MQTT integration

Post by SweetPants »

Domoticz has two topics domoticz/in and domoticz/out. Please take a look at https://www.domoticz.com/wiki/MQTT for different JSON formats to send/receive
salopette
Posts: 187
Joined: Tuesday 07 March 2017 21:03
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Germany
Contact:

Re: MQTT integration

Post by salopette »

Hello, I have looked here https://www.domoticz.com/wiki/MQTT, but I do not understand how I have to adjust in the sketch?

I now create a Virtuall switch, when I enter the command via browser, I see everything.
But how do I go on?
my MQTT is on 192.168.178.37/ port 1883

http://192.168.178.37:8080/json.htm?typ ... es&rid=266

Code: Select all

{
ActTime: 1508492733,
ServerTime: "2017-10-20 11:45:33",
Sunrise: "07:56",
Sunset: "18:14",
result: [
{
AddjMulti: 1,
AddjMulti2: 1,
AddjValue: 0,
AddjValue2: 0,
BatteryLevel: 255,
CustomImage: 0,
Data: "Open",
Description: "",
Favorite: 0,
HardwareID: 7,
HardwareName: "Virtual",
HardwareType: "Dummy (Does nothing, use for virtual switches only)",
HardwareTypeVal: 15,
HaveDimmer: true,
HaveGroupCmd: true,
HaveTimeout: false,
ID: "0001415A",
Image: "Light",
IsSubDevice: false,
LastUpdate: "2017-10-20 08:47:18",
Level: 0,
LevelInt: 0,
MaxDimLevel: 100,
Name: "/ZB40_GATEWAY/ALL/",
Notifications: "false",
PlanID: "0",
PlanIDs: [],
Protected: false,
ShowNotifications: true,
SignalLevel: "-",
Status: "Open",
StrParam1: "",
StrParam2: "",
SubType: "Switch",
SwitchType: "Venetian Blinds EU",
SwitchTypeVal: 15,
Timers: "false",
Type: "Light/Switch",
TypeImg: "blinds",
Unit: 1,
Used: 1,
UsedByCamera: false,
XOffset: "0",
YOffset: "0",
idx: "266"
}
],
status: "OK",
title: "Devices"
}
Wijnand
Posts: 1
Joined: Thursday 08 February 2018 14:35
Target OS: Windows
Domoticz version:
Contact:

MQTT/JSON integration

Post by Wijnand »

Hello guys,

I am playing with Domoticz now for a few days. My biggest problems with Domoticz and MQTT are the way they are using topics and JSON.

1. Domoticz impose the topics domoticz/in and domoticz/out. Why? It gives you not the freedom affined the MQTT standard. Keep the subscripe and publish topics open ( e.i ALF4all/domoticz and/or ALF4all/domoticz/${floorplan name}/${plan name} ), so you are not overwhelmed with messages if you are using a public MQTT-broker (like HiveMQ).

2. JSON is designed to keep messages readable. An object in Domoticz like "idx":1 (device index) is clear, objects as "nvalue" and "svalue" says nothing. Why not using objects as "temperature" and "humidity"? An object as "svalue":"20.5; 33.3; 2" for a Temp + Humidity type sensor is not readable at all. Better in JSON documents is to split up the data in seperate objects like: {"temperature":"20.5", "humidity":"33.3","humidity-status":"2"}.

Even better: {"temperature":"20.5", "humidity":"33.3","humidity-status":"dry"}.

Perhaps it would be nice if this way is also implemented (not diffecult I think) in Domoticz.

Regards...
Wijnand

b.t.w. As device hardware/firmware I use ESP8266 (thing) -> Arduino IDE -> ArduinoJson.h -> PubSubClient.h -> MQTT -> Domoticz.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest