Home Assistant component for Mosaic Palette and Canvas Hub Octoprint plug-ins

I'm looking at ways to integrate data from Palette into Home Assistant. Values that would be relevant to my use cases include (by order of importance):

  • Ping - Pong. This is the most important as it allows not only to monitor proper operation of Palette, but also of the entire system including the 3D printer itself. A use case could be, slow down print speed / feed rate when ping <98%. This is particularly relevant to me as a Prusa Mk3s user as this machine suffers from heat creep due to the extruder stepper motor overheating and a faulty heatbreak design. Pausing the print for a set time to let the motor cool down could be another way to achieve this. This could be implemented as a sensor.
  • Splices. I tend to slow my printing speed down in order not to run into "Buffer Collapse" Error 120. The plug-in's advance feature helps buckets with this. I set the Splicing Speed Rate at 75% for most prints. Normal Feed Rate is set anywhere between 80% and 150% depending on the model's geometry. Once all splices are completed, I could run at up to 200% reducing print times for some models. This could be implemented as a sensor.
  • Feed Rate Status. To know if a splice is currently happening. This could be implemented as a binary sensor.
  • Filament Used. Just a nice thing to know / record when printing the same model over and over. Helps with provisioning materials needed for production of future prints. This could be implemented as a sensor.
  • Connection Status. This could be implemented as a sensor / binary sensor or even a switch to connect when disconnected
  • Status: This could be implemented as a sensor. Similar to number of splices. May not be needed.
    These data Pull Requests could be done via Octoprint Shell Commands to start with, but long term this could become an actual component for Home Assistant for other users to use along with the Octoprint component. Shell Command is the solution I rely on to add functionality to the existing Octoprint component for Home Assistant. Here is one such example that I use for a script / switch to decrease feed rate to 80%:
    '''
    shell_command:
    prusa_speed_80pc: "curl -s http://192.168.XX.XX/api/printer/command -d '{"command":"M220 S80"}' -H 'Content-Type: application/json' -H 'X-Api-Key: XXXXXXXXXXXXXXXXXX'"
    script:
    prusa_speed_80pc:
    alias: Prusa 80%
    sequence:
    • delay:
      milliseconds: 1
    • service: shell_command.prusa_speed_80pc
      '''
      I looked at the terminal window from Octoprint / Canvas Hub, but cannot find relevant data. Some pointers could be very helpful here... I think my skills are not sufficient to get this data pulled into Home Assistant. Maybe some more skilled programmers can chime in?

It sounds like you're looking for someone who has both a Home Assistant AND a Mosaic Pallette. I'm guessing this cuts the field by a fair bit.

Searching the OctoPrint plugin list I don't see anything that covers Palette directly. The only one that has any support whatsoever appears to be OctoPod. This puts gdombiak in the race for plugin authors with a Mosaic Palette.

Some of the plugins in the MQTT space may support Home Assistant but I wouldn't know.

The Mosaic support forum itself might be another place to look for this. Presumably they provide a plugin for their product but it doesn't appear on the OctoPrint published list.

1 Like

The plugin isn't posted but it is available via their gitlab and linked from their website.

Me too. I have a palette and quite a bit of MQTT knowledge through developing my other plugins, and being one of the MQTT plugin maintainers. I just haven't had the time to look into their gitlab repositories to see how they are communicating with the device itself.If I can figure that out I don't foresee it being difficult at all to publish that to an MQTT topic.

1 Like

I sometimes wish I had one of those Palettes but there are times when the makers of that apppear to be a little overwhelmed with the support burden, to be honest.

Honestly, the guys from Mosaic are good. Been using their Palettes 2s for 3 weeks. I placed a feature request for their Palette plug after a week (200% feed rate and feed rate change from beginning of print). They updated their plug-in with these features in less than a week.
My request for Home Assistant integration seems to go beyond the scope of what they're prioritising right now. I can understand that.

