Control of 2 radio sockets

I'm new to OctoPrint and Raspberry Pi and was working with Windows only till now.

First of all I'm very impressed about functionality out of the box. Installation, controlling the printer, connecting a webcam and VPN access via Android-App, everything is working out of the box.

I'm searching for a solution since hours but didn't manage to find the solution.

My goal is to be able to switch on/off the printer and the LED-Light. I found 2 very old RC sockets in the cellar and bought a cheap 433 MHz transmitter/receiver (€ 2,50) to control them. I'm aware that using a relais or a sonoff are better options but currently I want to get it run!

What I was able to to:
Install the sender and temporarly receiver to the PI via GPIO
Via Putty:

  • Installed WiringPi
  • Installed 433Utils
  • Via ./RFSniffer I found out that each socket is using only 1 code with 6 digits for on/off. (When the socket is connected to power it's generally off.)
  • Via ./codesend I was able to switch them on/off via the sniffed code.

At this point the descriptions I found ended or were outdated and didn't work with plugins in OctoPrint (e.g. System Command Editor). That means I were not able to manage to transfer those functions or commands from the command mode to the web interface of OctoPrint.

How can I manage to:

  • Be able to send the command ( /433Utils/RPi_utils/codesend 123456 ) to switch on/off one the sockets?
  • If possible add a button (green/red) counts and shows that the status is on or off? ( I know that the switching process is not in control because the receiver (socket) gives no feedback).

I'm not sure if this is manageable via programming or plugin so I used "General" as category.

My equipment:

  • Sovol SV01
  • Raspberry Pi 4 with latest Octoprint Version
  • Logitech C310 webcam
  • FS1000A transmitter, using GPIO17

I hope my Englisch is good enough to understand what I want to do.

Any help is appreciated and welcome.

You didn't mention how you installed these. Did you install them globally in Raspbian or within the virtual environment of OctoPrint?

thank you for your information.

I logged in via Putty and installed it there.
After reboot my files are still there.

How can I see if I'm in the virtual or Raspian environment?
Where is the right place to install it and how can I switch?

Like I said, I'm new to a Raspberry and I followed instruction on the net which didn't speak about Raspian or virtual environment.

It would be very nice to get more information from you.

Typically in the Python world, the projects tend to fight with each over over their dependencies. This one requires a particular version of whatever and that one requires a different version.

So you'll see instructions which include virtualenv to create a new "code space", if you will. OctoPrint runs from a virtual environment called ~/oprint. When you do any pip install ... types of commands you're expected to have first:

source ~/oprint/bin/activate
# Do stuff
deactivate that you'll be installing the new stuff within that folder structure. Technically, the new stuff lands here: ls -lt ~/oprint/lib/python2.7/site-packages.

The pip freeze command will report back what is currently installed at your level. So if you haven't activated that virtual environment as described before and run pip freeze you're going to see what's installed for Python 2 at the global level. Repeat that using pip3 freeze and you'll see what's installed for the Python 3 platform at the global level.

Next, activate the virtual environment and repeat the pip freeze command. You should see octoprint of course.