Jump to content

perl and Remote Switch Bricklet


vukomir

Recommended Posts

HI,

 

I got a mater bricket and a Remote Switch Bricklet to control Intertechno ITL-210 Dimmer (flush-mounted) B, from windows everything works fine when using

Brick Viewer

i installed the service on beagle bone black and from the logs i can see that the master brick was detected when connected to the USB.

 

i tried using perl exemple to turn on and off the lights but with no success :(

 

i'm not sure if i'm configuring it the right way.

 

using example_switch_socket.pl

 

on the constant UID do i put the master bricket or Remote Switch Bricklet ID?

 

and i'm not 100% sure on the order of switch_socket(XXX, YYY,$rs->SWITCH_TO_ON);

 

is the XXX the address from Brick Viewer and YYY is the Unit?

 

when i run ./example_switch_socket.pl

root@beaglebone:~/perl/scripts/bricklet/remote_switch# ./example_switch_socket.pl

Character in 'C' format wrapped in pack at /root/perl/plugin/Tinkerforge/Device.pm line 147.

Press any key to exit...

 

and the log file

2014-07-25 14:02:47.500698 <I> <other|main_linux.c:399> Brick Daemon 2.1.0 started (daemonized)
2014-07-25 14:02:47.766618 <I> <usb|usb.c:144> Added USB device (bus: 1, device: 2) at index 0: Master Brick [6JLxVA]
2014-07-25 14:03:53.043673 <I> <network|network.c:105> Added new client (S: 16, T: plain, P: 127.0.0.1, A: disabled)
2014-07-25 14:03:56.122124 <I> <network|client.c:242> Client (S: 16, T: plain, P: 127.0.0.1, A: disabled) disconnected by peer
2014-07-25 14:18:29.056831 <I> <usb|usb.c:313> Removing USB device (bus: 1, device: 2) at index 0: Master Brick [6JLxVA]
2014-07-25 14:18:29.662647 <I> <usb|usb.c:144> Added USB device (bus: 1, device: 3) at index 0: Master Brick [6JLxVA]
2014-07-25 14:18:41.221222 <I> <network|network.c:105> Added new client (S: 16, T: plain, P: 127.0.0.1, A: disabled)
2014-07-25 14:18:42.269642 <I> <network|client.c:242> Client (S: 16, T: plain, P: 127.0.0.1, A: disabled) disconnected by peer
2014-07-25 14:19:41.478672 <I> <network|network.c:105> Added new client (S: 16, T: plain, P: 127.0.0.1, A: disabled)
2014-07-25 14:19:42.479255 <I> <network|client.c:242> Client (S: 16, T: plain, P: 127.0.0.1, A: disabled) disconnected by peer

 

 

 

Br,

Vuko

Link zu diesem Kommentar
Share on other sites

Hallo vukomir,

 

after installing the brickd on Beagle Bone, can switch the Intertechno via Brickviewer from PC via Network?

 

on the constant UID do i put the master bricket or Remote Switch Bricklet ID?

 

The UID is the UID of the Bricklet, in your case of the "Remote Switch Bricklet".

 

 

and i'm not 100% sure on the order of switch_socket(XXX, YYY,$rs->SWITCH_TO_ON);

 

# Switch socket with house code 42 and receiver code 23 on

$rs->switch_socket(42, 23, $rs->SWITCH_TO_ON);

 

Please use YOUR values from Brickviewer here!

 

Maybe more helpful information here: Perl - Remote Switch Bricklet

 

 

Der Loetkolben

Link zu diesem Kommentar
Share on other sites

bellow is the log in debug mode

2014-07-29 12:38:07.985312 <D> <event|event_posix.c:234> Poll returned 1 event source(s) as ready

2014-07-29 12:38:07.985863 <D> <event|event_posix.c:260> Handling generic event source (handle: 10, received events: 1) at index 4

2014-07-29 12:38:07.986327 <D> <network|client.c:412> Creating client from socket (handle: 12)

2014-07-29 12:38:07.986849 <D> <event|event.c:140> Added generic event source (handle: 12, events: 1) at index 6

2014-07-29 12:38:07.987207 <I> <network|network.c:105> Added new client (S: 12, T: plain, P: 192.168.0.28, A: disabled)

2014-07-29 12:38:07.987539 <D> <event|event_posix.c:275> Handled all ready event sources

2014-07-29 12:38:07.987864 <D> <event|event_posix.c:214> Starting to poll on 7 event source(s)

2014-07-29 12:38:07.996902 <D> <event|event_posix.c:234> Poll returned 1 event source(s) as ready

2014-07-29 12:38:07.997352 <D> <event|event_posix.c:260> Handling generic event source (handle: 12, received events: 1) at index 6

2014-07-29 12:38:07.997750 <D> <network|client.c:303> Got request (U: 1, L: 8, F: 254, S: 2, R: 0) from client (S: 12, T: plain, P: 192.168.0.28, A: disabled)

2014-07-29 12:38:07.998117 <D> <hardware|hardware.c:102> No stacks connected, dropping request (U: 1, L: 8, F: 254, S: 2, R: 0)

2014-07-29 12:38:07.998528 <D> <event|event_posix.c:275> Handled all ready event sources

2014-07-29 12:38:07.998862 <D> <event|event_posix.c:214> Starting to poll on 7 event source(s)

2014-07-29 12:38:17.989430 <D> <event|event_posix.c:234> Poll returned 1 event source(s) as ready

2014-07-29 12:38:17.990073 <D> <event|event_posix.c:260> Handling generic event source (handle: 12, received events: 1) at index 6

2014-07-29 12:38:17.990460 <D> <network|client.c:299> Got disconnect probe from client (S: 12, T: plain, P: 192.168.0.28, A: disabled), dropping request

2014-07-29 12:38:17.990928 <D> <event|event_posix.c:275> Handled all ready event sources

2014-07-29 12:38:17.991256 <D> <event|event_posix.c:214> Starting to poll on 7 event source(s)

2014-07-29 12:38:22.991430 <D> <event|event_posix.c:234> Poll returned 1 event source(s) as ready

2014-07-29 12:38:22.991974 <D> <event|event_posix.c:260> Handling generic event source (handle: 12, received events: 1) at index 6

2014-07-29 12:38:22.992356 <D> <network|client.c:299> Got disconnect probe from client (S: 12, T: plain, P: 192.168.0.28, A: disabled), dropping request

2014-07-29 12:38:22.992828 <D> <event|event_posix.c:275> Handled all ready event sources

2014-07-29 12:38:22.993165 <D> <event|event_posix.c:214> Starting to poll on 7 event source(s)

2014-07-29 12:38:27.993656 <D> <event|event_posix.c:234> Poll returned 1 event source(s) as ready

2014-07-29 12:38:27.994199 <D> <event|event_posix.c:260> Handling generic event source (handle: 12, received events: 1) at index 6

2014-07-29 12:38:27.994735 <D> <network|client.c:299> Got disconnect probe from client (S: 12, T: plain, P: 192.168.0.28, A: disabled), dropping request

2014-07-29 12:38:27.995110 <D> <event|event_posix.c:275> Handled all ready event sources

 

Link zu diesem Kommentar
Share on other sites

2014-07-29 12:38:07.998117 <D> <hardware|hardware.c:102> No stacks connected, dropping request (U: 1, L: 8, F: 254, S: 2, R: 0)

 

According to brickd you don't have any Bricks connected to USB.

 

There was a problem with the USB host on original Beagle Bone, Bricks connected to it didn't work properly due to some USB problem. Maybe the

Beagle Bone Black still has this problem, I don't know.

 

Things you can test:

 

- Does it work if you connect the Brick directly to your PC instead of the Beagle Bone?

 

- Do you have an USB hub at hand to connect between the Beagle Bone and the Brick?

Link zu diesem Kommentar
Share on other sites

Hi,

 

I reinstalled the os(debian) on the BBB and now i can connect with the Brick Viewer over the network and i can switch on and off ITL-210 Dimmer

 

only it's not working with perl.

in the Viewer i set the address to 1234 and the unit to 1 with this configuration it works, but if i set the same values in the perl script i get

root@beaglebone:~/perl/scripts/bricklet/remote_switch# ./example_switch_socket.pl
Character in 'C' format wrapped in pack at /root/perl/lib/Tinkerforge/Device.pm line 147.
Press any key to exit...

 

 

Br,

Vuko

 

 

 

Link zu diesem Kommentar
Share on other sites

Ahhh! Sorry, I totally misunderstood your problem.

 

Everything is working, except from the Perl example.

 

Okay, now I see what your problem is.

 

There is a problem in our Perl example for the Remote Switch Bricklet. It is calling the switch_socket() function. This function is there for backward compatibility only. It should actually call the switch_socket_a() function for type A devices.

 

But you have a type B device (ITL-210). You need to call switch_socket_b() function. Actually you need to call the dim_socket_b() function, because the ITL-210 is a dimmer.

 

You need to replace this line in the example

 

$rs->switch_socket(42, 23, $rs->SWITCH_TO_ON);

 

with this line

 

$rs->dim_socket_b(1234, 1, 7);

 

to set the dimmer value to 7.

Link zu diesem Kommentar
Share on other sites

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...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...