RS 1.3.0 + Home Assistant Integration Bugs?

edited February 2022 in Repetier-Server
Hello everyone.

I'm using RS 1.3.0 with an Home Assistant automation. And I maybe discovered 2 Bugs.

First, the ETA is not showing the correct time. It shows always the actual Time, not the Time when the print should be finished.

And second, my Server is running 24/7 and I only turn on or off the printer but the state of my printer is in Home Assistant always "ready" (sensor.blablabla_blabla_cond_text) or "on" (binary_sensor.blablabla_connected). Maybe these two sensors work only if the Server is shutdown?

Maybe these are no Bugs but just user mistakes?
Any suggestions?

Kind regards, Gurry.

Comments

  • ETA is a bug I already fixed for next update. The computed time remaining was converted to milliseconds so ETA is factor 1000 wrong, so nearly zero. You can fix it with own entity using this equation for value based on base state
    {{ ((value_json.time/1000)+value_json.printTime-value_json.printedTimeComp) | int | timestamp_custom(\"%d.%m.%Y %H:%M\") }}
    instead.

    Make sure time zone is set correctly in Home Assistant. Probably main reason I did not register time was zero on my tests.

    Regarding conditionText it is falsely returned Ready even if printer is offline. Will also be fixed in next release. The online variable in state/basics gets set 0 correctly, but the computation of the conditionText we added to make it easier to see human readable state did not check that case. Will also be fixed on next update.

  • Sounds good. I thought that I just did something wrong. :# thank you for your quick reply.
  • I just realized that the buttons (stop, pause, resume) doesn't work either.
  • The buttons should work, but you need to enable "Allow execution of incoming g-code" in MQTT settings, otherwise server does not accept commands via MQTT.
  • edited February 2022
    Hmm... this option was activated all the time but yesterday it wasn't working... today it was after another test.  :#

    One more question: Is it possible to integrade "Temperature Set" for Bed and Extruder?
  • You can integrate anything available in MQTT including set temperature. For temperature set there are already predefined entities. Same entity name like temperature just instead of ..._ext_temp_0 you write ..._ext_temp_set0 to see set temperature.
  • Ok, couldn't find it, I will look again tonight. Thank you.
  • Repetier said:
    You can integrate anything available in MQTT including set temperature. For temperature set there are already predefined entities. Same entity name like temperature just instead of ..._ext_temp_0 you write ..._ext_temp_set0 to see set temperature.
    I looked now and I have definitley no "temp_set" entities. Try to figure out how to add them through MQTT but to be honest I'm completley new to all this stuff and google isn't a big help.  :#
  • Easiest is to just go to visual editor with our example and copy the temperature line and add the set where they differ and save and you should see it.
  • Is it possible to send you some pictures? Maybe through Telegram or WhatsApp? Because my mainproblem is still that the entities for temp set are missing.

    ETA
    ETE
    Job
    Job Thumbnail
    Layer
    Printing
    Printing Time
    Progress
    Status
    Z
    Bed 1 temperature
    Extruder 1 temperature
    Fan 1

    These are my sensor entities I have... in total it's 17 entities with the buttons and so, but it should be at least 19 if the temp set sensors were available. 
  • You can use e.g. imgur.com or dropbox/google drive to post links to images here.

    Where are you looking for the entities?
    What does your yml definition for the view now look like?

  • edited February 2022
    Here are the pictures:

    https://i.imgur.com/Cv3JarG.jpg
    https://i.imgur.com/6XuxBVe.jpg
    https://i.imgur.com/fz4MksJ.jpg
    https://i.imgur.com/qvCtkrX.jpg

    And here the complete yml definition:

    type: vertical-stack
    title: *****
    cards:
      - type: conditional
        conditions:
          - entity: binary_sensor.********_connected
            state: 'off'
        card:
          type: markdown
          content: |
            ## Server is not running
      - type: conditional
        conditions:
          - entity: binary_sensor.********_connected
            state: 'on'
        card:
          type: custom:stack-in-card
          cards:
            - type: custom:stack-in-card
              mode: horizontal
              style: ha-card {background:none;border:0;box-shadow:none;}
              cards:
                - type: picture-entity
                  camera_view: auto
                  entity: camera.*****_camera
                  show_state: false
                  show_name: false
                  card_mod:
                    style:
                      hui-image$:
                        .: img {max-height:160px;object-fit:contain;}
                        ha-camera-stream$: img {max-height:160px;object-fit:contain;}
                      .: ha-card {background:none;border:0;box-shadow:none;}
                - type: picture-entity
                  camera_view: live
                  entity: camera.********_*****_job_thumbnail
                  show_state: false
                  show_name: false
                  card_mod:
                    style:
                      hui-image$:
                        .: img {max-height:160px;object-fit:contain;}
                        ha-camera-stream$: img {max-height:160px;object-fit:contain;}
                      .: ha-card {background:none;border:0;box-shadow:none;}
            - type: entity
              style: ha-card {background:none;border:0;box-shadow:none;}
              entity: sensor.********_*****_cond_text
              name: Status
              icon: mdi:cast-connected
            - type: glance
              style: ha-card {background:none;border:0;box-shadow:none;}
              entities:
                - entity: sensor.********_*****_ext_temp_1
                  name: Extr. Temp
                - entity: sensor.********_*****_ext_temp_set1
                  name: Extr. Temp Set
                - entity: sensor.********_*****_bed_temp_1
                  name: Bed Temp
                - entity: sensor.********_*****_bed_temp_set1
                  name: Bed Temp Set
                - entity: sensor.********_*****_fan_1
                  name: Fan
            - type: conditional
              conditions:
                - entity: binary_sensor.********_*****_printing
                  state: 'on'
              card:
                type: vertical-stack
                style: ha-card {background:none;border:0;box-shadow:none;}
                title: Running Print-Job
                cards:
                  - type: entities
                    style: |
                      ha-card {background:none;border:0;box-shadow:none;}
                    entities:
                      - entity: sensor.********_*****_job
                        name: Job
                      - type: custom:bar-card
                        height: 40px
                        entity_row: true
                        positions:
                          indicator: 'off'
                        entity: sensor.********_*****_progress
                        name: Progress
                      - entity: sensor.********_*****_eta
                        name: ETA
                      - entity: sensor.********_*****_ete
                        name: ETE
                      - entity: sensor.********_*****_print_time
                        name: Printing Time
                      - entity: sensor.********_*****_layer_progress
                        name: Layer
                      - entity: sensor.********_*****_z_progress
                        name: Z
                      - type: divider
                      - type: buttons
                        entities:
                          - entity: button.********_*****_pause
                            tap_action:
                              action: call-service
                              service: button.press
                              service_data:
                                entity_id: button.********_*****_pause
                          - entity: button.********_*****_continue
                            tap_action:
                              action: call-service
                              service: button.press
                              service_data:
                                entity_id: button.********_*****_continue
                          - entity: button.********_*****_stop
                            tap_action:
                              action: call-service
                              service: button.press
                              service_data:
                                entity_id: button.********_*****_stop
                              confirmation:
                                text: Are you sure you want to stop the print?


    Please tell me if you need something else.
  • Ok, I managed to get it running. Added the sensors in the sensor.yaml file. It was alot of try and error but now it is working. Thanks for your patience.
  • Good you got it running. I also solved it. The new json library did not exactly behave as I expected, so the set temp descriptions were missing some fields so home assistant ignored them. With next update they will also be present natively not requiring the manual definition.

    But it still good to know how to add manual entries. That way you add anything we currently do not offer or in a modified way.
  • edited February 2022
    Was quite some work but for you it has to be a lot harder getting the code done correctly. Everyone who can write codes and creating software has my respect and appreciation. 

    For everyone who want to know how to add the states:
    Go to your File editor and open the Sensor.yaml file. Add these lines to it:

    - platform: mqtt
      device_class: temperature
      unique_id: ********-****-****-****-************-*****-ext_temp_set-1
      object_id: ********_*****_ext_temp_set_1
      name: ***** Extruder 1 temperature set
      icon: mdi:printer-3d-nozzle-outline
      unit_of_measurement: °C
      state_topic: *****-7945d59a-851a-4c84-b673-b81e99328cbd/state/*****/state
      value_template: '{{ value_json.extruder[0].tempSet }}'

    - platform: mqtt
      device_class: temperature
      unique_id: ********-****-****-****-************-*****-bed_temp_set-1
      object_id: ********_*****_bed_temp_set_1
      name: ***** Bed 1 temperature set
      icon: mdi:square-outline
      unit_of_measurement: °C
      state_topic: *****-7945d59a-851a-4c84-b673-b81e99328cbd/state/*****/state
      value_template: '{{ value_json.heatedBeds[0].tempSet }}'


    You can fix the ETA bug the same way by yourself:

    - platform: mqtt
      unique_id: ********-****-****-****-************-*****-eta
      object_id: ********_*****_eta
      name: *****  ETA
      icon: mdi:clock-end
      state_topic: *****-7945d59a-851a-4c84-b673-b81e99328cbd/state/*****/basics
      value_template: '{{ ((value_json.time/1000)+value_json.printTime-value_json.printedTimeComp) | int | timestamp_custom("%d.%m.%Y %H:%M") }}'


    Replace the "*" with your ID and Printer Name and you should be good to go.

    Kind regards, Gurry.
  • Repetier said:
    Regarding conditionText it is falsely returned Ready even if printer is offline. Will also be fixed in next release. The online variable in state/basics gets set 0 correctly, but the computation of the conditionText we added to make it easier to see human readable state did not check that case. Will also be fixed on next update.

    Hi.

    I wanted to ask you if this problem is already solved? I'm on Repetier Server 1.4.9 now and still have the problem that my printer is always in the state "ready" and the connection is always "on", regardless if the printer is on or off. If it is solved, then maybe I have something wrong in my settings?

    Kind regards, Gurry. 
  • It is conditionText in basic json and when I watch it in mqtt monitor I see it change when printing starts, so it should be fixed. Sure you are accessing the right field on correct printer? You can also check yourself with mqtt monitor if it changes from server side, than you know it is in homeassistant config using other sensor definition or something like that.
  • Hi, sorry for the late reply. I think I have found the problem, but don't know how to solve it. The problem is, that Repetier Server 1.4.9 "think" my printer is still connected, even though the printer is off. Any suggestions?
  • With server still running and server shows it offline as well?
  • edited April 2023
    The server is still running and the server is the problem... the server shows it still running/online/connected.
  • If the server shows connected it is not a MQTT issue. Most likely you power the printer cpu via usb so it is still reachable and server thinks printer is on since we get responses. There is no way to know other in that case.

    Some boards have a jumper to disable that way. Alternatively you can disable 5v pin from usb cable to prevent powering vie usb, see last part of this faq entry:
    https://www.repetier-server.com/knowledgebase/undervoltage-and-throtteling-of-pi/

    After that disabling power will also show printer as disabled.
  • I will give this a try... the curious thing is, after I reboot the server it shows as disconnected... when I power on the printer then the status is connected but after I power off the printer, it shows again as still connected till I reboot the server again.
  • Ok, if I cover Pin 1 then I have no connection at all... and there is no jumper on my mainboard... The curious thing is, that I had no problems in sooner repetier versions...
  • What board du you use? The RAMBO Einsy would be a tricky one as it shows usb with usb power but cpu runs only from main power. For this combination there is a checkbox "Port is visible even if firmware is not running". Once you have spoken with it having firmware seen it will stay on until many timeouts happen. Just testing it as it might now not work on 1.4.10 with special ack option active as it prevents multiple timeouts which were used for end detection. Problem is how can we say it is a slow command and not disabled printer which is slow as well since we get no more responses.
  • Is there a possibility to uncheck this checkbox?
  • It is by default and only exists since 1.4.10. What board and server version are you using? Would be easier instead of speculating from my side. That board in question is mainly used in Prusa MK3. If you have it you must have  "Port is visible even if firmware is not running" or it will never behave. The new option that must be off to work is "Fix exceeding ok on timeout".
  • it is indeed a Prusa MK3s with an Einsy Rambo board. At the moment I'm on Server ver. 1.4.9.
  • Repetier said:
    It is by default and only exists since 1.4.10. What board and server version are you using? Would be easier instead of speculating from my side. That board in question is mainly used in Prusa MK3. If you have it you must have  "Port is visible even if firmware is not running" or it will never behave. The new option that must be off to work is "Fix exceeding ok on timeout".
    That "Port is visible even if firmware is not running" did the trick... now everything is working fine.

    Thanks for your help.

    Kind regards,
    Guido.
Sign In or Register to comment.