User Tools

Site Tools


3dprinter:octoprint

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
3dprinter:octoprint [2023/05/01 13:11] – [PSUControl + Tuya Plug/LED On/Off] Wulf Rajek3dprinter:octoprint [2023/05/29 11:55] (current) – external edit 127.0.0.1
Line 119: Line 119:
  
 {{:3dprinter:pasted:20230501-123913.png}} {{:3dprinter:pasted:20230501-123913.png}}
 +
 +{{:3dprinter:pasted:20230501-213901.png}}
  
 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 166: 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)
  
 # Get Status as dictionary # Get Status as dictionary
Line 183: Line 185:
 for key, value in olddps.items(): for key, value in olddps.items():
     # print('%s : %s' % (key, value))     # print('%s : %s' % (key, value))
 +    if key == 1:
 +        continue
     d.set_value(key, value)     d.set_value(key, value)
 +d.set_value(1, olddps['1'])
  
 # 'dps': {'1': True, '2': 'colour', '3': 135, '4': 255, '5': '301f000027ff2f', '6': 'cf38000168ffff', '7': 'ffff500100ff00', '8': 'ffff8003ff000000ff000000ff000000000000000000', '9': 'ffff5001ff0000', '10': 'ffff0505ff000000ff00ffff00ff00ff0000ff000000'}} # 'dps': {'1': True, '2': 'colour', '3': 135, '4': 255, '5': '301f000027ff2f', '6': 'cf38000168ffff', '7': 'ffff500100ff00', '8': 'ffff8003ff000000ff000000ff000000000000000000', '9': 'ffff5001ff0000', '10': 'ffff0505ff000000ff00ffff00ff00ff0000ff000000'}}
 # Wulf Default: # Wulf Default:
-d.set_value(1, olddps['1']) 
 d.set_value(2, "colour") d.set_value(2, "colour")
 d.set_value(3, 135) d.set_value(3, 135)
Line 197: Line 201:
 d.set_value(9, 'ffff5001ff0000') d.set_value(9, 'ffff5001ff0000')
 d.set_value(10, 'ffff0505ff000000ff00ffff00ff00ff0000ff000000') d.set_value(10, 'ffff0505ff000000ff00ffff00ff00ff0000ff000000')
 +d.set_mode(mode='colour'      # white, colour, scene, music
 +d.set_value(1, olddps['1'])
  
 time.sleep(10) time.sleep(10)
Line 214: Line 220:
 chmod 755 ~/.local/bin/3doff.py chmod 755 ~/.local/bin/3doff.py
 </code> </code>
 +
 +
 +====== motion webcam ======
 +
 +https://motion-project.github.io/motion_config.html
 +https://forums.raspberrypi.com/viewtopic.php?t=324883
 +
 +<code>
 +sudo apt-get install motion
 +mkdir ~/.motion
 +vi ~/.motion/motion.conf
 +</code>
 +<code - ~/.motion/motion.conf>
 +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://192.168.1.3:8080/webcam1.cgi
 +width 1280
 +height 720
 +auto_brightness off
 +vid_control_params "contrast"=0,"saturation"=0
 +#log_level 7
 +webcontrol_interface 0
 +webcontrol_localhost off
 +webcontrol_port 8091
 +#emulate_motion on #always save images even without motion
 +</code>
 +
 +Log Level 7 shows camera controls, e.g:
 +<code>
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ---------Controls---------
 +[1:ml1] [INF] [VID] v4l2_ctrls_list:   V4L2 ID   Name and Range
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963776 Brightness, -64 to 64
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963777 Contrast, 0 to 64
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963778 Saturation, 0 to 128
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963779 Hue, -40 to 40
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963788 White Balance, Automatic, 0 to 1
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963792 Gamma, 72 to 500
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963795 Gain, 0 to 100
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963800 Power Line Frequency, 0 to 2
 +[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 0 Disabled
 +[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 1 50 Hz
 +[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 2 60 Hz
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963802 White Balance Temperature, 2800 to 6500
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963803 Sharpness, 0 to 6
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID09963804 Backlight Compensation, 0 to 2
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094849 Auto Exposure, 0 to 3
 +[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 1 Manual Mode
 +[1:ml1] [INF] [VID] v4l2_ctrls_list:   menu item: Value 3 Aperture Priority Mode
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094850 Exposure Time, Absolute, 1 to 5000
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: ID10094851 Exposure, Dynamic Framerate, 0 to 1
 +[1:ml1] [INF] [VID] v4l2_ctrls_list: --------------------------
 +</code>
 +
 +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 <code>udevadm info -a -p $(udevadm info -q path -n /dev/video0)</code> while the camera is attached. Usually a serial number can be used. ("Usually" because some cameras have been observed to have the same serial number for different cameras)
 +
 +Once a unique attribute has been identified for each camera, edit or create the file /etc/udev/rules.d/99-local.rules.
 +Assuming that the unique attribute for the camera was name and was ''ATTR{name}=="Philips SPC 900NC webcam"'' you would add the following line to the 99-local.rules file: <code>KERNEL=="video[0-9]*", ATTR{name}=="Philips\ SPC\ 900NC*", SYMLINK+="video-webcam0"</code>
 +Once the change has been made and saved, reboot the computer and there should now be a "sticky" device called /dev/video-webcam0
 +
 +
 +URL for static current image: http://localhost:8090/current
  
3dprinter/octoprint.1682943099.txt.gz · Last modified: 2023/05/29 11:53 (external edit)