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/04/30 05:30] – Wulf Rajek | 3dprinter:octoprint [2023/05/29 11:55] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 57: | Line 57: | ||
</ | </ | ||
- | ====== Tuya Smart Plug ====== | ||
- | |||
- | https:// | ||
- | https:// | ||
====== Nexus AI ====== | ====== Nexus AI ====== | ||
Line 112: | Line 108: | ||
G28 Z0 ;move Z to min endstops | G28 Z0 ;move Z to min endstops | ||
</ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ====== PSUControl + 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. | ||
+ | |||
+ | Using the PSUControl plugin, these scripts can be triggered automatically: | ||
+ | https:// | ||
+ | |||
+ | {{: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | To locally control the Tuya devices, the tinytuya python module needs to be installed: | ||
+ | |||
+ | < | ||
+ | pip install tinytuya | ||
+ | </ | ||
+ | |||
+ | 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:// | ||
+ | |||
+ | |||
+ | 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 ~/ | ||
+ | # | ||
+ | import tinytuya | ||
+ | |||
+ | # 3D Printer Plug | ||
+ | d = tinytuya.OutletDevice( | ||
+ | dev_id=' | ||
+ | address=' | ||
+ | local_key=' | ||
+ | version=3.3) | ||
+ | |||
+ | d.turn_on() | ||
+ | </ | ||
+ | |||
+ | <code python ~/ | ||
+ | # | ||
+ | import tinytuya | ||
+ | import time | ||
+ | |||
+ | # Hall Light | ||
+ | |||
+ | # Connect to Device | ||
+ | d = tinytuya.BulbDevice( | ||
+ | dev_id=' | ||
+ | address=' | ||
+ | local_key=' | ||
+ | version=3.1) | ||
+ | |||
+ | # Optional: Keep socket open for multiple commands | ||
+ | d.set_socketPersistent(True) | ||
+ | # | ||
+ | # | ||
+ | |||
+ | # Get Status as dictionary | ||
+ | olddata = d.status() | ||
+ | olddps = olddata[' | ||
+ | |||
+ | #Switch on | ||
+ | d.turn_on(nowait=True) | ||
+ | |||
+ | d.set_scene(3, | ||
+ | |||
+ | time.sleep(6) | ||
+ | |||
+ | # restoring old data | ||
+ | for key, value in olddps.items(): | ||
+ | # print(' | ||
+ | if key == 1: | ||
+ | continue | ||
+ | d.set_value(key, | ||
+ | d.set_value(1, | ||
+ | |||
+ | # ' | ||
+ | # Wulf Default: | ||
+ | d.set_value(2, | ||
+ | d.set_value(3, | ||
+ | d.set_value(4, | ||
+ | d.set_value(5, | ||
+ | d.set_value(6, | ||
+ | d.set_value(7, | ||
+ | d.set_value(8, | ||
+ | d.set_value(9, | ||
+ | d.set_value(10, | ||
+ | d.set_mode(mode=' | ||
+ | d.set_value(1, | ||
+ | |||
+ | time.sleep(10) | ||
+ | |||
+ | # 3D Printer Plug | ||
+ | p = tinytuya.OutletDevice( | ||
+ | dev_id=' | ||
+ | address=' | ||
+ | local_key=' | ||
+ | version=3.3) | ||
+ | |||
+ | p.turn_off() | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | 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.1682829058.txt.gz · Last modified: 2023/05/29 11:53 (external edit)