Git Product home page Git Product logo

raspberry-remote's People

Contributors

d-sko avatar devzero84 avatar fabianh001 avatar foodeas avatar isolution-de avatar lucabernstein avatar lukelr avatar marconett avatar phiber2000 avatar tillepille avatar xkonni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

raspberry-remote's Issues

Code send

hi, how do I send a 433MHz code like: 1115473?

1 button for all sockets

I'm not able programming php but I think it's easy. I want to have a button which can handle the on/off state of every socket at once. Could you please help me?

Encoding Plugs as with System in binary and unit in decimal

Hey dude! First of all great work! I'm gonna pick this up to either wrap it or port it to the java world.

But one thing i noticed:

If i want to send a signal to lets say a plug with the pins switched like this:

11111 10101

How do i do it? AFAIK you did it so you can have any binary system code like

01011 or 00001 or 11111

but for unit codes it is always all 0 except 1 pin set to 1.
Then in the console i have to type

./send 11111 3 1

if the pins are set like this: 11111 00100

So this limits me to 5 plugs per system config. Why not have it like this:

./send 11111 00100 1

would allow me to utulize way more plugs and i could e.g. iterate through all possible combinations of dips to turn all of them off/on together

64Bit Support?

Hi,

when I try to run under raspberry pi os 64Bit I get an error message. How can I get this nice tool to work on a 64bit OS?

root@mapi24:/home/pi/raspberry-remote# make
g++ -Wall -lwiringPi   -c -o RCSwitch.o RCSwitch.cpp
RCSwitch.cpp:31:42: warning: converting to non-pointer type ‘long unsigned int’ from NULL [-Wconversion-null]
 unsigned long RCSwitch::nReceivedValue = NULL;
                                          ^~~~
RCSwitch.cpp: In constructor ‘RCSwitch::RCSwitch()’:
RCSwitch.cpp:41:30: warning: converting to non-pointer type ‘long unsigned int’ from NULL [-Wconversion-null]
   RCSwitch::nReceivedValue = NULL;
                              ^~~~
RCSwitch.cpp: In member function ‘void RCSwitch::enableReceive()’:
RCSwitch.cpp:575:32: warning: converting to non-pointer type ‘long unsigned int’ from NULL [-Wconversion-null]
     RCSwitch::nReceivedValue = NULL;
                                ^~~~
RCSwitch.cpp:576:36: warning: converting to non-pointer type ‘unsigned int’ from NULL [-Wconversion-null]
     RCSwitch::nReceivedBitlength = NULL;
                                    ^~~~
RCSwitch.cpp: In member function ‘bool RCSwitch::available()’:
RCSwitch.cpp:588:38: warning: NULL used in arithmetic [-Wpointer-arith]
   return RCSwitch::nReceivedValue != NULL;
                                      ^~~~
RCSwitch.cpp: In member function ‘void RCSwitch::resetAvailable()’:
RCSwitch.cpp:592:30: warning: converting to non-pointer type ‘long unsigned int’ from NULL [-Wconversion-null]
   RCSwitch::nReceivedValue = NULL;
                              ^~~~
g++ -Wall -lwiringPi   -c -o daemon.o daemon.cpp
daemon.cpp: In function ‘int main(int, char**)’:
daemon.cpp:277:22: warning: ‘sprintf’ writing a terminating nul past the end of the destination [-Wformat-overflow=]
         sprintf(msg, "nState[%d] = %d", nAddr, nState[nAddr]);
                      ^~~~~~~~~~~~~~~~~
daemon.cpp:277:16: note: ‘sprintf’ output between 14 and 34 bytes into a destination of size 13
         sprintf(msg, "nState[%d] = %d", nAddr, nState[nAddr]);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
daemon.cpp:173:22: warning: ‘sprintf’ writing a terminating nul past the end of the destination [-Wformat-overflow=]
         sprintf(msg, "nState[%d] = %d", nAddr, nState[nAddr]);
                      ^~~~~~~~~~~~~~~~~
daemon.cpp:173:16: note: ‘sprintf’ output between 14 and 34 bytes into a destination of size 13
         sprintf(msg, "nState[%d] = %d", nAddr, nState[nAddr]);
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
g++ -Wall -pthread RCSwitch.o daemon.o -o daemon -Wall -lwiringPi
/usr/bin/ld: inkompatibles /usr/lib/gcc/aarch64-linux-gnu/8/../../../../lib/libwiringPi.so wird bei der Suche nach -lwiringPi übersprungen
/usr/bin/ld: inkompatibles /usr/lib/../lib/libwiringPi.so wird bei der Suche nach -lwiringPi übersprungen
/usr/bin/ld: inkompatibles /usr/lib/gcc/aarch64-linux-gnu/8/../../../libwiringPi.so wird bei der Suche nach -lwiringPi übersprungen
/usr/bin/ld: inkompatibles //usr/lib/libwiringPi.so wird bei der Suche nach -lwiringPi übersprungen
/usr/bin/ld: -lwiringPi kann nicht gefunden werden
collect2: error: ld returned 1 exit status
make: *** [Makefile:11: daemon] Fehler 1

webinterface

i use the systemcode 11000
when i use the send command like this
sudo ./send 11000 1 0
sudo ./send 11000 1 1
sudo ./send 11000 2 0
sudo ./send 11000 2 1
sudo ./send 11000 3 0
sudo ./send 11000 3 1
everything works fine

But the webinterface fails ....nothing happens
How should i make the correct settings in config.php ?
Is it necessary to put something in SERVER_ADDR ?

`$source = $_SERVER['SERVER_ADDR'];
$target = '192.168.1.48';
$port = 11337;

/*

  • specify configuration of sockets to use
  • array("systemcode", "group" , "plug", "description");
  • use empty string to create empty box
  • ""

*/
$config=array(
array("1", "11000", "10", "Plug 1"),
)
?>`

Powerswitch.cpp ipv6 socket?

I'm using the powerswitch app with my pi2 and it is working fine so far.
The gateway is the internal ipv4 from the pi. My isp only offers external ipv6 access..
so here is the problem I can't interact with the pi when I set the ext ipv6.

I have ipv6droid for tunneling mobile network. It is working perfectly with juicessh!

Any ideas? Thx for help :)

64Bit Support

Hi,

i have a raspi 4 with 8 GByte RAM, so i need to use the 64Bit version of raspberry pi os.

Can I use your tool under a raspi4 with 64Bit? When i Try to compile the files, I got following error:

root@mapi24:/home/pi/raspberry-remote# make send
g++ -Wall -lwiringPi   -c -o RCSwitch.o RCSwitch.cpp
RCSwitch.cpp:31:42: warning: converting to non-pointer type ‘long unsigned int’ from NULL [-Wconversion-null]
 unsigned long RCSwitch::nReceivedValue = NULL;
                                          ^~~~
RCSwitch.cpp: In constructor ‘RCSwitch::RCSwitch()’:
RCSwitch.cpp:41:30: warning: converting to non-pointer type ‘long unsigned int’ from NULL [-Wconversion-null]
   RCSwitch::nReceivedValue = NULL;
                              ^~~~
RCSwitch.cpp: In member function ‘void RCSwitch::enableReceive()’:
RCSwitch.cpp:575:32: warning: converting to non-pointer type ‘long unsigned int’ from NULL [-Wconversion-null]
     RCSwitch::nReceivedValue = NULL;
                                ^~~~
RCSwitch.cpp:576:36: warning: converting to non-pointer type ‘unsigned int’ from NULL [-Wconversion-null]
     RCSwitch::nReceivedBitlength = NULL;
                                    ^~~~
RCSwitch.cpp: In member function ‘bool RCSwitch::available()’:
RCSwitch.cpp:588:38: warning: NULL used in arithmetic [-Wpointer-arith]
   return RCSwitch::nReceivedValue != NULL;
                                      ^~~~
RCSwitch.cpp: In member function ‘void RCSwitch::resetAvailable()’:
RCSwitch.cpp:592:30: warning: converting to non-pointer type ‘long unsigned int’ from NULL [-Wconversion-null]
   RCSwitch::nReceivedValue = NULL;
                              ^~~~
g++ -Wall -lwiringPi   -c -o send.o send.cpp
send.cpp: In function ‘int main(int, char**)’:
send.cpp:184:65: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
                         mySwitch.send("010101010001000101010001");
                                                                 ^
send.cpp:188:61: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
                         mySwitch.sendTriState("FFFF0F0FFF0F");
                                                             ^
g++ RCSwitch.o send.o -o send -Wall -lwiringPi
/usr/bin/ld: inkompatibles /usr/lib/gcc/aarch64-linux-gnu/8/../../../../lib/libwiringPi.so wird bei der Suche nach -lwiringPi übersprungen
/usr/bin/ld: inkompatibles /usr/lib/../lib/libwiringPi.so wird bei der Suche nach -lwiringPi übersprungen
/usr/bin/ld: inkompatibles /usr/lib/gcc/aarch64-linux-gnu/8/../../../libwiringPi.so wird bei der Suche nach -lwiringPi übersprungen
/usr/bin/ld: inkompatibles //usr/lib/libwiringPi.so wird bei der Suche nach -lwiringPi übersprungen
/usr/bin/ld: -lwiringPi kann nicht gefunden werden
collect2: error: ld returned 1 exit status
make: *** [Makefile:14: send] Fehler 1

Cannot call 01 / 08

I can access all my remote plugs with my remote and als via ./send 00011.... Only the 01 and 08 I can´t access. What seems to be the problem here?

Actually I can http://192.168.1.100/index.php?group=00011&sys=1&switch=08&action=1&delay=0

But It never sets the action to 1 - its always on 0.

/*
 * define ip address and port here
 */
$source = $_SERVER['SERVER_ADDR'];
$target = '192.168.1.100';
$port = 11337;

/*
 * specify configuration of sockets to use
 *   array("systemcode", "group" , "plug", "description");
 * use empty string to create empty box
 *   ""
 *
 */
$config=array(
  /*
   * Elro
   */
  array("1","00011","16","1"),
  array("1","00011","08","2"),
  array("1","00011","04","3"),
  array("1","00011","02","4"),
  array("1","00011","01","5"),

Resolved --- Addressing more plugs ?

Hi Xkonni,

like your code very much - especially the daemon.
Thanks for this.
I'm not very good in direct memory adressing and I'm desparately trying to enlarge the numbers of plugs because I try to control other items than standard 433 MHz power plugs.
So I want to use the two bit plug section of command line to send numbers above 5 - up to 99.
But this doesn't work and I cannot identify why. With my understanding the error occurs in "getadr" but I cannot step in caused by the lack of an IDE with runtime module so I unfortunately got just a rough idea of working principle of your code.
Do you have a hint for me how to solve this?
I would like to send xxxxxyyz to ip:port where yy is 00 to 99.
If xxxxx could be 00001 to 99999 it would be absolutely phantastic and worth a box of champagne (for you :-) )
Thanks a lot for any hint.

Kindest regards,
Ralf

Help! arm64bit instruction // compiler

Hi,

Question:
Are there any ideas or documentation on how to run this program in an 64bit environment?

What I did:
Compile *send.cpp using make * in a 64bit environment.

OS: Ubuntu Server 21.10 64bit arm

Help is requested, respectfully.

ubuntu@ubuntu:~/raspberry-remote$ make send

Error:

ubuntu@ubuntu:~/raspberry-remote$ make send
g++ RCSwitch.o send.o -o send -Wall -lwiringPi
/usr/bin/ld: RCSwitch.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
make: *** [Makefile:14: send] Error 1

remote config with group 01010

If I use the group 01010 the webinterface akt wrong!

e.g. using this config:

$config=array(
array("00001", "01", "nix"),
array("00010", "05", "Raid System"),
"",
"",
array("00010", "02", "Tuerkranz"),
array("01010", "01", "Flasche"),
array("00010", "03", "nix"),
array("00010", "04", "nix"),
)

If you klick on Tuerkranz ... also Flasche will be green, but not switching the device.
But if you klick Flasche, nothing happens.

Pairing sockets without "Standard-DIP-Switches"

Hi there,
I got a Problem getting the scripts to work, maybe someone can point me to a solution:
I used the "RCSwitch" library with an Arduino in the past, now i wanted to connect the sockets with my RPi. In my old Arduino script I called the function as follows: switchOn(4, 2) which worked. Now I am calling: sudo ./send 4 2 1 which seems not to work. It seems the send.cpp script only sends a Signal if one calls it with something like: sudo ./send 00001 2 1

Now I don´t know how to get to the binary representation of the systemcode which in my case is 4 indicated by a Rotary Switch on the socket.
Actually there are 2 Rotary Switches on the socket, first indicating "IV" == 4, second indicating "2"

Does anyone know what the correct Parameter for "send" would be in this case?

I would be very happy if someone could give me a hint.
Thanks,
dbrenk

Webinterface dos not work

Hey,