All in all, the product experience has been fantastic. Worked straight out of the box and yielded very few failed prints... It is an expensive kit at 500USD compared to the 300USD PRUSA MMU2S. The latter is sitting in a drawer as it does not work. The former is printing. The workmanship, quality of integration and software alone would justify the price...

Now, you can get refurbished units or older models on Mosaic's webshop. This could be a nice way in!

Link for plug-in: https://www.google.com/url?sa=t&source=web&rct=j&url=https://gitlab.com/mosaic-mfg/palette-2-plugin&ved=2ahUKEwjTyt6O_cDnAhUGeysKHSurDacQFjAAegQIBhAB&usg=AOvVaw3zrWf_tkD9sUCYqT2QQP3Z

Ya, Home Assistant or any automation system really. Pulling data, via MQTT, or any other method would work!

I agree, they do seem to try with their support, but after much trying I kept having issues with jams. Not sure if I got a bad batch of splice core tubes or something, but it kept bulging/fusing with the filament and would end up having to take it apart to clear. I ended up letting it sit for some time until they released the "s" upgrade kit and once installed have gone through a few prints without issues. I guess being an earlier adopter has it's gotchas. Seems the new splicing core updates have improved the situation.

I just wished they would figure out firmware updates via either the firmware update plugin or within their own plugin, because that part is a pain to deal with for me. Would be a lot easier to just select a hex file the way I do to upgrade my printer.

1 Like

No experience with firmware updates yet... apart from the first time when I opened the box. Plugged my computer, used their proprietary software and that was that!

Am using a Palette 2S Pro and it's been a great user experience.

Yeah, that's the rub. I don't have my printer close to my machine. I have to unplug my laptop from power, and all the other random stuff plugged in and take it to the printer to upgrade or unload all the filament, disconnect from my printer and more the palette back to my work area. It's just an inconvenience.

1 Like

Just noticed on their release notes that there were api commands added for OctoPod for getting ping history. With Home Assitant you can do API calls if I'm not mistaken. You may want to look into that downloadPingHistory and getPingHistory commands.

Edit: Quick test and it does seem to respond, but because I'm not printing there's a lot of empty stuff I suspect.

The API seems to have a bunch of other stuff you can do, and what I assume is being used to control the palette from their plugin interface.

    def get_api_commands(self):
        return dict(
            clearPalette2=[],
            connectOmega=["port"],
            disconnectPalette2=[],
            sendCutCmd=[],
            uiUpdate=[],
            changeAlertSettings=["condition"],
            displayPorts=["condition"],
            sendErrorReport=["errorNumber", "description"],
            startPrint=[],
            changeAutoVariationCancelPing=["condition"],
            changeVariationPct=["value"],
            changeVariationPingStart=["value"],
            changeShowPingOnPrinter=["condition"],
            changeFeedRateControl=["condition"],
            changeFeedRateSlowed=["condition"],
            changeFeedRateNormalPct=["value"],
            changeFeedRateSlowPct=["value"],
            startAutoLoad=[],
            downloadPingHistory=[],
            getPingHistory=[],
            changeAutoStartAfterLoad=["condition"]
        )
1 Like

That's great dude. Thanks for forwarding this. I looked quickly at the GitLab, but did not even get that far.

Yes, Home Assistant can do API calls easily. This could be the way!

Pings are in there and so are the feed rates. Can't find anything relating to splices though... Will have a proper look when work is over.

@jneilliii
Trying my best (ie not much) to get to the bottom of this. I can access the printer's API calls like this:

  - platform: rest
    resource: 'http://X.X.X.X/api/job'
    name: "STL file"
    value_template: '{{ value_json.job.file.name }}'
    headers:
      X-Api-Key: XXX

I tried to emulate this inspired by your post:

  - platform: rest
    resource: 'http://X.X.X.X/api/plugin/palette2'
    name: "Palette2"
    method: POST
    payload: '{ "changeFeedRateSlowed" }'
    headers:
      X-Api-Key: XXX

This results in an error due to size exceeding 255 characters (limitation of Home Assistant). I need to break this down into different attributes.
Is there a way to see all the JSON attributes as I would for http://X.X.X.X/api/job? This yields:

