# I am trying to measure temperature inside my cabinet

**URL:** <https://discuss.blues.com/t/i-am-trying-to-measure-temperature-inside-my-cabinet/248>\
**Category:** Notehub.io\
**Tags:** python\
**Created:** [May 6, 2021, 11:56am UTC](https://discuss.blues.com/t/i-am-trying-to-measure-temperature-inside-my-cabinet/248 "2021-05-06T11:56:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vstadmin](https://avatars.discourse-cdn.com/v4/letter/v/439d5e/32.png) [@vstadmin](https://discuss.blues.com/u/vstadmin)\
**Post date:** [May 6, 2021, 11:56am UTC](https://discuss.blues.com/t/i-am-trying-to-measure-temperature-inside-my-cabinet/248/1 "2021-05-06T11:56:54Z")

</div>

> def fifteen\_sec\_updates():
> 
> ```
> '''These are the things to do once every 15 seconds'''
> 
> global cont
> 
> #to_modem = cont
> 
> to_modem = {key:cont[key] for key in ['pressure','runcycles','faults','mode']}
>     
> print('*** Modem - Sending: {}'.format(to_modem))
> 
> ### Output for blues modem
> 
> try:
> 
> req = {"req" :"note.add"}
> req["file"] = "vstdata.qo"
> req["sync"] = True
> req["body"] = to_modem
> 
> rsp = card.Transaction(req)
> 
> print(rsp)
>     
> # Get Board Tempoerature
>     
> req = {"req": "card.temp"}
> req["sync"] = True
> rsp = card.Transaction(req)
> 
> except:
>     
> print('No response from modem. Will keep trying...')
> 
> ```

I expected to see results in my events for temperature, but I do not. What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![bsatrom](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/bsatrom/32/3_2.png) [@bsatrom](https://discuss.blues.com/u/bsatrom)\
**Post date:** [May 6, 2021, 12:14pm UTC](https://discuss.blues.com/t/i-am-trying-to-measure-temperature-inside-my-cabinet/248/2 "2021-05-06T12:14:46Z")

</div>

Hey @vstadmin a few questions:

What does the output look like when you run this? Do you have an `except` block for that `try` and if so, what does it look like?

---

<div class="post-metadata">

**Author:** ![vstadmin](https://avatars.discourse-cdn.com/v4/letter/v/439d5e/32.png) [@vstadmin](https://discuss.blues.com/u/vstadmin)\
**Post date:** [May 6, 2021, 12:31pm UTC](https://discuss.blues.com/t/i-am-trying-to-measure-temperature-inside-my-cabinet/248/3 "2021-05-06T12:31:17Z")

</div>

I haven’t actually tried to read the rsp and do anything with it. My system is a HMI-operated machine controller that doesn’t have a command line output while the HMI is running. I was going write something to attempt and extract the temp from the rsp, but I expected an event to popup in the event on [notehub.io](http://notehub.io).

---

<div class="post-metadata">

**Author:** ![bsatrom](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/bsatrom/32/3_2.png) [@bsatrom](https://discuss.blues.com/u/bsatrom)\
**Post date:** [May 6, 2021, 12:44pm UTC](https://discuss.blues.com/t/i-am-trying-to-measure-temperature-inside-my-cabinet/248/4 "2021-05-06T12:44:09Z")

</div>

Understood. I suspect that there’s an exception here that’s being swallowed by the try block. So I can try to repro, what are the contents of `global cont` and where is that set.

One idea you can try is to add an except block under your try and send that to the Notecard to at least get a “remote” debug view while you’re trying to run the issue down. Example:

```python
try:
  # contents of your try block above
except Exception as e: 
  req = {"req" :"note.add"}
  req["file"] = "error.qo"
  req["sync"] = True
  req["body"] = {"message": e}

   card.Transaction(req)

```

---

<div class="post-metadata">

**Author:** ![vstadmin](https://avatars.discourse-cdn.com/v4/letter/v/439d5e/32.png) [@vstadmin](https://discuss.blues.com/u/vstadmin)\
**Post date:** [May 6, 2021, 12:57pm UTC](https://discuss.blues.com/t/i-am-trying-to-measure-temperature-inside-my-cabinet/248/5 "2021-05-06T12:57:13Z")

</div>

I actually think I figured it out. I just expected that request to automatically send data to notehub. I assume that it does not since its talking directly the modem.

 ![Screen Shot 2021-05-06 at 8.52.53 AM](https://us1.discourse-cdn.com/flex020/uploads/blues/original/1X/c00de391bf61c1f97678120adff9269da6f6a880.jpeg)

I’m getting the answer down in the corner of the HMI now.  
I’m still clamoring through he API and documentation everyday while trying to improve my use of python. Sometimes what I expect to happen isn’t exactly what does happen.

---

<div class="post-metadata">

**Author:** ![bsatrom](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/bsatrom/32/3_2.png) [@bsatrom](https://discuss.blues.com/u/bsatrom)\
**Post date:** [May 6, 2021, 6:46pm UTC](https://discuss.blues.com/t/i-am-trying-to-measure-temperature-inside-my-cabinet/248/6 "2021-05-06T18:46:05Z")

</div>

Glad to hear it @vstadmin. And if you run into any other issues or questions, we’re here to help.
