Learn light/switch over MQTT [SOLVED]

Moderator: leecollings

Post Reply
JanJelle
Posts: 11
Joined: Sunday 06 January 2019 8:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Learn light/switch over MQTT [SOLVED]

Post by JanJelle »

Good evening,

Could anyone explain me how the "learn light/switch" function works when communicating with MQTT gateway?

I have an arduino connected and functional over the MQTT protocol, and I can dim a light with the Domoticz interface and turn it on/off by a hardware switch as well. when I played around and pressed the learn light/switch button in Domoticz, and then pressed the hardware switch, the message appeared:

"already in use by dimmer"

which is correct since that is the IDX used by the light I connected. but if I change the IDX in the subscription from the arduino it doesn't add a new switch a with a new IDX. it just says "time out".

how should i use this auto learn system?

thanks in advance!
Last edited by JanJelle on Wednesday 30 January 2019 22:07, edited 2 times in total.
mrf68

Re: Learn light/switch over MQTT

Post by mrf68 »

Hello,

I think you need to activate “Accept new hardware”, let the arduino send a mqtt message and then check the “Devices” tab for new unused items. As far as I know, the “learn” system only listens for radio signals. But I might be wrong. 8-)
JanJelle
Posts: 11
Joined: Sunday 06 January 2019 8:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Learn light/switch over MQTT

Post by JanJelle »

Hi,

Thanks for the response. I checked the "accept new hardware" setting, good point, but it was enabled. sending an unused IDX message to the MQTT server doesn't add any device, unfortunately... however since sending a "used" IDX message does trigger the learn switch function, but it says that the device is already in use... so it does read the MQTT message and uses it somehow, but I am not sending the string in the right format.. think I need to know how to send the proper string in as subscription to the server for domoticz to accept it as a new hardware device under the group "virtual sensors".

any suggestions? I checked here: https://www.domoticz.com/wiki/MQTT

but it doesn't say anything on "sending a learning command" of some sort.
mrf68

Re: Learn light/switch over MQTT

Post by mrf68 »

Maybe it is easier to do this: create a virtual switch and use the idx with the arduino.
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: Learn light/switch over MQTT

Post by emme »

I think auto-learning does not apply to MQTT

MQTT expect to receive an already known IDX and more, the new IDX is NOT defined by MQTT but from Domoticz device table.

So, I assume you have to manually add a virtual (dummy) device, get its IDX ad adapt your arduino script.

Auto-learning is used in some other kind of hardware (RF433, MyHome, X10 for examples)
The most dangerous phrase in any language is:
"We always done this way"
JanJelle
Posts: 11
Joined: Sunday 06 January 2019 8:15
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Learn light/switch over MQTT

Post by JanJelle »

Alright thanks for the replies.

making a virtual dummy and use the idx in the arduino script is what I am doing now and works fine. just wondering if I could write a function to use the learn function since that would be pretty neat.

thanks again topic closed :)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest