In sketch definitions: ... MyMessage msg1valve(CHILD_ID_IRRIGATION_SYSTEM, V_LIGHT); MyMessage var1valve(CHILD_ID_IRRIGATION_SYSTEM, V_VAR1); MyMessage var2valve(CHILD_ID_IRRIGATION_SYSTEM, V_VAR2); MyMessage var3valve(CHILD_ID_IRRIGATION_SYSTEM, V_TEXT); .. in sketch receive function: ... if (message.type == V_LIGHT) { ... } else if (message.type == V_VAR1) { int variable1 = atoi(message.data);// RUN_ALL_ZONES time DEBUG_PRINT(F("Recibida V_VAR1 de la válvula:")); DEBUG_PRINT(i); DEBUG_PRINT(F(" = ")); DEBUG_PRINTLN(variable1); if (variable1 != allZoneTime[i]) // es un valor diferente del que había anteriormente { allZoneTime[i] = variable1; zoneTimeUpdate = true; //enviar valor al contrtolador send(var1valve.setSensor(i).set(variable1), false); } receivedInitialValue = true; } else if (message.type == V_VAR2) { int variable2 = atoi(message.data);// RUN_SINGLE_ZONE time DEBUG_PRINT(F("Recibida V_VAR2 de la válvula:")); DEBUG_PRINT(i); DEBUG_PRINT(F(" = ")); DEBUG_PRINTLN(variable2); if (variable2 != valveSoloTime[i]) // es un valor diferente del que había anteriormente { valveSoloTime[i] = variable2; zoneTimeUpdate = true; //enviar valor al contrtolador send(var2valve.setSensor(i).set(variable2), false); } receivedInitialValue = true; } else if (message.type == V_TEXT) { String newMessage = String(message.data); if (newMessage.length() == 0) { DEBUG_PRINT(F("No se ha recibido NOMBRE (V_TEXT) para la zona ")); DEBUG_PRINTLN(i); break; } if (newMessage.length() > 16) { newMessage.substring(0, 16); } valveNickName[i] = ""; valveNickName[i] += newMessage; String val = String(valveNickName[i]); DEBUG_PRINT(F("Recibida V_TEXT de la válvula: ")); DEBUG_PRINT(i); DEBUG_PRINT(F(" = ")); DEBUG_PRINTLN(valveNickName[i]); } receivedInitialValue = true; } ... In domoticz: each scene for each valve who on action: script://exec.sh irrigation_single_zone 10 1 0 5 "Zona 1" in /domoticz/scripts/exec.sh: #!/bin/sh case $1 in irrigation_single_zone) python /home/pi/domoticz/scripts/python/send_vars_to_irrigation_system.py --nodo_id=$2 --child_id=$3 --time_all_zones=$4 --time_single_zone=$5 --n$ exit 0 ;; irrigation_all_zones) python /home/pi/domoticz/scripts/python/send_vars_to_irrigation_system.py --nodo_id=$2 --child_id=1 --time_all_zones=$3 >/dev/null 2>&1 & python /home/pi/domoticz/scripts/python/send_vars_to_irrigation_system.py --nodo_id=$2 --child_id=2 --time_all_zones=$3 >/dev/null 2>&1 & python /home/pi/domoticz/scripts/python/send_vars_to_irrigation_system.py --nodo_id=$2 --child_id=3 --time_all_zones=$3 >/dev/null 2>&1 & python /home/pi/domoticz/scripts/python/send_vars_to_irrigation_system.py --nodo_id=$2 --child_id=4 --time_all_zones=$3 >/dev/null 2>&1 & python /home/pi/domoticz/scripts/python/send_vars_to_irrigation_system.py --nodo_id=$2 --child_id=5 --time_all_zones=$3 >/dev/null 2>&1 & python /home/pi/domoticz/scripts/python/send_vars_to_irrigation_system.py --nodo_id=$2 --child_id=6 --time_all_zones=$3 >/dev/null 2>&1 & python /home/pi/domoticz/scripts/python/send_vars_to_irrigation_system.py --nodo_id=$2 --child_id=7 --time_all_zones=$3 >/dev/null 2>&1 & python /home/pi/domoticz/scripts/python/send_vars_to_irrigation_system.py --nodo_id=$2 --child_id=8 --time_all_zones=$3 >/dev/null 2>&1 & exit 0 ;; esac /domoticz/scripts/python/send_vars_to_irrigation_system.py: #!/usr/bin/python3 import socket from time import sleep import sys import argparse #import DomoticzEvents as DE def gwsend(args): nodoID = str.encode(str(args.nodo_id)) childID = str.encode(str(args.child_id)) timeAllZones = str.encode(str(args.time_all_zones)) timeSingleZone = str.encode(str(args.time_single_zone)) nameZone = args.name_zone s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("127.0.0.1", 5003)) sleep(3) #estructura del mensaje #99: Node ID #1: ChildId #1: command (Set in this case) #0: ACK (None in this case) #47: V_TYPE (V_TEXT in this case), 24-25-26 V_VAR1-2-3 #enviar tiempo duracion en modo All Zones (V_VAR1 -> value 24) if timeAllZones != "None": s.sendall(b"" + nodoID + ";" + childID + ";1;0;24;" + timeAllZones + b"\n") sleep(3) #enviar tiempo de duracion en modo Single zone(V_VAR2 -> value 25) if timeSingleZone != "None": s.sendall(b"" + nodoID + ";" + childID + ";1;0;25;" + timeSingleZone + b"\n") sleep(3) #enviar nombre de zona (V_VAR3 -> value 26) if nameZone is not None: s.sendall(b"" + nodoID + ";" + childID + ";1;0;47;" + nameZone + b"\n") sleep(3) s.shutdown(socket.SHUT_WR) s.close() def main(): my_parser = argparse.ArgumentParser(prog='send_vars_to_irrigation_system', usage='%(prog)s --nodo_id=NODO_ID --child_id=VALVULA_ID, [--time_all_zones=TIME_EN_MODO_TODAS] [--time_single_zone$ description='Envio de parametros de cada zona al sistema de riego') my_parser.version = '1.0' my_parser.add_argument('--nodo_id', type=int, action='store', required=True, help='ID del nodo Sistema de Riego') my_parser.add_argument('--child_id', type=int, action='store', required=True, help='ID de la valvula') my_parser.add_argument('--time_all_zones', type=int, action='store', required=False, help='Duracion en modo Todas las zonas') my_parser.add_argument('--time_single_zone', type=int, action='store', required=False, help='Duracion en modo Solo esta zona') my_parser.add_argument('--name_zone', type=str, action='store', required=False, help='Nombre de la zona') args = my_parser.parse_args() gwsend(args) if name == 'main': main()