Power Button

Hello, 

I'm using power on/off button with mqtt topic. 

Is it possible to have a button reflecting power status. (maybe by changing color of the button)

Thanks

Comments

  • You have the power state in the state property of your printer as field powerOn in SERVER_ID/state/<slug>/state like this:

    {"activeExtruder":0,"autostartNextPrint":false,"condition":1,"conditionReason":"","debugLevel":6,"doorOpen":false,"extruder":[{"error":0,"output":0.0,"tempRead":20.0,"tempSet":0.0},{"error":0,"output":0.0,"tempRead":20.0,"tempSet":0.0},{"error":0,"output":0.0,"tempRead":20.0,"tempSet":0.0}],"fans":[{"on":false,"voltage":0},{"on":false,"voltage":0},{"on":false,"voltage":0},{"on":false,"voltage":0}],"filterFan":false,"firmware":"Repetier_0.92.6","firmwareStyle":"craftbot","firmwareURL":"https://github.com/repetier/Repetier-Firmware/","flowMultiply":100,"hasXHome":false,"hasYHome":false,"hasZHome":false,"heatedBeds":[{"error":0,"output":0.0,"tempRead":20.0,"tempSet":0.0}],"heatedChambers":[{"error":0,"output":0.0,"tempRead":20.0,"tempSet":0.0}],"layer":0,"lights":0,"maxLayer":0,"notification":"","numExtruder":3,"powerOn":false,"rec":false,"sdcardMounted":true,"shutdownAfterPrint":false,"speedMultiply":100,"volumetric":false,"x":0.0,"xOff":0.0,"y":0.0,"yOff":0.0,"z":0.0,"zOff":0.0}

    So you can just use that to do whatever you want in your mqtt client. How you do that depends on your mqtt client I guess. In homeassistant for example you could define a binary_sensor with

    "state_topic":"RepetierServer-xxxxxx-781c-46c9-9672-3a4e128444e3/state/Felix/state"
    "value_template":"{{ value_json.powerOn }}"
    "payload_on":"True"
    "payload_off":"False"

    and then use this in your button logic.
  • edited June 2022
    Yes, i use that. But I speak in repetier-server application. I see the on/off button, but i can't see the state of my power.

    It's a toggle button without visible state.
  • Ok, mqtt brought me to wrong direction:-) Coloring is a nice idea. Added for next release so it is green for enabled and red for disabled.
  • Hello, sorry for this old subject, is it possible to use home assistant to publish a powerOn / powerOff command ?
  • All api commands not requiring files are available via MQTT which you use to connect to home assistant, so yes should be possible. See https://prgdoc.repetier-server.com/v1/docs/index.html#/en/web-api/mqtt for mqtt integration details. Use command to send gcode and send

    @runButtonCommand togglePower

  • and the oposite, send a command from Home assistant to repetier ?
  • Same. Topic RepetierServer-1/cmd/gcode/<slug> can be used to send gcode directly to printer from home assistant. Just ensure that executing send gcodes is enabled in server mqtt settings.
Sign In or Register to comment.