Mqtt - Error sending switch command

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

Moderators: leecollings, remb0

Post Reply
tottka
Posts: 19
Joined: Wednesday 19 July 2017 19:50
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: US
Contact:

Mqtt - Error sending switch command

Post by tottka »

Can anyone shed some light on Error sending switch command? I have ESP8266 with reed switches set up to alert me if a window is opened. The device sends an mqtt command for a contact switch in Domoticz when the status changes. The switch is NOT getting updated and I'm getting Error sending switch command. Does my mqtt command need something else?

MQTT: Topic: domoticz/in, Message: { "command": "switchlight", "idx": 11, "switchcmd": "On" }
Error: MQTT: Error sending switch command!

Thanks
SweetPants

Re: Mqtt - Error sending switch command

Post by SweetPants »

Have you tried using the mosquitto_pub command already"
Does it work then?
mosquitto_pub -h <ip MQTT broker> -p <port MQTT broker> -u <username> -P <password> -t 'domoticz/in' -m '{ "command": "switchlight", "idx": 11, "switchcmd": "Off" }'
tottka
Posts: 19
Joined: Wednesday 19 July 2017 19:50
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: US
Contact:

Re: Mqtt - Error sending switch command

Post by tottka »

Thanks for your response. I am using mqtt.fx to publish commands as a test. I see the published command show up in my subscribed list but am getting the error message regarding the sending switch in Domoticz. My temperature sensors are all sending mqtt commands as expected.
tottka
Posts: 19
Joined: Wednesday 19 July 2017 19:50
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: US
Contact:

Re: Mqtt - Error sending switch command

Post by tottka »

OK testing a little further I found that this command works perfectly if the device is set up as a Switch but not working if Contact or Door Contact.
Is there something else I need to add to the command or is this a bug? I am on v3.8224

I'm thinking the error is coming from within Domoticz sending an mqtt response back to the device.
thanks
SweetPants

Re: Mqtt - Error sending switch command

Post by SweetPants »

tottka wrote:OK testing a little further I found that this command works perfectly if the device is set up as a Switch but not working if Contact or Door Contact.
I think this is not possible, if you try in the GUI you cannot toggle the door contact, you get an error there too
tottka
Posts: 19
Joined: Wednesday 19 July 2017 19:50
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: US
Contact:

Re: Mqtt - Error sending switch command

Post by tottka »

I've summarized what I am seeing, does anyone have any insights into this?

I think I have 2 issues, the first one deals with Error sending switch command on Contact
The second is that I can click on Door Contacts to change the status. I think I've been told twice that's not suppose to happen.

Light/Switch, Switch, Contact
2017-08-07 13:07:04.990 MQTT: Topic: domoticz/in, Message: { "command": "switchlight", "idx": 11, "switchcmd": "On" }
2017-08-07 13:07:04.992 Error: MQTT: Error sending switch command!
icon & status don't change
publishes to MQTT: nothing

Light/Switch, Switch, Door Contact
2017-08-07 13:07:10.894 MQTT: Topic: domoticz/in, Message: { "command": "switchlight", "idx": 12, "switchcmd": "On" }
2017-08-07 13:07:10.898 (Contact) Light/Switch (LR Window Right)
publishes to MQTT: nothing
if I click on the ICON in the switch tab, the icon changes, no MQTT generated
note: don't think I'm suppose to be able to do this?

Light/Switch, Switch, On/Off
2017-08-07 13:07:16.111 MQTT: Topic: domoticz/in, Message: { "command": "switchlight", "idx": 13, "switchcmd": "On" }
2017-08-07 13:07:16.122 (Contact) Light/Switch (switch)
publishes to MQTT: domoticz/out/Home/LivingRoom
if I click on the ICON in the switch tab, the icon changes and MQTT is generated
tottka
Posts: 19
Joined: Wednesday 19 July 2017 19:50
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: US
Contact:

Re: Mqtt - Error sending switch command

Post by tottka »

I continued trying other ways to change my contact switch and found that I had the same problem with API calls

contact switch
192.68.0.106:8080/json.htm?type=command&param=switchlight&idx=11&switchcmd=On
{
"message" : "Error sending switch command, check device/hardware !",
"status" : "ERROR",
"title" : "SwitchLight"
}

door contact switch
192.68.0.106:8080/json.htm?type=command&param=switchlight&idx=12&switchcmd=On
{
"status" : "OK",
"title" : "SwitchLight"
}

switch
192.68.0.106:8080/json.htm?type=command&param=switchlight&idx=13&switchcmd=On
{
"status" : "OK",
"title" : "SwitchLight"
}

Last thing I tried was using udevice in my API call & it worked!
192.168.0.106:8080/json.htm?type=command&param=udevice&idx=11&nvalue=1

So at least until someone fixes this, my devices will send MQTT to mqttwarn and convert the MQTT to an API call, ugh
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest