Getting wireless switch to work

236 views
Skip to first unread message

beyond

unread,
Dec 24, 2014, 1:40:35 AM12/24/14
to privat...@googlegroups.com
I am trying to make wireless reed sensor work. I have done following:
Connected switch with wireless transmitter using Wireless Switch Sensor Kit. Attached pic.
Connected wireless receiver to pi using Slice of Pi Breakout Board, wireless base station.. Attached pic. Where does XRF ground wire go?

Got all privateeyepi software
On privatepi site, added GPIO number: 81. 
Update globals for credentials and pin number though I am not sure I did it right for pin number. Here is Button B changes in globals.py
 #Button B is the second button on the RF Switch
        ButtonBList = []
        ButtonBId = []
        ButtonBList.append(81) # this is the device ID of the sensor
        ButtonBId.append(81)   # sensor number defined in the number field in t$

When I run "sudo python alarm.py" I get following error:
  File "alarm.py", line 172, in main
    BuildGPIOList()
  File "alarm.py", line 61, in BuildGPIOList
    GPIO.setup(GPIOList[i], GPIO.IN)
ValueError: The channel sent is invalid on a Raspberry Pi

When I run "sudo python rfsensor.py", I get following error:
"No RF sensors defined on server"

Which python script I am supposed to run for wireless door switch? How do I go about debugging this. 

Thanks

IMG_20141223_215622.jpg
IMG_20141223_215710.jpg

Gadjet Nut

unread,
Dec 24, 2014, 5:46:27 PM12/24/14
to privat...@googlegroups.com
Any reason why you are using button B and not button A? If you are only using one button then it's better to use button A otherwise you need to have both defined on the website and you will see both buttons on the dashboard (even though you only use one).

If you want to use Button B then the settings should be like this:

 ButtonBList = []
 ButtonBId = []
 ButtonBList.append(81) # this is the device ID of the sensor
 ButtonBId.append(82)   # sensor number defined on the website


beyond

unread,
Dec 24, 2014, 8:51:24 PM12/24/14
to privat...@googlegroups.com
I am planning to attach temperature sensor to Button A so I have attached to Button B. On privatepi website I added dummy temperature sensor. Updated globals.py to 
   ButtonBList.append(81) # this is the device ID of the sensor
        ButtonBId.append(82)   # sensor number defined in the number field in t$

But no change.rfsensory.py reported same issue: "No RF sensors defined on the server". On server I changed sensor type to "RF sensor" now "python rfsensor.py" doesn't print anything. 

Am I running right script? 
On server, should I choose "door sensor" or "RF sensor". It's wireless reed switch. 

Gadjet Nut

unread,
Dec 24, 2014, 10:03:02 PM12/24/14
to privat...@googlegroups.com
When you run rfthermtest.py do you get BUTTONBON and BUTTONBOFF when the switch opens and closes?

beyond

unread,
Dec 25, 2014, 8:06:39 PM12/25/14
to privat...@googlegroups.com
Yes, I get button ON/OF when switch opens and closes. 

Gadjet Nut

unread,
Dec 25, 2014, 9:12:37 PM12/25/14
to privat...@googlegroups.com
OK, so you know your wiring is correct. Next check your server settings. For a wireless switch the GPIO sensor must be configured and linked to a location of type "RF Sensor".

beyond

unread,
Dec 26, 2014, 1:16:40 AM12/26/14
to privat...@googlegroups.com
That's a relief. I think I was running wrong scripts. I should run "python rfsensory.py", When I ran script, got following exception:

Traceback (most recent call last):
  File "rfsensor.py", line 216, in <module>
    main()
  File "rfsensor.py", line 181, in main
    ProcessMessage(currvalue, 0, devID,1)
  File "rfsensor.py", line 57, in ProcessMessage
    for z in range(0,numrf,1):
NameError: global name 'numrf' is not defined

beyond

unread,
Jan 3, 2015, 10:52:43 AM1/3/15
to privat...@googlegroups.com
Gadjet Nut, any update on this. How to resolve error I am getting while running "python rfsensor.py". 

Gadjet Nut

unread,
Jan 3, 2015, 12:37:40 PM1/3/15
to privat...@googlegroups.com
As per previous post did you do this?

beyond

unread,
Jan 3, 2015, 10:42:32 PM1/3/15
to privat...@googlegroups.com
Yeah, I have done those steps. 

Gadjet Nut

unread,
Jan 4, 2015, 11:57:58 AM1/4/15
to privat...@googlegroups.com
What is the error that you are getting after making those changes? The more info you provide the faster you will get your answer. Also turn on PrintToScreen in globals.py and send us what you see on the screen after you run rfsensor.py. 

beyond

unread,
Jan 4, 2015, 5:40:47 PM1/4/15
to privat...@googlegroups.com
I have pasted it above :)

"python rfsensor.py"

Gadjet Nut

unread,
Jan 4, 2015, 6:04:21 PM1/4/15
to privat...@googlegroups.com
It's the lines that precede that that I am more interested in. rfsesnor.py will request all defined sensors from the server and display them on the screen. The error you are getting would suggest it is not receiving any rfsensors from the server. 

beyond

unread,
Jan 4, 2015, 8:14:44 PM1/4/15
to privat...@googlegroups.com
Yes you are right. When I was getting exception previous line was empty. Somehow it's working today. It gets sensor id from website and is working correctly. 

Thanks for your support. 

Justin Baker

unread,
Apr 10, 2016, 5:28:18 PM4/10/16
to PrivateEyePi
Folks,
This thread has been cold for a year, but I am hoping there are still eyes on it.

I had 3 temp sensor working for months and decided to purchase an RF switch for a door, but now I am having trouble getting the rfsensor script to run. I ran the rfthermtest.py script to obtain the deviceId of the new switch with no problems. I followed the steps Download and run the wireless software page, selection "RF Sensor" as the Type for the new switch (device id 73). I then ran the rfsensor.py which returned an error. See below. Thoughts? 

pi@raspberrypi:/home$ python rfsensor.py
BUTTONOFF
Traceback (most recent call last):
  File "rfsensor.py", line 264, in <module>
    main()
  File "rfsensor.py", line 229, in main
    ProcessMessage(currvalue, 0, devID,1)
  File "rfsensor.py", line 66, in ProcessMessage
    for z in range(0,numrf,1):
NameError: global name 'numrf' is not defined

When I navigate to the URL from the first debug print, the server returns the Devices that are configured on the server.:
57,Bedroom,67.1,/n,91,Outside Temp,59.65,/n,90,Thermostat,71.44,/n,73,Back Door,0,/n

Justin Baker

unread,
Apr 10, 2016, 5:38:22 PM4/10/16
to PrivateEyePi
Very strange....after walking away for 10mins and running the same exact rfsensory.py script, it is no longer throwing an error. ZERO CHANGES ON MY END. Frustrated...

Gadjet Nut

unread,
Apr 10, 2016, 9:59:19 PM4/10/16
to PrivateEyePi
NumRF not defined means you don't have any sensors to Type 'RFSENSOR' or 'Temperature' defined.
Reply all
Reply to author
Forward
0 new messages