3d printer octoprint domoticz monitoring

Client tools or tools that can connect with Domoticz. Tools for Windows, iOS, Android, Linux etc.
borgkitty
Posts: 41
Joined: Wednesday 26 October 2016 21:01
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

3d printer octoprint domoticz monitoring

Post by borgkitty » Wednesday 02 November 2016 16:31

I was wondering if anybody has played around with the idea of monitoring their 3d printer if you have one?
If you have an rpi controlling it with octoprint you should be able to query it via the api for at the bare minimum temperatures of bed and hot end
have a look. it runs from what I gather very similar with json which I am guessing can be asked for the extracted and pushed to temp sensors

http://docs.octoprint.org/en/master/api ... tool-state

I realise that octoprint has a nice interface which I use and quite like and putting it on domoticz wouldn't be a complete replacement nor I'm I trying to replace it. I just figure since it has an api the core temps and some other variables could be ported over

I am not that good at coding so I think this will take me a long ass time to code. just wanted some feedback from more experienced coders as if you think it would be possible
nor can I find information on this as it seems no one has done this before

borgkitty
Posts: 41
Joined: Wednesday 26 October 2016 21:01
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by borgkitty » Thursday 03 November 2016 18:39

right well, I shall assume that no one has as by the lack of replies and I can't find anything on google

I shall dive into the head first and go balls deep :P
even though I can't code LUA then I shall create a walk through if I am sucessful

Fnys
Posts: 3
Joined: Thursday 14 January 2016 20:19
Target OS: Raspberry Pi
Domoticz version:
Location: Sweden
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by Fnys » Sunday 14 May 2017 17:36

Did you do anything with this? I just installed octoprint to use with my new 3d printer.. I was thinking about using a fibaro wall plug to kill the power to the printer when it's done and stuff like that..

User avatar
Varazir
Posts: 257
Joined: Friday 20 February 2015 23:23
Target OS: Raspberry Pi
Domoticz version: Beta
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by Varazir » Friday 19 May 2017 22:50

borgkitty wrote:right well, I shall assume that no one has as by the lack of replies and I can't find anything on google

I shall dive into the head first and go balls deep :P
even though I can't code LUA then I shall create a walk through if I am sucessful
I stand in line :)
1x Raspberry PI A with a RaZberry board
1x GreenWave 6 port Power node
1x tellstick
1x Qubino ZMNHOD1 ( controlling a Ikea blinder )
1x ZW075 Smart Switch Gen5
Several nexa/proove devices

Live Long and Prosper \\//_

borgkitty
Posts: 41
Joined: Wednesday 26 October 2016 21:01
Target OS: Raspberry Pi
Domoticz version: 3.5877
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by borgkitty » Wednesday 21 June 2017 18:11

lol sorry guys, not on this forum much and i do so many different projects i frequently forget about other projects i had. I would like this but havent even started it. probably wont happen till i prioritize my projects plus you need octoprint and i had it running on my 3d printer which i stopped using octoprint bc it broke and im lazy to fix it

bjacobse
Posts: 85
Joined: Tuesday 06 September 2016 9:08
Target OS: Raspberry Pi
Domoticz version:
Location: Bunkeflostrand, SE
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by bjacobse » Saturday 23 December 2017 16:31

Hi, I was searching for exact same solution and I have something working, I only need to understand if print is in progress or done, I don't mind temperature so this you need to fix yourself...

It requires octoprint + mqtt plugin. The MQTT plugin to be setup to your broker (my broker is mosquitto running on Domoticz RPI server)

Then on your domoticz server it's required:
mosquitto + node-red, setup here: http://www.domoticz.com/wiki/MQTT
also to setup a dummy text device, my idx: 224, so you need to modify idx accordingly

when node-red is working, check your server:1880
then CTRL-i and insert the below text, as this will setup your flow, my idx: 224
[EDIT 2018-01-05] as I had a minor bug and comma was shown in percentages below 10 was showing up as 5,% (if the number was 5%)

