• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem publish to pilight MQTT server
#1
So I am setting my first steps in MQTT using pilight version v8.1.5-nightly-45c64b39 on Rpi and testing it with MQTT.fx on Windows. Subscribing in MQTT.fx to pilight topics is working fine. But when I try to change the state of a switch by publishing a command the pilight.log shows:
Code:
ERROR: elro_400_switch: insufficient number of arguments
config.json (shortened version):
Code:
{
       "devices":
               "keuken": {
                       "protocol": [ "elro_400_switch" ],
                       "id": [{
                               "systemcode": 9,
                               "unitcode": 29
                       }],

               }
       },
       "settings": {
               "log-level": 6,
               "pid-file": "/var/run/pilight.pid",
               "log-file": "/var/log/pilight.log",
               "standalone": 1,
               "webserver-enable": 1,
               "webserver-root": "/usr/local/share/pilight/webgui",
               "webserver-http-port": 5001,
               "webserver-https-port": 5002,
               "webserver-cache": 1,
               "whitelist": "",
               "gpio-platform": "raspberrypi1b2",
               "mqtt-port": 1883,
               "mqtt-enable": 1
       },
       "hardware": {
               "433gpio": {
                       "sender": 0,
                       "receiver": 1
               }
       },
       "registry": {
               "webserver": {
                       "ssl": {
                               "certificate": {
                                       "location": "/etc/pilight/pilight.pem"
                               }
                       }
               },
               "pilight": {
                       "version": {
                               "current": "8.1.5"
                       }
               },
               "hardware": {
                       "RF433": {
                               "mingaplen": 4420,
                               "maxgaplen": 72900,
                               "minrawlen": 26,
                               "maxrawlen": 400
                       }
               }
       }
}
So I use MQTT.fx to connect, subscribe and publish.
Subscribe to :
Code:
pilight/device/keuken/+
 gives a timestamp and a state after I switched it; perfect

Publish:
Code:
pilight/device/keuken/state on
gives no action and the pilight.log shows:

Code:
[Aug 26 13:45:25:114372] ERROR: elro_400_switch: insufficient number of arguments
What am I doing wrong here?
 
Reply
#2
Probably nothing except that MQTT is under heavy debugging. I will look into it later.
 
Reply
#3
(08-26-2020, 05:09 PM)curlymo Wrote: Probably nothing except that MQTT is under heavy debugging. I will look into it later.

Ah ok. Well if I can be of any help testing, let me know. Is there a way of monitoring what the pilight MQTT server actually receives?
 
Reply
#4
Can you check if the latest staging improves anything?
 
Reply
#5
(08-30-2020, 08:01 PM)curlymo Wrote: Can you check if the latest staging improves anything?

I did reinstall  Raspbian from scratch after a problem. I installed the new nightly and after testing with subribe and publish this is the log:
Code:
[Aug 31 19:48:02:67446] INFO: version v8.1.5-nightly-1af4c284
[Aug 31 19:48:02:107002] INFO: daemon listening to port: 37557
[Aug 31 19:48:02:157820] INFO: secured webserver started on port: 5002 (fd 15)
[Aug 31 19:48:02:158142] INFO: regular webserver started on port: 5001 (fd 16)
[Aug 31 19:48:02:169151] INFO: new client, ip: 127.0.0.1, port: 35926
[Aug 31 19:48:02:276215] NOTICE: no pilight ssdp connections found
[Aug 31 19:48:02:279827] INFO: new client, ip: 127.0.0.1, port: 35930
[Aug 31 19:49:45:292390] ERROR: elro_400_switch: insufficient number of arguments
subscribing still works; publishing still does not.
Sorry so no improvement
 
