[secrets] # Add as many sections as needed for the devices you want to control. [power tuyaplug] type: http # In the below urls, should be replaced with your device name per names.json, devices.json/snapshot.json # should be replaced with the hostname and port of the service. on_url: http://192.168.1.2:7126/on/3D-Printer off_url: http://192.168.1.2:7126/off/3D-Printer status_url: http://192.168.1.2:7126/status/3D-Printer request_template: {% if command in ["on", "off"] %} {% do http_request.set_method("PUT") %} {% do http_request.add_header("api_key", "%s" % "ah2CTGhxONWEb76I1O5qZvM7yacCKmhf" ) %} {% do http_request.set_body({}) %} {% endif %} {% do http_request.send() %} response_template: {% set resp = http_request.last_response().json() %} {resp["status"]} off_when_shutdown: False # If set to True the device will be powered off when Klipper enters # the "shutdown" state. This option applies to all device types. # The default is False. # off_when_shutdown_delay: 0 # If "off_when_shutdown" is set, this option specifies the amount of time # (in seconds) to wait before turning the device off. Default is 0 seconds. on_when_job_queued: True # If set to True the device will power on if a job is queued while the # device is off. This allows for an automated "upload, power on, and # print" approach directly from the slicer, see the configuration example # below for details. The default is False. locked_while_printing: True # If True, locks the device so that the power cannot be changed while the # printer is printing. This is useful to avert an accidental shutdown to # the printer's power. The default is False. restart_klipper_when_powered: True # If set to True, Moonraker will schedule a "FIRMWARE_RESTART" to command # after the device has been powered on. If it isn't possible to immediately # schedule a firmware restart (ie: Klippy is disconnected), the restart # will be postponed until Klippy reconnects and reports that startup is # complete. Prior to scheduling the restart command the power device will # always check Klippy's state. If Klippy reports that it is "ready", the # FIRMWARE_RESTART will be aborted as unnecessary. # The default is False. restart_delay: 8. # If "restart_klipper_when_powered" is set, this option specifies the amount # of time (in seconds) to delay the restart. Default is 1 second. # This enables a power button in mainsail. bound_services: klipper