RS 1.2.1 and HomeAssistant Integration broken?

2»

Comments

  • What I say is that you can create own messages to be send to MQTT server. I'm not aware that kasa plugs can use MQTT for communication, but if they use same MQTT broker that would be a solution. I only use them over IFTTT. So what you do with these extra messages is up to you - having HA detect them and start a delayed disable of plug was what I proposed, but I'm not that much into HA to say how this would work. Maybe it would be easier to directly use IFTTT with delayed trigger. Probably they have an action for this as well.
  • Actually no, that would not change anything in fact. I have no problem switching off the printer via a smart plug. I don't need Repetierserver for that.
    We are talking about Homassistant , right? 
    What I would like to do is to have the ability to send Repetier Server a shutdown command. That was my initial idea. Since Repetier seems to listen to MQTT and not only publishes (Pause-, Stop-Button in HA) I thought it would be the simpleste idea to just send Repetier a shutdown by another button implemented by the interface.
    After that we could switch of the whole equipment via the smartplug by HA.
    This would not involve any custom script commands and would work right out of the box on every HA installation with Repetier.
  • If I understand corrctly, you don't want do implement this?
    How would I implement an action that Repetier executes on a specific MQTT Topic/Message?
  • You are just thinking the wrong way. You can server make subscribe for a topic using:

    @mqttSubscribe topic function

    Subscribes to a topic and calls the given function, when the value is published. For retained messages the first message is received on subscription, so make sure to define the function before subscribing! The function gets called with the two parameter topic and payload.

    Note: Often payloads are JSON encoded. You can use the json_ expression functions to access the contained values.


    But that does not help. You want HA to shutdown plug with delay, so HA must subscribe to a message and in the shutdown function you pubish that message as I showed you in previous post.

    This is so special I can not write a general solution for it. It depends on plug and which external software you use, requires secret links etc. 
  • Thanks for answering, but maybe I didn‘t explain properly what I was thinking:

    Repetier implements 3 Buttons in Homeassistant: Pause, Continue, Stop that are implemented via the HA autodiscovery via MQTT.

    What I was thinking about is an additional button that implements/calls the shutdown function.
    I didn‘t think about repetier server doing anything else but shutting down via a mqtt command - analog to the other commands.

    Everything else can be easily managed by HA.
    That would be a simple call to an already existing function in Repetierserver.

    Hope this explains it.
  • Ok, see what you mean. shutdown is no general server function. It is implemented in extcommands.xml so you call it with @execute. If gcode via mqtt is enabled see this mqtt subject command:
    https://prgdoc.repetier-server.com/v1/docs/index.html#/en/web-api/mqtt?id=repetierserver-1cmdgcodeltsluggt-topic

    So you would send to the subject the gcode
    @execute shutdown

    and it will shut down server. In this case without sequirity question as it is not the same as the menu entry generated with extcommands.xml so you should make sure your self you are not printing.

    With that solution you can execute anything on server from a MQTT publisher.
  • I'm sorry, you lost me...
  • I already feared that. You need to understand how MQTT works and also some programming skills to implement the HA part.

    I also checked if IFTTT would work. IFTTT it self has no delay, but you can use a 3rd party service to call it with delay.  describes such a solution. Price is that they know the url to disable your plug then so you must trust them. But that way you can call this url form server and afterwards run @execute shutdown to cleanly shut down the pi. That is at least way easier then adding MQTT and program HA.
Sign In or Register to comment.