I really don't know why the webinterface is not working. When I write the code in the terminal with the code 11111 4 it works. But in the webinterface is does not. My array is ("1" , "11111","04","Nr 1.").
I actually have no idea what went wrong :(

Checking the status

I already had a script which had the output 0 or 1 depending on the state of the socket, but I can not find it anymore. Does anybody else have a php script for me?

connection fd

the current code for the daemon does not close the connect file descriptors (newsockfd). in an application where there are a large number of accepts to be made, the daemon eventually terminates when no more file descriptors are available. this is the case, as an example, in an application where the server would run a cron job every minute to automatically switch sockets.
fix: as you do not need the fork threads for this to work, switch the sockets in the while loop (not in a separate thread) and close newsockfd at the bottom of the while loop.
you can check whether you have a fd problem with the following commands:
ps -ax | grep daemon # daemon must be your executable file name
lsof -p # the pid you received with the previous command

IPv6 - Could not bind to socket

Hi,

everytime i try to access the webinterface via a ipv6 device it get "could not bind to socket"-error (from the second part in the index.php (the error-message is implemented twice).
Is it possible to accept IPv6 and IPv4?

Otherwise i will try to rewrite the code of the webinterface to accept both.

Regards

recive.cpp

Hi,

Did you try to translate receive.cpp?
The new wiring pi release include intrrerupt function, which is the core of recive.cpp.

You did a good work with send.cpp

Webinterface "Could not connect to Socket" Problem Solved

I had a Problem with the new Webinterface.
So i entered my housecode in systemcode and ran into that "Could not connect to socket" problem.

I couldn´t conect to the Socket because i thought that the systemcode is the housecode (f.e 10111), but the housecode is in the config.php the "group".

I have the "Brennenstuhl" Plugs and the Plugcode is in my case:
16 for A
08 for B
04 for C
02 for D
01 for E

So here is the solution for guys who have the same problem:

raspberry-remote

webinterface - Intertechno switches don't work

As far as I use the array ("2" , "01","01","Intertechno 1") within the config.php file,
the daemon gives me an error output (elro switches are working):

message: 111111042
nSys: 1
nGroup: 11111
nSwitchNumber: 4
nAction: 2
nAddr: 996
nPlugs: 1024

message: 201012
nSys: 2
nGroup: 01
nSwitchNumber: 1
nAction: 2
nAddr: 33
nPlugs: 1024
Switch out of range: 01:1

Strange thing is, Intertechno Switches can't even be clicked on, they neither get switched nor the status is updating.

Any Idea?

Daemon crashes with Stretch

i recently upgraded my raspberry to Raspbian Stretch, but after that the daemon crashes pretty much once a day.
Webserver works fine, after restarting the daemon it works also flawlessly.

Anyone else experiencing these problems or having an idea why this is?

I didnt try to setup a clean stretch, i would try this if no one else has these problems...

Attach to Blynk platform?

Note: this is an enhancement advise (not a request)
I have started to use Blynk to build apps that communicate with my Raspberry Pi, see www.blynk.cc blynk-library uses wiringPi to send GPIO commands (see github.com/blynkkk/blynk-library/blob/master/docs/Platforms.md). Would you think it is feasible to add your code to blynk-library so that I can control power outlets?

Doesn't compile

On a RPi3 with a recent Arch Linux ARM running, this doesn't compile (GCC 8.2.0). I get lots of these errors:

RCSwitch.cpp: In member function 'char* RCSwitch::getCodeWordB(int, int, boolean)':
RCSwitch.cpp:218:12: error: invalid conversion from 'char' to 'char*' [-fpermissive]
     return '\0';
            ^~~~

Daemon randomly crashes - Too many open files

Though I already commented on #28 I thought it would create more attention if I instead opened a new issue.

My issue is that the raspberry-remote daemon crashes at least once a day.

I found the following in the logs from journalctl, stating the following:

Oct 15 12:07:02 some-123-wks daemon[20908]: message: 111111160
Oct 15 12:07:02 some-123-wks daemon[20908]: nSys: 1
Oct 15 12:07:02 some-123-wks daemon[20908]: nGroup: 11111
Oct 15 12:07:02 some-123-wks daemon[20908]: nSwitchNumber: 16
Oct 15 12:37:03 some-123-wks daemon[20908]: nActERROR on accept: Too many open files
Oct 15 12:37:03 some-123-wks daemon[20908]: ion: 0
Oct 15 12:37:03 some-123-wks daemon[20908]: nAddr: 1008
Oct 15 12:37:03 some-123-wks daemon[20908]: nPlugs: 1280
Oct 15 12:37:03 some-123-wks daemon[20908]: message: 111111160
[...]
Oct 15 12:37:03 some-123-wks daemon[20908]: message: 111111160
Oct 15 12:37:03 some-123-wks daemon[20908]: nSys: 1
Oct 15 12:37:03 some-123-wks daemon[20908]: nGroup: 11111
Oct 15 12:37:03 some-123-wks daemon[20908]: nSwitchNumber: 16
Oct 15 12:37:03 some-123-wks daemon[20908]: nAction: 0
Oct 15 12:37:03 some-123-wks daemon[20908]: nAddr: 1008
Oct 15 12:37:03 some-123-wks daemon[20908]: nPlugs: 1280
Oct 15 12:37:03 some-123-wks systemd[1]: bluelight_daemon.service: Main process exited, code=exited, status=1/FAILURE
Oct 15 12:37:03 some-123-wks systemd[1]: bluelight_daemon.service: Failed with result 'exit-code'.

When I restart the service so that it is running and send a command to the port with echo -en "111111160"|nc -w 1 some-123-wks 11337 no log is created.

Have you any idea what creates those logs instead?
Update: They seem to be added in batch every now and then.

Thanks in advance!

Luca

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.