{
  "job": {
    "averagePrintTime": 78057.953208101, 
    "estimatedPrintTime": 81414.84215168528, 
    "filament": {
      "tool0": {
        "length": 157101.32940980978, 
        "volume": 377.8729802313965
      }
    }, 
    "file": {
      "date": 1581240663, 
      "display": "Solar System Scale New.mcf.gcode", 
      "name": "Solar_System_Scale_New.mcf.gcode", 
      "origin": "local", 
      "path": "Solar_System_Scale_New.mcf.gcode", 
      "size": 27556894
    }, 
    "lastPrintTime": 78057.953208101, 
    "user": null
  }, 
  "progress": {
    "completion": 36.105959546819754, 
    "filepos": 9949681, 
    "printTime": 27298, 
    "printTimeLeft": 48873, 
    "printTimeLeftOrigin": "mixed-average"
  }, 
  "state": "Printing"
}

This can easily be broken down into attributes via Home Assistant...

Is it just me or is this advertised-but-not-implemented in the plugin? Wouldn't it show up around line 129 if it were? See, there's no changeFeedRateSlowed() here.

1 Like

I think it's because it should be changeFeedRateSlowPct.

You see what I'm saying, though? Their plugin advertises a new endpoint that they forgot to implement in this commit.

Oh yeah, I see now. It's being defined in the get_api function, but not in the on_api function. Just created issue on their repo.

2 Likes

Thanks a lot for chiming in. I'll liaise with the support guys from Mosaic to try to get them moving on this. Should really upgrade my request from focusing on Home Assistant to any Octoprint plugin really. The fact that they accepted merge requests by @gdombi shows they've got some kind of interest in supporting third party plugins. An Android compatible remote app with Palette support could be useful to me...

Anyways, I tried with a bunch of other endpoint and either got a 255 character error or it returned an unknown status.

sensor:
  - platform: rest
    resource: 'http://X.X.X.X/api/plugin/palette2'
    name: "Palette"
    method: POST
    payload: '{ "downloadPingHistory" }'
    headers:
      X-Api-Key: XXX
      Content-Type: application/json
  - platform: rest
    resource: 'http://X.X.X.X/api/plugin/palette2'
    name: "Palette2"
    method: POST
    payload: '{ "changeFeedRateSlowed" }'
    headers:
      X-Api-Key: XXX
      Content-Type: application/json
      dataType: json
  - platform: rest
    resource: 'http://X.X.X.X/api/plugin/palette2'
    name: "Palette3"
    method: POST
    value_template: '{{ value_json.changeFeedRateSlowPct }}'
    headers:
      X-Api-Key: XXX
      Content-Type: application/json
      dataType: json
  - platform: rest
    resource: 'http://X.X.X.X/api/plugin/palette2'
    name: "Palette4"
    value_template: '{{ value_json.changeShowPingOnPrinter }}'
    json_attributes:
      - getPingHistory
      - changeFeedRateSlowed
      - changeFeedRateSlowPct
    headers:
      X-Api-Key: XXX
  - platform: rest
    resource: 'http://X.X.X.X/api/plugin/palette2'
    name: "Palette5"
    method: POST
    payload: '{ "getPingHistory" }'
    headers:
      X-Api-Key: XXX
      Content-Type: application/json
      dataType: json
 - platform: rest
   resource: 'http://X.X.X.X/api/plugin/palette2'
   name: "Palette6"
   method: POST
   payload: '{ "downloadPingHistory" }'
   headers:
      X-Api-Key: XXX
      Content-Type: application/json
      dataType: json

Wish I could see a list of json from the plugin... Using curl commands, I either get "forbidden"or "unknown". @jneilliii what command did you use to get the results from post #11?

It's at the top of that screenshot, using jquery"s ajax call. Because I was running it in browser's developer console logged in to octoprint, didn't have to worry about the api key.

Sorry to be a pain, total noob here... But, what command did you use for that request. Checked again in screenshot, but can't find the command used...