How to send serial commands (v_var) from Domoticz to serial gateway



  • Hi,

    I´m working on this for days now, with no conclusion.

    I´d like to send commands to my Arduino Gateway from Domotics, using my DzVents script.
    As the commands won´t fit predefinded types, I´d like to use the v_var1 - 5 (as shown on the list on https://www.mysensors.org/download/serial_api_20#set,-req)
    I found the json url commands
    (https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's),
    and also an example
    (on https://forum.mysensors.org/topic/4933/using-the-selector-switch-in-domoticz-tutorial/2 ) :

    http://192.168.2.110:8080/json.htm?type=command&param=switchlight&idx=971&switchcmd=Set%20Level&level=0
    

    Set f.e. to a virtual dimmer switch, I can now read the command on the Arduino sketch

    message.type == V_PERCENTAGE
    

    and get the value sended.

    My problem is, I can´t find out why "param=switchlight" on Domotics results in "V_PERCENTAGE" on MySensors. And what I have to send to get the "V_VAR1".

    Mayber there is also an easier way to send commands to MySensors - maybe send serial commands directly?

    Gateway (and also Domoticz server) is an RPi3.



  • @Inso - you can eventually register a few TEXT devices with one of your Arduino sensors, like:

    present(LCD_LINE1_CHILD_ID, S_INFO, LCD_LINE1);
    

    then periodically ask data back from Domoticz like:

      if (!line1received) {
        request(LCD_LINE1_CHILD_ID, V_TEXT);
    #if DEBUG == 1
        Serial.println("Requested line1 from gw !");
    #endif
        wait(5000, 2, V_TEXT); // wait for 5s or until a message of type V_TEXT is received
      }
    

    just define this first:

    bool line1received = false;
    

    For more details on the DzVents (2.4x) side have a look in the Domoticz installation folder, there are a few good DzVents examples, this is the path in Windows7:
    C:\Program Files (x86)\Domoticz\scripts\dzVents\examples

    Hope it helps ...


Log in to reply
 

Suggested Topics

  • 5
  • 4
  • 1
  • 8
  • 3
  • 5

63
Online

11.4k
Users

11.1k
Topics

112.7k
Posts