Reply
#6
Still struggling publishing to pilight MQTT broker. Now working with 8.1.5-198-g84719473. The error in pilight.log
Code:
ERROR: elro_400_switch: insufficient number of arguments
disapeared now. 
Subscribing works perfectly.
But I am still not capable of changing the state of a switch by publishing to to the pilight MQTT broker by eg send:
pilight/dev/stat/keuken/state on
I am using pilight on Raspberry pi 2B and running the client on Windows10: both MQTT.fx and MQTT-explorer give exactly the same result. Can anyone give me a hint or a way to explore the problem further?
 
Reply
#7
Yet again trying mqtt, and still no luck. Luckily I still had my old image of v8.1.5-nightly-84719473, because I could not find any other nightlies anymore in apt.pilight.org! Where are they?

I started using node-red, because it supports mqtt natively (also because I want use the conbee 2 for zigbee devices). But I want to keep pilight for 433Mhz communication. So far I like node-red is. But communication with pilight is still cumbersome, nevertheless almost workable:

What works :
-Subscribing to mqtt topic giving node-red the changes of devices status instantly:
Code:
pilight/dev/stat/+/+

-changing the state of devices I use the websockets inteface (works too): 
Code:
{   "action": "control",   "code": {     "device": "camera",     "state": "on"    } }
-Getting the complete list of states of all the devices with the websockets, when asked for: {
Code:
"action": "request values"}

So mixing two protocols could make it work for me.

What does not work:
Publishing mqtt topics to the server  to change the state of a device ie:
Code:
pilight/device/bank/state on

Having the websocket send a message from pilight to node-red when a device state has changed:
Code:
{  "action": "identify",  "options": {    "config": 1 }}


I would like to to use one of the two protocols (sockets or mqtt) for sending and receiving the states of the devices.

Questions:

1: What am I doing wrong? Or what should I do differently.
2.If it does not work yet, will there be any updates in piliight in the coming months or so, or should I stick with what is working rightnow.
3. Are there newer nightlies somewhere?

Thanks
 
Reply
#8
Quote:pilight/device/bank/state on
is wrong.

To control your device you should use:


Code:
pilight/dev/ctrl/bank/state on
 
Reply
#9
(07-24-2021, 02:25 PM)Niek Wrote:
Quote:pilight/device/bank/state on
is wrong.

To control your device you should use:


Code:
pilight/dev/ctrl/bank/state on
Niek, Thank you so much. This works!
I don't understand why I could not find this. In the the MQTT paragraph of chapter Development in the manual it is not showed anyway.

Then the next question of course, where can I find the nightlies. Is the one I use the newest? Is there a stable version coming supporting MQTT?

Any way I can now go on. Thanks again
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  update pilight Traeumer 0 26 07-29-2021, 09:41 PM
Last Post: Traeumer
  Hardware Switch and pilight-send/-control iTommix 3 546 02-14-2021, 09:25 PM
Last Post: iTommix
  pilight error after update to 8.1.5 on Odroid C2 WitchDoctor 4 1,720 02-07-2021, 09:50 PM
Last Post: pilightalpine
  pilight in Docker not accepting connections due to possible SYN flooding akloeckner 3 471 02-07-2021, 04:22 PM
Last Post: akloeckner
Lightbulb working MQTT in version v8.1.5-nightly-1af4c284 fleisch 1 685 12-28-2020, 05:04 PM
Last Post: psbest
  pilight-debug format Rschnauzer 2 454 12-17-2020, 07:09 PM
Last Post: Rschnauzer
  pilight-flash not working danny 14 3,383 12-12-2020, 10:00 AM
Last Post: tox
  pilight does not start, Deamon is not found. Dekkertje 6 772 12-08-2020, 06:55 PM
Last Post: Dekkertje
  Failed pilight-send that say they succeeded hepcat72 2 493 12-05-2020, 05:30 PM
Last Post: hepcat72
  apt.pilight.org/dists/stable/main/binary 301 Moved Permanently Rschnauzer 6 851 11-23-2020, 01:49 PM
Last Post: Rschnauzer

Forum Jump:


Browsing: 1 Guest(s)