[{"id":"5d05beab.45536","type":"function","z":"5828a86.49629d8","name":"Send progress to dummy idx","func":"//Get progess 0-99\nvar progress = parseInt(msg.payload.substring(13,15));\n\n//Clear msg buffer\nmsg.payload = {};\n\n//Set dummy idx number here:\nmsg.payload.idx = 224;\nif (progress === 0){\n msg.payload.svalue = (\"On\");\n} else \nif ((progress >= 0) && (progress < 99)){\n msg.payload.svalue = (\"Print progress: \"+ progress +\"%\");\n} else \nif (progress == 99){\n msg.payload.svalue = (\"Print done\");\n} else {\n msg.payload.svalue = (\"Printer off\");\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":486.5,"y":184,"wires":[["e5923d30.e4c248","a52de4f4.5fcb1"]]}]
device.png
device.png (10.75 KiB) Viewed 3131 times
print_done.png
print_done.png (16.15 KiB) Viewed 3123 times
node-red.png
node-red.png (16.11 KiB) Viewed 3131 times
Last edited by bjacobse on Friday 05 January 2018 21:30, edited 1 time in total.

bjacobse
Posts: 85
Joined: Tuesday 06 September 2016 9:08
Target OS: Raspberry Pi
Domoticz version:
Location: Bunkeflostrand, SE
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by bjacobse » Sunday 24 December 2017 14:07

In octoprint you specify your mqtt broker ip address, I have put here xxx.xxx.xxx.xxx, no need to change anything else
octoprint_mqtt.png
octoprint_mqtt.png (98.38 KiB) Viewed 3100 times

dp106
Posts: 2
Joined: Thursday 09 March 2017 13:50
Target OS: -
Domoticz version:
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by dp106 » Thursday 04 January 2018 23:00

Hey, thanks for doing all the hard work for me! Took me a while but think I finally have this working. I wasn't really happy with the function parsing the payload as text when it was effectively a JSON string so I think doing this is better:

Code: Select all

var varPayload = JSON.parse(msg.payload);
var vartemp = varPayload.actual;
I think this allows for the payload changing in the future.

Full code from the function

Code: Select all

var varPayload = JSON.parse(msg.payload);
var vartemp = varPayload.actual;

//Clear msg buffer
msg.payload = {};

//Set dummy idx number here:
msg.payload.idx = 12;
msg.payload.nvalue=0;
msg.payload.svalue = (""+vartemp+"");
return msg;
I've also created a couple of flows for the bed and extruder temperature: I'll see if I can export them and add them to the next post

dp106
Posts: 2
Joined: Thursday 09 March 2017 13:50
Target OS: -
Domoticz version:
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by dp106 » Thursday 04 January 2018 23:03

Hopefully this is an export of the temperature flows:

[{"id":"3aea8e93.309a72","type":"mqtt in","z":"1763ab9b.39ab34","name":"Extruder Temp","topic":"octoprint/temperature/tool0","qos":"2","broker":"9ccc9e2b.1b109","x":160,"y":207,"wires":[["3ec16cec.0e06c4"]]},{"id":"83806805.370eb8","type":"mqtt out","z":"1763ab9b.39ab34","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"9ccc9e2b.1b109","x":579,"y":206,"wires":[]},{"id":"3ec16cec.0e06c4","type":"function","z":"1763ab9b.39ab34","name":"Format Message","func":"var varPayload = JSON.parse(msg.payload);\nvar vartemp = varPayload.actual;\n\n//Clear msg buffer\nmsg.payload = {};\n\n//Set dummy idx number here:\n//var newMsg = {payload: {}};\n//var newMsg = {};\nmsg.payload.idx = 12;\nmsg.payload.nvalue=0;\nmsg.payload.svalue = (\"\"+vartemp+\"\");\nreturn msg;","outputs":1,"noerr":0,"x":369,"y":206,"wires":[["83806805.370eb8","7c4f10ea.34908"]]},{"id":"7c4f10ea.34908","type":"debug","z":"1763ab9b.39ab34","name":"","active":false,"console":"false","complete":"true","x":545,"y":304,"wires":[]},{"id":"db32e719.bf2618","type":"mqtt out","z":"1763ab9b.39ab34","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"9ccc9e2b.1b109","x":580,"y":368,"wires":[]},{"id":"592e0035.0d7a7","type":"mqtt in","z":"1763ab9b.39ab34","name":"Bed Temp","topic":"octoprint/temperature/bed","qos":"2","broker":"9ccc9e2b.1b109","x":132,"y":367,"wires":[["587c7b23.5c0954"]]},{"id":"587c7b23.5c0954","type":"function","z":"1763ab9b.39ab34","name":"Format Message","func":"var varPayload = JSON.parse(msg.payload);\nvar vartemp = varPayload.actual;\n\n//Clear msg buffer\nmsg.payload = {};\n\n//Set dummy idx number here:\n//var newMsg = {payload: {}};\n//var newMsg = {};\nmsg.payload.idx = 13;\nmsg.payload.nvalue=0;\nmsg.payload.svalue = (\"\"+vartemp+\"\");\nreturn msg;","outputs":1,"noerr":0,"x":328,"y":368,"wires":[["db32e719.bf2618","c28cf0cc.7cc4d"]]},{"id":"c28cf0cc.7cc4d","type":"debug","z":"1763ab9b.39ab34","name":"","active":false,"console":"false","complete":"true","x":557,"y":459,"wires":[]},{"id":"9ccc9e2b.1b109","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]

bjacobse
Posts: 85
Joined: Tuesday 06 September 2016 9:08
Target OS: Raspberry Pi
Domoticz version:
Location: Bunkeflostrand, SE
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by bjacobse » Friday 05 January 2018 21:33

@ dp106
you are welcome, glad you could use it for your own purpose and improve it :-)
I wasn't aware that the message was a JSON string, your improvement looks quite good

bjacobse
Posts: 85
Joined: Tuesday 06 September 2016 9:08
Target OS: Raspberry Pi
Domoticz version:
Location: Bunkeflostrand, SE
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by bjacobse » Sunday 07 January 2018 21:51

And then I have created this LUA script, that will switch on a lamp when 99% done.
First create a user variable: 3D printer boolean and make this an integer
3d_printer_boolean_variable.png
3d_printer_boolean_variable.png (42.9 KiB) Viewed 2941 times
then copy this script as lua, like this:
3D_print_lua.png
3D_print_lua.png (19 KiB) Viewed 2941 times

Code: Select all

-- created by ohotbar@gmail.com 2018
commandArray = {}

-- loop through all the devices
for deviceName,deviceValue in pairs(otherdevices) do
    if ((deviceName=='3D Printer') and (uservariables["3D printer boolean"] == 0)) then
        if otherdevices_svalues['3D Printer'] == "99%" then
            --uservariables["3D printer boolean"] = 1;
            commandArray['Variable:3D printer boolean']='1'
            print ("3D Printer event fired");
            commandArray['Kitchen HK Lamp'] = "On"
        end
    end
end
if otherdevices_svalues['3D Printer'] ~= "99%" then
            --uservariables["3D printer boolean"] = 0;
            commandArray['Variable:3D printer boolean']='0'
end

return commandArray

SHadley1138
Posts: 52
Joined: Thursday 10 March 2016 15:03
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by SHadley1138 » Tuesday 30 January 2018 11:35

looks like you have octoprint working with mqtt and domoticz. im really struggling. in the mqtt settings, what are the 'Topics'? do i leave them blank, or use the defaults?

then on domoticz, ive go mqtt client installed.

im looking for a text sensor, that shows status messages from octoprint, but i can't see how i create that relationship

any help would be appreciated

matzeb74
Posts: 51
Joined: Sunday 07 January 2018 20:23
Target OS: Raspberry Pi
Domoticz version: newest
Location: Stuttgart
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by matzeb74 » Friday 23 February 2018 1:17

I Struggle here:
bjacobse wrote:
Saturday 23 December 2017 16:31

when node-red is working, check your server:1880
then CTRL-i and insert the below text, as this will setup your flow, my idx:
What exactly should i do?

bjacobse
Posts: 85
Joined: Tuesday 06 September 2016 9:08
Target OS: Raspberry Pi
Domoticz version:
Location: Bunkeflostrand, SE
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by bjacobse » Thursday 08 March 2018 15:09

matzeb74 wrote:
Friday 23 February 2018 1:17
I Struggle here:
bjacobse wrote:
Saturday 23 December 2017 16:31

when node-red is working, check your server:1880
then CTRL-i and insert the below text, as this will setup your flow, my idx:
What exactly should i do?
Sorry for my late reply - I am unsure where you need help?

Can you confirm that node-red is working? it shall be online and you can connect to it on port 1880?
https://www.domoticz.com/wiki/MQTT

did you follow this?
http://www.domoticz.com/forum/viewtopic ... nt#p162935

AimoPaukku
Posts: 31
Joined: Saturday 28 January 2017 10:35
Target OS: Raspberry Pi
Domoticz version: Stable
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by AimoPaukku » Tuesday 10 July 2018 20:54


DAVIZINHO
Posts: 205
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Spain
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by DAVIZINHO » Sunday 04 November 2018 23:05

hello.
and how it works. I see the plugin in octoprint but i dont know how to configure
:-(
Its necesary to create virtual switches? how many?

bjacobse
Posts: 85
Joined: Tuesday 06 September 2016 9:08
Target OS: Raspberry Pi
Domoticz version:
Location: Bunkeflostrand, SE
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by bjacobse » Sunday 11 November 2018 22:37

DAVIZINHO wrote:
Sunday 04 November 2018 23:05
hello.
and how it works. I see the plugin in octoprint but i dont know how to configure
:-(
Its necesary to create virtual switches? how many?
I don't use the octoprint plugin, it's not needed if you carefully follow the guide in the below link
you need to create 1 virtual switch, note it's s text switch,
viewtopic.php?f=21&t=14021&p=172263&hil ... nt#p162935

DAVIZINHO
Posts: 205
Joined: Sunday 27 August 2017 18:00
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Spain
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by DAVIZINHO » Monday 12 November 2018 13:24

bjacobse wrote:
Sunday 11 November 2018 22:37
DAVIZINHO wrote:
Sunday 04 November 2018 23:05
hello.
and how it works. I see the plugin in octoprint but i dont know how to configure
:-(
Its necesary to create virtual switches? how many?
I don't use the octoprint plugin, it's not needed if you carefully follow the guide in the below link
you need to create 1 virtual switch, note it's s text switch,
viewtopic.php?f=21&t=14021&p=172263&hil ... nt#p162935
i dont use MQQT in domoticz, maybe this will be the moment to configure it.
I think with the octoprint plugin it will work :-(

User avatar
emme
Posts: 954
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by emme » Monday 12 November 2018 13:33

I either did not use MQTT.....
now I cannot live without!
The most dangerous phrase in any language is:
"We always done this way"

bjacobse
Posts: 85
Joined: Tuesday 06 September 2016 9:08
Target OS: Raspberry Pi
Domoticz version:
Location: Bunkeflostrand, SE
Contact:

Re: 3d printer octoprint domoticz monitoring

Post by bjacobse » Monday 12 November 2018 22:40

I can only recommend MQTT, I also use it for my ESP8266 Heatpump IR controller, that also reports temperature
and if you gets MQTT to be working, then it's fairly easy to use my guide to get Octoprint print percentage to Domoticz

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest