Adding Snapmaker to HA (need help on making UDP updatable sensors)

That would be nice, And I would be happy to be able to test the Integration and post the results (but I’m currently very limited in time so this can take some time).

My setup:

  • Snapmaker A350ENT
  • Enclosure
  • Emergency Stop button
  • 3DP: Single extrusion
  • Laser: 1600mw and 40w (incl. Air assist pump)
  • CNC (50w)
  • Rotary module
  • Quick Swap Kit

If you can point me where to obtain the .json data files for these I’ll grab them for you.

1 Like

Hi CCarpo!
Would be nice. I do not have time to fiddle around with a HA-Integration, for the moment… But I can try to support if you need some help.
Greets

Hi Mathijs

Can you give some instructions how to run the script on HA?
I’ve already tried with HACS pyscript and HASS python_script but I’m a beginner in coding…

Thanks
Raphael

Hi there, unfortunately I was planning to run the scripts via HA and prolly also’ve gone through the same steps you did (using pyscript) but I didn’t succeed on that one yet.
However this is still a To-Do on my list so as soon as I’ve figured out I’ll let you know by posting here :+1:

For now I got the.py scripts running on my NAS (Synology) which also works flawless but in the end it’s a pretty “Dumb” solution as I want to only have the second script running when the Snapmaker has a state else than IDLE.
As enabling/disabling via a webhook or ssh command isnt possible, I really need it to be run via HA.

2 Likes

It should be no problem to modify the Script that it connects only to Snapmaker if the state is something other than IDLE.
I will have a look at it if I have some spare time.

I have just created a git commit which reports the full process only if the SnapMaker is NOT in state IDLE. This means, the Touchscreen will not be locked in idle state.
Feel free to test.
Regards
Stefan

Nice, I’ll try that one next week…

With every bit it gets slightly better and better :+1:

Thnx

Hi there, thanks for all the work with the script.
I tried to use it with HA but like Raphael I stumbled over running scripts. If I run it on my PC, it wrotes the txt-file, but not in HA. I have no clue, wich writing-path I can choose and how the script gains writing-access to a directory in HA. When there is a file SMtoken.txt there are no more errors but also no more feedback. The file is also empty and on the touchscreen of the SM there is no authentication request.
Sadly I have no other option to run the script on another raspi or nas.

Maybe its get done with an integration, so I hope that ccarpo made some progress :slight_smile:

The new script works great :+1:
I got a suggestion:
It would be great if the script behaves a bit else:
IF Snapmaker state equals offline → then send only the Offline state
ELSEIF Snapmaker state equals IDLE → Then ALWAYS send Model/State/IP
ELSEIF Snapmaker state equals RUNNING → Then send ALL details

This ensures the status of the snapmaker is always as accurate as possible. And this allows us to create automations e.g. based on when the Snapmaker State changes from OFFLINE to IDLE, and from IDLE to RUNNING etc.
I’m announcing the via the smart speaker that the snapmaker started running (Trigger: IDLE to RUNNING) and change the DIMMED the lights down to color red untill the status changes from RUNNING to IDLE.
I instructed my youngest to keep away from the snapmaker as long as the lights are turned RED this is most important when running the 40W laser cutter.

Funny but dumb fact about Snapmaker:
The snapamker has a shitload of fancy features like continue the job after power-loss etc. But when simply opening the enclosure door during a Laser Job, the laser light is immediately shut off and the head is moving like the laser is active. The laser becomes active when closing the door again…results: the laser missed some cutting or engraving parts :upside_down_face:

Hi,

Great to see this thread becoming bigger, which means there’s really some animo for having Snapmaker added to HA.

I’m affraid I can’t help right now (due to time), but I can tell you that I’ve tried to run python scripts using HA, and it’s a lot hassle.

As far as i know HA runs docker on the background for some ADD-ONS and also HA supports the Docker commands.
Perhaps you can create a simple linux container and submit a cronjob to it to run the python script required for this?
Or I also saw another tut showing how to run Pythin scrips directly using docker, but then it doesnt seem to be scheduled:
How to Run a Python Script using Docker? - GeeksforGeeks

Anyway, I think this goals can be accomplished by runign some kind of container and schedule the python script there…

Didn’t do any deepdiving, so probably there’s a less hassle solution. When I found it I’ll post it in here.

But in the end all the knowledge we build in here can be of benefits of someone who decides to build some kind of Integration @ccarpo :wink:.

Running a python script for Home Assistant - the first thing I think about in this context is appdaemon.

I have refactored the python script and added a sensor template

Hi there,
first of all thanks for this great work. I found the post yesterday and must integrate this in my home assistant.
My problem was, that python_script dosn‘t allow scritps with imports. I tryed pyscript and python_script pro, but I can‘t run the script with this tools.
Now my solution:
First I load the script on my filebrowser in HA. Next I logged me in in via ssh shell. There I can install the nessesary modules and test the script. After I get the script running there I only need to integrate the shell command:

shell_command:
ex_smsatusv2: python /config/python_script/SNStatusV2.py

This create a service that I can trigger via Automations. In my case I wrote two of them. The first Automatisation runs the script every two minutes. The second switch the first on and off, triggerd by my smart socket witch power the printer on an of.
Maybe some of you helps this. I hope in future we will see an custom comonent. But I don‘t have the time to wrote it at the moment.

Hi, could someone make a set by step or video on how to add this to home assistant. since idk what I’m doing.
thanks