3dprinter:octoprint
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
3dprinter:octoprint [2023/05/01 12:43] – [Tuya Smart Plug] Wulf Rajek | 3dprinter:octoprint [2023/05/29 11:55] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 111: | Line 111: | ||
- | ====== Tuya Plug/LED On/Off ====== | + | ====== |
The following python scripts can be used to switch on/off a Tuya compatible smart plug in the local network and to trigger two flashes in red of a smart LED, then restoring the LED to the previous colour and state. | The following python scripts can be used to switch on/off a Tuya compatible smart plug in the local network and to trigger two flashes in red of a smart LED, then restoring the LED to the previous colour and state. | ||
Line 119: | Line 119: | ||
{{: | {{: | ||
+ | |||
+ | {{: | ||
To locally control the Tuya devices, the tinytuya python module needs to be installed: | To locally control the Tuya devices, the tinytuya python module needs to be installed: | ||
Line 128: | Line 130: | ||
The module provides local system scanning options and methods to obtain the local key required to control the devices. The devices may need to be connected to a Tuya cloud account first and an API account set up. However, this might only be required if the devices need to be controlled from tinytuya using the cloud option from outside the local network. | The module provides local system scanning options and methods to obtain the local key required to control the devices. The devices may need to be connected to a Tuya cloud account first and an API account set up. However, this might only be required if the devices need to be controlled from tinytuya using the cloud option from outside the local network. | ||
More information provided here: https:// | More information provided here: https:// | ||
+ | |||
+ | |||
+ | Configure the slicer (Cura or others) to add gcode at the end of the sliced file to trigger shutting down the printer. | ||
+ | < | ||
+ | M81 ;switch off printer | ||
+ | </ | ||
+ | |||
<code python ~/ | <code python ~/ | ||
Line 159: | Line 168: | ||
# Optional: Keep socket open for multiple commands | # Optional: Keep socket open for multiple commands | ||
d.set_socketPersistent(True) | d.set_socketPersistent(True) | ||
- | d.set_socketNODELAY(True) | + | #d.set_socketNODELAY(True) |
- | d.set_sendWait(0) | + | #d.set_sendWait(0) |
- | d.turn_on(nowait=True) | + | |
# Get Status as dictionary | # Get Status as dictionary | ||
olddata = d.status() | olddata = d.status() | ||
olddps = olddata[' | olddps = olddata[' | ||
+ | |||
+ | #Switch on | ||
+ | d.turn_on(nowait=True) | ||
d.set_scene(3, | d.set_scene(3, | ||
Line 174: | Line 185: | ||
for key, value in olddps.items(): | for key, value in olddps.items(): | ||
# print(' | # print(' | ||
+ | if key == 1: | ||
+ | continue | ||
d.set_value(key, | d.set_value(key, | ||
+ | d.set_value(1, | ||
# ' | # ' | ||
# Wulf Default: | # Wulf Default: | ||
- | d.set_value(1, | ||
d.set_value(2, | d.set_value(2, | ||
d.set_value(3, | d.set_value(3, | ||
Line 188: | Line 201: | ||
d.set_value(9, | d.set_value(9, | ||
d.set_value(10, | d.set_value(10, | ||
+ | d.set_mode(mode=' | ||
+ | d.set_value(1, | ||
time.sleep(10) | time.sleep(10) | ||
Line 205: | Line 220: | ||
chmod 755 ~/ | chmod 755 ~/ | ||
</ | </ | ||
+ | |||
+ | |||
+ | ====== motion webcam ====== | ||
+ | |||
+ | https:// | ||
+ | https:// | ||
+ | |||
+ | < | ||
+ | sudo apt-get install motion | ||
+ | mkdir ~/.motion | ||
+ | vi ~/ | ||
+ | </ | ||
+ | <code - ~/ | ||
+ | videodevice /dev/video2 | ||
+ | picture_output off | ||
+ | movie_output off | ||
+ | stream_quality 98 | ||
+ | stream_grey off | ||
+ | stream_maxrate 5 | ||
+ | stream_port 8090 | ||
+ | stream_localhost off | ||
+ | stream_motion on | ||
+ | # stream_motion off #stream 1 fps when no motion detected | ||
+ | framerate 10 | ||
+ | movie_codec mpeg4 | ||
+ | # http:// | ||
+ | width 1280 | ||
+ | height 720 | ||
+ | auto_brightness off | ||
+ | vid_control_params " | ||
+ | #log_level 7 | ||
+ | webcontrol_interface 0 | ||
+ | webcontrol_localhost off | ||
+ | webcontrol_port 8091 | ||
+ | # | ||
+ | </ | ||
+ | |||
+ | Log Level 7 shows camera controls, e.g: | ||
+ | < | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | [1:ml1] [INF] [VID] v4l2_ctrls_list: | ||
+ | </ | ||
+ | |||
+ | Since the exact device number is set by the kernel upon boot, when there is more than one video device it is possible that the particular cameras that were assigned to /dev/video0 and /dev/video1 may switch. In order to set up Motion so that a particular camera is always assigned the same way, users can set up a symbolic link using udev rules. To do this a unique attribute must be identified for each camera. The camera attributes can be viewed by using the command < | ||
+ | |||
+ | Once a unique attribute has been identified for each camera, edit or create the file / | ||
+ | Assuming that the unique attribute for the camera was name and was '' | ||
+ | Once the change has been made and saved, reboot the computer and there should now be a " | ||
+ | |||
+ | |||
+ | URL for static current image: http:// | ||
3dprinter/octoprint.1682941439.txt.gz · Last modified: 2023/05/29 11:53 (external edit)