Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
T

tropicaxarquia

@tropicaxarquia
About
Posts
8
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Messages list without ack
    T tropicaxarquia

    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()

    General Discussion

  • Messages list without ack
    T tropicaxarquia

    Resuelto.

    Tanks

    General Discussion

  • Messages list without ack
    T tropicaxarquia

    This occurs when from python: s.sendall(b"" + nodoID + ";" + childID + ";1;1;26;" + timeAllZones + b"\n").
    When i changed the ACK from 1 to 0 in the message structure this has stopped happening. but all messages sent with ack to 1 are automatically forwarded again and again...

    General Discussion

  • Messages list without ack
    T tropicaxarquia

    I am using in node 10 the sketch of the irrigation example

    General Discussion

  • Messages list without ack
    T tropicaxarquia

    @mfalkvidd I have stopped the domoticz service and the mysensors log sends these messages every minute: DEBUG TSF: MSG: READ, 10-10-0, s = 3, c = 2, t = 26, pt = 0, l = 0, sg = 0.

    It is MySensors who sends a READ request to the nodes and when domoticz is up, they respond but if it is not up, the nodes do not respond???

    General Discussion

  • Messages list without ack
    T tropicaxarquia

    @mfalkvidd it's very strange. Some messages that I had sent from a Domoticz python sketch sent V_VAR24-25-26 and they have worked, but in the sending I put 1 in ack instead of 0 and the arduino sckets did not manage the ack and therefore they have stayed in some queue and sends them constantly (every so often the same message over and over again from the gateway). If I send another message modifying V_VAR26 to the same node, it works, but after a short time the gateway sends the original message again (the one that had ack in its format).

    this has me crazy!!!!

    General Discussion

  • Messages list without ack
    T tropicaxarquia

    Hello,
    how can reset the list of messages pending receive ack in the gateway from the node?

    regards

    General Discussion

  • Domoticz help using V_VAR1 and S_CUSTOM
    T tropicaxarquia

    @dbemowsk Did you find a way to access the domoticz variables?

    Domoticz
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular