puuu / ESPiLight

ESPiLight - pilight 433.92 MHz protocols library for Arduino
GNU General Public License v3.0
109 stars 41 forks source link

Help / Clarification needed: pilight(3): smartwares_switch: insufficient number of arguments #57

Closed mbariola closed 3 years ago

mbariola commented 3 years ago

Hi,

I have tried to use this library to pilot a set of smartwares_switch.

the receive.ino sketch works perfectly (attaching a bit of the dump on/off sequence from unit 1 ).

20:42:56.663 > RF signal arrived. Protocol: [smartwares_switch], deviceID: [23042048], status: (FIRST), message: {"id":23042048,"unit":1,"state":"on"}
20:42:56.666 > RF signal arrived. Protocol: [arctech_switch], deviceID: [23042048], status: (FIRST), message: {"id":23042048,"unit":1,"state":"on"}
20:42:56.687 > RF signal arrived. Protocol: [arctech_screen], deviceID: [23042048], status: (FIRST), message: {"id":23042048,"unit":1,"state":"up"}
20:42:56.819 > RF signal arrived. Protocol: [smartwares_switch], deviceID: [23042048], status: (VALID), message: {"id":23042048,"unit":1,"state":"on"}
20:42:56.890 > Valid message: Protocol: [smartwares_switch], Message: {"id":23042048,"unit":1,"state":"on"}
20:42:56.890 > RF signal arrived. Protocol: [arctech_switch], deviceID: [23042048], status: (VALID), message: {"id":23042048,"unit":1,"state":"on"}
20:42:56.890 > Valid message: Protocol: [arctech_switch], Message: {"id":23042048,"unit":1,"state":"on"}
20:42:56.890 > RF signal arrived. Protocol: [arctech_screen], deviceID: [23042048], status: (VALID), message: {"id":23042048,"unit":1,"state":"up"}
20:42:56.890 > Valid message: Protocol: [arctech_screen], Message: {"id":23042048,"unit":1,"state":"up"}
20:42:56.894 > RF signal arrived. Protocol: [smartwares_switch], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"on"}
20:42:56.896 > RF signal arrived. Protocol: [arctech_switch], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"on"}
20:42:57.300 > RF signal arrived. Protocol: [arctech_screen], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"up"}
20:42:57.300 > RF signal arrived. Protocol: [smartwares_switch], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"on"}
20:42:57.300 > RF signal arrived. Protocol: [arctech_switch], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"on"}
20:42:57.300 > RF signal arrived. Protocol: [arctech_screen], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"up"}
20:42:57.300 > RF signal arrived. Protocol: [smartwares_switch], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"on"}
20:42:57.300 > RF signal arrived. Protocol: [arctech_switch], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"on"}
20:42:57.300 > RF signal arrived. Protocol: [arctech_screen], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"up"}
20:42:59.122 > RF signal arrived. Protocol: [smartwares_switch], deviceID: [23042048], status: (FIRST), message: {"id":23042048,"unit":1,"state":"off"}
20:42:59.126 > RF signal arrived. Protocol: [arctech_switch], deviceID: [23042048], status: (FIRST), message: {"id":23042048,"unit":1,"state":"off"}
20:42:59.129 > RF signal arrived. Protocol: [arctech_screen], deviceID: [23042048], status: (FIRST), message: {"id":23042048,"unit":1,"state":"down"}
20:42:59.279 > RF signal arrived. Protocol: [smartwares_switch], deviceID: [23042048], status: (VALID), message: {"id":23042048,"unit":1,"state":"off"}
20:42:59.341 > Valid message: Protocol: [smartwares_switch], Message: {"id":23042048,"unit":1,"state":"off"}
20:42:59.341 > RF signal arrived. Protocol: [arctech_switch], deviceID: [23042048], status: (VALID), message: {"id":23042048,"unit":1,"state":"off"}
20:42:59.341 > Valid message: Protocol: [arctech_switch], Message: {"id":23042048,"unit":1,"state":"off"}
20:42:59.341 > RF signal arrived. Protocol: [arctech_screen], deviceID: [23042048], status: (VALID), message: {"id":23042048,"unit":1,"state":"down"}
20:42:59.341 > Valid message: Protocol: [arctech_screen], Message: {"id":23042048,"unit":1,"state":"down"}
20:43:00.199 > RF signal arrived. Protocol: [smartwares_switch], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"off"}
20:43:00.199 > RF signal arrived. Protocol: [arctech_switch], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"off"}
20:43:00.199 > RF signal arrived. Protocol: [arctech_screen], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"down"}
20:43:00.199 > RF signal arrived. Protocol: [smartwares_switch], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"off"}
20:43:00.199 > RF signal arrived. Protocol: [arctech_switch], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"off"}
20:43:00.199 > RF signal arrived. Protocol: [arctech_screen], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"down"}
20:43:00.199 > RF signal arrived. Protocol: [smartwares_switch], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"off"}
20:43:00.199 > RF signal arrived. Protocol: [arctech_switch], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"off"}
20:43:00.199 > RF signal arrived. Protocol: [arctech_screen], deviceID: [23042048], status: (KNOWN), message: {"id":23042048,"unit":1,"state":"down"}

however, when trying to adapt the transmitter sketch, I obtain this warning on serial monitor, and no codes being transmitted:

pilight(3): smartwares_switch: insufficient number of arguments

I have changed these lines

rf.send("elro_800_switch", "{\"systemcode\":17,\"unitcode\":1,\"on\":1}");
rf.send("elro_800_switch", "{\"systemcode\":17,\"unitcode\":1,\"off\":1}");

to these, using the info available at these pages: https://manual.pilight.org/protocols/433.92/switch/elro_800.html (for original example) https://manual.pilight.org/protocols/433.92/switch/nexa.html (one of the many supporting smartwares_switch)

rf.send("smartwares_switch", "{\"id\":23042048,\"unit\":1,\"state\":\"on\"}");
rf.send("smartwares_switch", "{\"id\":23042048,\"unit\":1,\"state\":\"off\"}");

Can you please point me in the right direction? Also, what are the arctech_switch and arctech_screen that I see coming up in the dump? could it be the transmitter sending out other protocols too?

Many thanks

mbariola commented 3 years ago

ok by looking into smartwares_switch.c I saw that actually the on and off switch need to be specified differently from what appears in the piilight pages. the lines modified like this do not raise the insufficient number of arguments error.

rf.send("smartwares_switch", "{\"id\":23042048,\"unit\":1,\"on\":1}");
rf.send("smartwares_switch", "{\"id\":23042048,\"unit\":1,\"off\":1}");

I still cannot get the transmitter to send, but this might be a hardware or electronics issue.