openv / vcontrold

:fire: vcontrold Daemon for control and logging of Viessmann® type heating devices
https://github.com/openv/openv/wiki
GNU General Public License v3.0
101 stars 54 forks source link

How to use setaddr #77

Open sebastianw-dev opened 3 years ago

sebastianw-dev commented 3 years ago

Hi, could somebody help me to understand how to use the setaddr command, in particular how to pass the value to write using the command line? I only found very few examples for the set, what I finally use is the following command line:

vclient -h 127.0.0.1 -p 3002 -m -c 'setLueftBetrArtRaw 2' -v

Using the verbose mode, the output is the following:

option -v

Host: 127.0.0.1 Port: 3002
setLueftBetrArtRaw 2.value 0.000000

So the value 2 seems to be interpreted as a part of the command itself and independent from that, the value is always 0. What is the correct way to use vclient when I want to pass a value for a setaddr command?

This is the configuration I'm using, in fact I only modified vito.xml

extract from vcontrold.xml

<unit name='Status'>
      <abbrev>ST</abbrev>
      <calc get='V' set='V'/>
      <type>char</type>
      <entity></entity>
</unit>

<command name="setaddr">
     <send>SEND 00 02 $addr $hexlen BYTES;RECV 1 SR</send>
</command>

extract from vito.xml

<command name="setLueftBetrArtRaw" protocmd="setaddr">
      <addr>B005</addr>
      <len>1</len>
      <unit>ST</unit>
      <description>Betriebsart Lueftung</description>
</command>
sebastianw-dev commented 3 years ago

I continued to investigate a bit, see below the log file extract in addition. Seems that vcontrold sends an incorrect value (0x0B instead of 0x02). That value is always the same, independent from the value I put. From what I saw in the code, for me it seems ok that commands have a parameter. Not sure why the separation of both fails.

Would be happy for any hint what could be the reason for that or even were to look at next.

[10949] Sat Jan 16 23:44:26 2021 : TCP socket 3002 opened
[10949] Sat Jan 16 23:44:26 2021 : Dropped privileges, now running with effective user ID 65534, group ID 20
[10949] Sat Jan 16 23:44:45 2021 : Client connected 127.0.0.1:48442 (FD:1)
[10949] Sat Jan 16 23:44:45 2021 : Child process started with pid 10952
[10952] Sat Jan 16 23:44:45 2021 : Command: setLueftBetrArtRaw 2
[10952] Sat Jan 16 23:44:45 2021 : Process 10952 tries to aquire lock
[10952] Sat Jan 16 23:44:45 2021 : Process 10952 got lock
[10952] Sat Jan 16 23:44:45 2021 : >FRAMER: open device /dev/vitoir0 ProtocolID 41
[10952] Sat Jan 16 23:44:45 2021 : Configuring serial interface /dev/vitoir0
[10952] Sat Jan 16 23:44:45 2021 : >SENT: 04
[10952] Sat Jan 16 23:44:45 2021 : <RECV: len=1 05 (230.0 ms)
[10952] Sat Jan 16 23:44:45 2021 : <RECV: received 05
[10952] Sat Jan 16 23:44:45 2021 : >FRAMER: framer_reset_actaddr framer_current_addr = FRAMER_LINK_STATUS(05) (was FFFF)
[10952] Sat Jan 16 23:44:45 2021 : >FRAMER: closed
[10952] Sat Jan 16 23:44:45 2021 : >SENT: 16
[10952] Sat Jan 16 23:44:45 2021 : >SENT: 00
[10952] Sat Jan 16 23:44:45 2021 : >SENT: 00
[10952] Sat Jan 16 23:44:45 2021 : <RECV: len=1 06 (10.0 ms)
[10952] Sat Jan 16 23:44:45 2021 : <RECV: received 06
[10952] Sat Jan 16 23:44:45 2021 : >FRAMER: framer_reset_actaddr framer_current_addr = FRAMER_NO_ADDR (was FE05)
[10952] Sat Jan 16 23:44:45 2021 : >FRAMER: opened
[10952] Sat Jan 16 23:44:45 2021 : >SENT: 41
[10952] Sat Jan 16 23:44:45 2021 : >SENT: 06
[10952] Sat Jan 16 23:44:45 2021 : >SENT: 00
[10952] Sat Jan 16 23:44:45 2021 : >SENT: 02
[10952] Sat Jan 16 23:44:45 2021 : >SENT: B0
[10952] Sat Jan 16 23:44:45 2021 : >SENT: 05
[10952] Sat Jan 16 23:44:45 2021 : >SENT: 01
Incorrect value sent -> [10952] Sat Jan 16 23:44:45 2021 : >SENT: 0B
[10952] Sat Jan 16 23:44:45 2021 : >SENT: C9
[10952] Sat Jan 16 23:44:45 2021 : <RECV: len=1 06 (20.0 ms)
[10952] Sat Jan 16 23:44:45 2021 : <RECV: received 06
[10952] Sat Jan 16 23:44:45 2021 : >FRAMER: framer_set_actaddr framer_current_addr = 05B0 (was FFFF)
[10952] Sat Jan 16 23:44:45 2021 : >FRAMER: Command send
[10952] Sat Jan 16 23:44:45 2021 : >FRAMER: no preset result
[10952] Sat Jan 16 23:44:45 2021 : <RECV: len=1 41 (10.0 ms)
[10952] Sat Jan 16 23:44:45 2021 : <RECV: received 41
[10952] Sat Jan 16 23:44:45 2021 : <RECV: len=1 05 (0.0 ms)
[10952] Sat Jan 16 23:44:45 2021 : <RECV: received 05
[10952] Sat Jan 16 23:44:45 2021 : <RECV: len=1 01 (0.0 ms)
[10952] Sat Jan 16 23:44:45 2021 : <RECV: len=1 02 (0.0 ms)
[10952] Sat Jan 16 23:44:45 2021 : <RECV: len=1 B0 (10.0 ms)
[10952] Sat Jan 16 23:44:45 2021 : <RECV: len=1 05 (0.0 ms)
[10952] Sat Jan 16 23:44:45 2021 : <RECV: len=1 01 (0.0 ms)
[10952] Sat Jan 16 23:44:45 2021 : <RECV: len=1 BE (0.0 ms)
[10952] Sat Jan 16 23:44:45 2021 : <RECV: received 01 02 B0 05 01 BE
[10952] Sat Jan 16 23:44:45 2021 : >FRAMER: framer_reset_actaddr framer_current_addr = FRAMER_NO_ADDR (was 05B0)
[10952] Sat Jan 16 23:44:45 2021 : 00 -> OK
[10952] Sat Jan 16 23:44:45 2021 : OK
[10952] Sat Jan 16 23:44:45 2021 : Command: quit
[10952] Sat Jan 16 23:44:45 2021 : >SENT: 04
[10952] Sat Jan 16 23:44:47 2021 : <RECV: len=1 05 (1990.0 ms)
[10952] Sat Jan 16 23:44:47 2021 : <RECV: received 05
[10952] Sat Jan 16 23:44:47 2021 : >FRAMER: framer_reset_actaddr framer_current_addr = FRAMER_LINK_STATUS(05) (was FFFF)
[10952] Sat Jan 16 23:44:47 2021 : >FRAMER: closed
[10952] Sat Jan 16 23:44:47 2021 : Process 10952 released lock
[10952] Sat Jan 16 23:44:47 2021 : Closed connection (fd:1)
[10952] Sat Jan 16 23:44:47 2021 : Child process with PID 10952 terminated