Plight switch does not work

Hello all,

I am new to Home-Assistant and tried to add plight switches.

Here is the config that I use:

pilight:
  host: 127.0.0.1
  port: 5000
  
switch:
  - platform: pilight
    switches:
      Test:
        on_code:
          protocol: 'heitech'
          systemcode: '31'
          unit: '8'
          'on': 1
        off_code:
          protocol: 'heitech'
          systemcode: '31'
          unit: '8'
          'off': 1

In the logs I get the following error:

homeassistant.components.pilight: Pilight send failed for {'unit': 8, 'protocol': ['heitech'], 'on': 1, 'systemcode': 31}

I have installed the newest version and I checked also if the config file is patched with the following:

 COMMAND_SCHEMA = pilight.RF_CODE_SCHEMA.extend({
     vol.Optional('on'): cv.positive_int,
     vol.Optional('off'): cv.positive_int,
-    vol.Optional(CONF_UNIT): cv.string,
+    vol.Optional(CONF_UNIT): cv.positive_int,
     vol.Optional(CONF_ID): cv.positive_int,
     vol.Optional(CONF_STATE): cv.string,
-    vol.Optional(CONF_SYSTEMCODE): cv.string,
+    vol.Optional(CONF_SYSTEMCODE): cv.positive_int,
 })

If needed here is my pilight config:

"settings": {
		"log-level": 6,
		"pid-file": "/var/run/pilight.pid",
		"log-file": "/var/log/pilight.log",
		"webserver-enable": 1,
		"webserver-root": "/usr/local/share/pilight/",
		"webserver-http-port": 5001,
		"webserver-cache": 1,
		"port": 5000
	},
"lamp4": {
			"protocol": [ "heitech" ],
			"id": [{
				"systemcode": 31,
				"unitcode": 8
			}],
			"state": "on"
		}

Here is the error from the pilight logfile:

[Nov 12 20:12:01:125106] pilight-daemon: ERROR: heitech: insufficient number of arguments

So I don’t know whats the problem and why its not working. :confused:

Maybe someone of you can help me.

Thanks

Daranto

Maybe you can try to let the ’ ’ away by protocol, systemcode and unit.

So something like this:

Keuken Lamp:
  on_code:
    protocol: kaku_switch
    id: 4967654
    unit: 9
    'on': 1  
  off_code:
    protocol: kaku_switch
    id: 4967654 
    unit: 9
    'off': 1
  on_code_receive:
    protocol: arctech_switch
    id: 4967654
    unit: 9          
    state: 'on'  
  off_code_receive:
    protocol: arctech_switch
    id: 4967654 
    unit: 9
    state: 'off'

Btw when you put your config code on the forum, you can press this symbol when you select that part to keep formatting.

thanks for info. I changed my post. I tried your change but I get still the same error message.

Daranto

oké that’s a lot easier to read :grinning:, you know after changing the configuration you have to restart Home-Assistant right?

yes I do :smiley:

I think i see it! You need to change unit in your config to unitcode

Thanks. That was the failure.

You are my hero.

Daranto