after reset first call to report is empty #16

Closed
opened 2020-12-05 09:35:01 +08:00 by jbqubit · 5 comments

First call of 'report' after reset returns incomplete report.

import json
import time

tec = Client(host="192.168.1.26") #(host="localhost", port=6667)

def bugtest():
    tec.set_param("reset", 0)
    time.sleep(3)
    print(json.dumps(tec._get_conf("report"), indent=2))
    print()
    print(json.dumps(tec._get_conf("report"), indent=2))
[
  {
    "error": "invalid input"
  },
  {
    "channel": 0,
    "time": 2330462,
    "adc": 0.7387923662434871,
    "sens": 8269.994517733821,
    "temperature": 29.998101527081587,
    "pid_engaged": true,
    "i_set": 0.1530116479231447,
    "vref": 1.5030000000000001,
    "dac_value": 1.5805058239615724,
    "dac_feedback": 1.583,
    "i_tec": 1.571,
    "tec_i": 0.1699999999999996,
    "tec_u_meas": 1.647,
    "pid_output": 0.15503291954190815
  }
]

[
  {
    "channel": 1,
    "time": 2330522,
    "adc": null,
    "sens": null,
    "temperature": null,
    "pid_engaged": false,
    "i_set": -0.006000000000000227,
    "vref": 1.502,
    "dac_value": 1.5,
    "dac_feedback": 1.5010000000000001,
    "i_tec": 1.5130000000000001,
    "tec_i": 0.027500000000000302,
    "tec_u_meas": 1.498,
    "pid_output": NaN
  },
  {
    "channel": 0,
    "time": 2330462,
    "adc": 0.7387923662434871,
    "sens": 8269.994517733821,
    "temperature": 29.998101527081587,
    "pid_engaged": true,
    "i_set": 0.1490116479231447,
    "vref": 1.504,
    "dac_value": 1.5805058239615724,
    "dac_feedback": 1.582,
    "i_tec": 1.569,
    "tec_i": 0.16249999999999987,
    "tec_u_meas": 1.6520000000000001,
    "pid_output": 0.15503291954190815
  }
]```

    
First call of 'report' after reset returns incomplete report. ```from pytec.client import Client import json import time tec = Client(host="192.168.1.26") #(host="localhost", port=6667) def bugtest(): tec.set_param("reset", 0) time.sleep(3) print(json.dumps(tec._get_conf("report"), indent=2)) print() print(json.dumps(tec._get_conf("report"), indent=2)) ``` ```$ python mytest.py [ { "error": "invalid input" }, { "channel": 0, "time": 2330462, "adc": 0.7387923662434871, "sens": 8269.994517733821, "temperature": 29.998101527081587, "pid_engaged": true, "i_set": 0.1530116479231447, "vref": 1.5030000000000001, "dac_value": 1.5805058239615724, "dac_feedback": 1.583, "i_tec": 1.571, "tec_i": 0.1699999999999996, "tec_u_meas": 1.647, "pid_output": 0.15503291954190815 } ] [ { "channel": 1, "time": 2330522, "adc": null, "sens": null, "temperature": null, "pid_engaged": false, "i_set": -0.006000000000000227, "vref": 1.502, "dac_value": 1.5, "dac_feedback": 1.5010000000000001, "i_tec": 1.5130000000000001, "tec_i": 0.027500000000000302, "tec_u_meas": 1.498, "pid_output": NaN }, { "channel": 0, "time": 2330462, "adc": 0.7387923662434871, "sens": 8269.994517733821, "temperature": 29.998101527081587, "pid_engaged": true, "i_set": 0.1490116479231447, "vref": 1.504, "dac_value": 1.5805058239615724, "dac_feedback": 1.582, "i_tec": 1.569, "tec_i": 0.16249999999999987, "tec_u_meas": 1.6520000000000001, "pid_output": 0.15503291954190815 } ]```

Immediately after bootup no measurements have been taken yet.

What is the reason for resetting the device? There is no reconnecting code in pytec/client.py.

Immediately after bootup no measurements have been taken yet. What is the reason for resetting the device? There is no reconnecting code in `pytec/client.py`.

What is the reason for resetting the device?

I would like that my configuration script start with Thermostat in a well defined state priod to setting registers.

> What is the reason for resetting the device? I would like that my configuration script start with Thermostat in a well defined state priod to setting registers.

This is a library usage error. There is no reset 0 command.

It's just the error response slipping in. I'm going improve on that behaviour.

This is a library usage error. There is no `reset 0` command. It's just the error response slipping in. I'm going improve on that behaviour.

In the TCP protocol all commands are now followed by a status response, so that the caller will know if processing has failed.

In the TCP protocol all commands are now followed by a status response, so that the caller will know if processing has failed.
astro closed this issue 2020-12-18 23:39:24 +08:00

Please add check for status response and simple exception handling to pytec client.

Please add check for status response and simple exception handling to pytec client.
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/thermostat#16
There is no content yet.