Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

Hi there, complete electronics and coding newbie here. Thanks for your patience.
 

I'm using an ESP32 brick controlling a Dual Relay bricklet. I can connect, auth and send set_monoflop and set_value commands and get the relay to trigger with my python script. But when I send

idr.get_value()

or whatever variant of that (put the function in a variable and print it, etc..), I get this :

Traceback (most recent call last):
  File "C:\Users\U\PycharmProjects\Tinkerforge_test\Pump_control.py", line 70, in <module>
    idr.get_value()
  File "C:\Users\U\PycharmProjects\Tinkerforge_test\venv\lib\site-packages\tinkerforge\bricklet_industrial_dual_relay.py", line 123, in get_value
    self.check_validity()
  File "C:\Users\U\PycharmProjects\Tinkerforge_test\venv\lib\site-packages\tinkerforge\ip_connection.py", line 506, in check_validity
    device_identifier = self.ipcon.send_request(self, 255, (), '', 33, '8s 8s c 3B 3B H')[5] # <device>.get_identity
  File "C:\Users\U\PycharmProjects\Tinkerforge_test\venv\lib\site-packages\tinkerforge\ip_connection.py", line 1314, in send_request
    raise Error(Error.TIMEOUT, msg, suppress_context=True)
tinkerforge.ip_connection.Error: Did not receive response for function 255 in time (-1)


Any pointers on what I'm doing wrong to get the relay state ?

Thanks in advance

bearbeitet von Oberon

Geschrieben

The Bricklet doesn't respond to a request in time. The first thing to check in that case is that you use the correct UID to address the Bricklet. But because other functions work, I think you are using the correct UID already.

Do you have a load connected to the relay? If yes, does the problem go away when you disconnect the load from the relay?

Can you show your complete Pump_control.py?

Geschrieben
  • Autor

Thanks for the answer, I believe the UID is the correct one as it's the one also visible in bricky.

EDIT forgot to add I have no load connected to the relay, didn't get to that point yet.

Attached you'll find the .py file, I didn't edit anything except the auth secret.

Basically only the lines 57-70 are from me, the rest has been put together from the enumeration/auth/IDR example file.

When commenting out lines 57-58 the rest works (tested with lower time values)

 

Pump_control_tinkerunity.py

bearbeitet von Oberon

Geschrieben
  • Autor

I've just tested the temp/humidity sensor, including having only that bricklet connected. Modified the script based on the simple code example and it gives the same error at the humidity = h.get_humidity() line also mentioning a timeout on function 255. That sensor and same ESP board works using brickv, same for the relays and other bricklets I have.

Geschrieben

The way you structured the code you call idr.get_value() a little bit to early. You call idr.get_value() directly after the ipcon.connect() call. At that moment the authentication probably has not completed yet and the ESP32 Brick rejects all requests.

I modifed your example to wait for a few milliseconds before the idr.get_value() call for the authentication to complete. Please test the modification, it should fix the problem.

Pump_control_tinkerunity_v2.py

Geschrieben
  • Autor

Splendid, problem solved !

I think I'll make that line in the cb_connected and the check before starting the rest of the code a part of my template ;)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.