Did you know that it’s possible to discover your Snapmaker 2.0 in your LAN? Just send an UDP discover Broadcast to Port 20054 and your Snapmaker will reply with his IP-Address, Model-Name and Status.
Update 19.01.2024: This project got some reactions, see here: HomeAssistant-Forum and here: Snapmaker-Forum
Meanwhile I created a new Script V2 which gets more Information from the Web-API, this makes the information below obsolete.
-> See new code on github
Maybe I will try to write a HomeAssistant Integration someday….
With this function, I inform my Home Assistant about the state of my Snapmaker. Home Assistant sends me a push-message if the 3D-Print, Laser-Cut or CNC is finished.
Because I only need this information, it’s not necessary to login, get info and logout to the Snapmaker.
Maybe I will write another script in future to read other values like process, temperatures, enclosure state etc.
Here is an example of my webhook-sensors in templates.yaml: (For more details see this Link)
# Snapmaker JSON Webhook
- trigger:
- platform: webhook
webhook_id: wh-snapmakera350
allowed_methods:
- POST
- PUT
local_only: true
sensor:
- name: "Snapmaker State"
state: "{{ trigger.json.state }}"
- name: "Snapmaker IP"
state: "{{ trigger.json.ip }}"
- name: "Snapmaker Model"
state: "{{ trigger.json.model }}"
Then download the code on github and edit the python-script to your needs.
Run it in a cronjob, I do that on a separate raspberry-pi for example every 5min.
To notify me, this is my automation:
alias: Snapmaker Notify Finish
description: Notify finished printjob
trigger:
- platform: state
entity_id:
- sensor.snapmaker_state
from: RUNNING
to: IDLE
condition: []
action:
- service: notify.notify_me
data:
title: Snapmaker
message: Snapmaker finished!
mode: single
That’s my quick and dirty solution.
Some printscreens of the HA-Dashboard:
I hope this will help you to get at least some information from your Snapmaker to Home Assistant. I still hope that we can get more information in future from an usable Snapmaker-API đ