I’m trying to experiment with this idea. Can you let me know the command to send to requests? Say for if I uploaded example.gcode to the root of the default FTP directory it lands you in when you connect?
While it’s intended mostly for the pre-packaged gcode files (unload, load, calibration etc), here is the format:
{
"print": {
"sequence_id": "0",
"command": "gcode_file",
"param": "/filename.gcode" // Filename on the printer's filesystem to print
}
}
Could be useful if you want to run say a specific routine or something as well.
I will say it’s likely a much better idea to print directly using the 3mf file instead if not doing some basic routine.
{
"print": {
"sequence_id": "0",
"command": "project_file",
"param": "Metadata/plate_X.gcode", // X being a number, this represents which plate in a 3mf file to print
"project_id": "0", // Always 0 for local prints
"profile_id": "0", // Always 0 for local prints
"task_id": "0", // Always 0 for local prints
"subtask_id": "0", // Always 0 for local prints
"subtask_name": "",
"file": "", // Filename to print, not needed when "url" is specified with filepath
"url": "file:///mnt/sdcard", // URL to print. Root path, protocol can vary. E.g., if sd card, "ftp:///myfile.3mf", "ftp:///cache/myotherfile.3mf"
"md5": "",
"timelapse": true,
"bed_type": "auto", // Always "auto" for local prints
"bed_levelling": true,
"flow_cali": true,
"vibration_cali": true,
"layer_inspect": true,
"ams_mapping": "",
"use_ams": false
}
}
Note: This project-file printing payload for 3mf files is actually from a slightly older firmware, now there is also an ams_mapping array/field which should let you map AMS trays to filament orders in a print. Without it, it will do it in order it exists is use_ams is true. I haven’t figured out the ams_mapping part yet as I haven’t had the time for it, nor the need yet.
If you want to see current, I’d suggest listening in to the “request” topic and then starting a print from the slicer to the printer. It should trigger the message and if you log it, you can figure it out from there
Hey boss, any ideas why the filament colors aren’t showing up? I have one, but not the others so I know the icon is loading correctly. The other slots do show the correct color in the attributes.
You’re missing the custom icon svg, unless you’ve modified the yamls to use the mdi:3d-printer icon (which might be the case otherwise that fourth one wouldn’t be showing up like that), in that case double check you modified it everywhere and not just for the one tray.
I’m using the template as is from your generator and have made sure the custom icon is in the right spot. I have restarted HA with no change.
YAML
type: picture-elements
view_layout:
column: 1
elements:
- type: custom:config-template-card
entities:
- sensor.ams_0_rightprinter_tray_0
element:
type: state-icon
entity: sensor.ams_0_rightprinter_tray_0
icon: >-
${states['sensor.ams_0_rightprinter_tray_0'].state != 'Empty' ?
'fapro:filament-1' : 'mdi:tray' }
style:
top: 28%
left: 21.4%
'--paper-item-icon-color': var(--tray_0_color)
background-color: rgba(0,0,0,0.5)
box-shadow: 0 0 5px 5px var(--tray_0_bg)
border-radius: 50px
'--mdc-icon-size': 2.4em
- type: state-label
entity: sensor.ams_0_rightprinter_tray_0
attribute: type
tap_action:
action: none
style:
top: 77%
left: 21%
text-align: center
font-size: 1em
background-color: rgba(0,0,0,0.4)
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: custom:config-template-card
entities:
- sensor.ams_0_rightprinter_tray_1
element:
type: state-icon
entity: sensor.ams_0_rightprinter_tray_1
icon: >-
${states['sensor.ams_0_rightprinter_tray_1'].state != 'Empty' ?
'fapro:filament-1' : 'mdi:tray' }
style:
top: 28%
left: 39.7%
'--paper-item-icon-color': var(--tray_1_color)
background-color: rgba(0,0,0,0.5)
box-shadow: 0 0 5px 5px var(--tray_1_bg)
border-radius: 50px
'--mdc-icon-size': 2.4em
- type: state-label
entity: sensor.ams_0_rightprinter_tray_1
attribute: type
tap_action:
action: none
style:
top: 77%
left: 40%
text-align: center
font-size: 1em
background-color: rgba(0,0,0,0.4)
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: custom:config-template-card
entities:
- sensor.ams_0_rightprinter_tray_2
element:
type: state-icon
entity: sensor.ams_0_rightprinter_tray_2
icon: >-
${states['sensor.ams_0_rightprinter_tray_2'].state != 'Empty' ?
'fapro:filament-1' : 'mdi:tray' }
style:
top: 28%
left: 59.7%
'--paper-item-icon-color': var(--tray_2_color)
background-color: rgba(0,0,0,0.5)
box-shadow: 0 0 5px 5px var(--tray_2_bg)
border-radius: 50px
'--mdc-icon-size': 2.4em
- type: state-label
entity: sensor.ams_0_rightprinter_tray_2
attribute: type
tap_action:
action: none
style:
top: 77%
left: 60%
text-align: center
font-size: 1em
background-color: rgba(0,0,0,0.4)
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: custom:config-template-card
entities:
- sensor.ams_0_rightprinter_tray_3
element:
type: state-icon
entity: sensor.ams_0_rightprinter_tray_3
icon: >-
${states['sensor.ams_0_rightprinter_tray_3'].state != 'Empty' ?
'fapro:filament'-1 : 'mdi:tray' }
style:
top: 28%
left: 79.6%
'--paper-item-icon-color': var(--tray_3_color)
background-color: rgba(0,0,0,0.5)
box-shadow: 0 0 5px 5px var(--tray_3_bg)
border-radius: 50px
'--mdc-icon-size': 2.4em
- type: state-label
entity: sensor.ams_0_rightprinter_tray_3
attribute: type
tap_action:
action: none
style:
top: 77%
left: 79.6%
text-align: center
font-size: 1em
background-color: rgba(0,0,0,0.4)
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: conditional
conditions:
- entity: sensor.x1c_rightprinter_print_status
state_not: OFFLINE
elements:
- entity: sensor.ams_0_rightprinter_temp
type: state-badge
style:
top: 18%
left: 8%
font-size: 0.75em
color: rgba(0,0,0,0)
- entity: sensor.ams_humidity_sensor_humidity
type: state-badge
style:
top: 27%
left: 92.5%
font-size: 0.75em
color: rgba(0,0,0,0)
- entity: sensor.ams_humidity_sensor_temperature
type: state-badge
style:
top: 27%
left: 84%
font-size: 0.75em
color: rgba(0,0,0,0)
- entity: sensor.moes_humidity_sensor_temperature
type: state-badge
style:
top: 99%
left: 84%
font-size: 0.75em
color: rgba(0,0,0,0)
- entity: sensor.moes_humidity_sensor_humidity
type: state-badge
style:
top: 99%
left: 92.5%
font-size: 0.75em
color: rgba(0,0,0,0)
'--label-badge-red': '#2F9AC5'
image: /local/media/AMS_2.png
style: |
ha-card {
background: none !important;
border: none !important;
box-shadow: none !important;
--tray_0_color: {{state_attr('sensor.ams_0_rightprinter_tray_0', 'color') }};
--tray_1_color: {{state_attr('sensor.ams_0_rightprinter_tray_1', 'color') }};
--tray_2_color: {{state_attr('sensor.ams_0_rightprinter_tray_2', 'color') }};
--tray_3_color: {{state_attr('sensor.ams_0_rightprinter_tray_3', 'color') }};
--tray_0_bg: {% if is_state_attr('sensor.ams_0_rightprinter_tray_0', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
--tray_1_bg: {% if is_state_attr('sensor.ams_0_rightprinter_tray_1', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
--tray_2_bg: {% if is_state_attr('sensor.ams_0_rightprinter_tray_2', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
--tray_3_bg: {% if is_state_attr('sensor.ams_0_rightprinter_tray_3', 'in_use', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
}
EDIT: Figured it out. Apparently I never added the integration for font awesome after installing it through HACS. Did that and a reboot and they’re showing now.
Hi all,
I’ve started trying to setup the integration for my X1C. I have the Node Red components working and returning data. I’ve tried to follow the install guide for the dashboard with partial success - some of the custom Lovelace components were problematic to install.
This is what I’m getting so far. Any ideas as to how I can troubleshoot this further please?
Apart from the missing sensor data, the AMS spool status isn’t right either (this job is printing with one spool of black PLA in bay 2 and bay 1 also has green PLA loaded, but not used and bay 4 has support filament loaded, but not currently used)
Grateful for any help, thanks.
Do the entities throwing the error exist? Are the names correct?
Are you using the HACS integration or the NodeRed flow? I ask because some of those have different icons than they should, and it’s a lowercase “Running” instead of the uppercase value (RUNNING), which is a difference between the HACS integration and my nodered flow. They aren’t meant to be used together, and my dashboard yaml requires some significant edits to be useable by the HACS integrations. Another reason I think this is the AMS, in my nodered flow it’s 0 indexed, but with the HACS integration it may be 1 indexed, hence they appear broken.
But as @FriedCheese said, I would think this is because of incorrect entity naming across the whole yaml. If you want to reuse the yaml but with the HACS device entities, you’ll have to manually edit each - some of which aren’t available and not applicable.
EDIT: If you are using the NodeRed flow, make sure when you generated the yaml you used the device/entity names that are provided from the MQTT integration in HA. Not ones generated from the HA-Bambulab HACS integration.
Thanks chaps. I think I’d ended up with some sort of hybrid monster of the Node-Red and the HACS version of the integration. I’ve cleared out the HACS stuff and recreated the code for the map, just using the NR, and everything is looking good now. Many thank, and awesome work on this integration!
@WolfwithSword : You may remember that I have updated to the latest version of your Node Red integration. With the latest version I have the problem that most values are updated every 5 minutes. I use the printer status to turn off the chamber light during flow calibration and then turn it on again. With the delay, it no longer makes sense. I made a change in the configuration from 5 minutes to 30 seconds. This works so far, but now the coil colours are mostly white and only change to the real colours for a short time. Is there a way to switch to the “old” behaviour (always current values) or does this have a different consequence?
If you’re on beta firmware, it’s because now the messages come like the P1P, in short messages and not full reports. I recommend changing the timer back to 5 minutes for the “full” report, and recommend for adjusting the light during flow calibration, to instead base it off layer.
The reason is, the stage sensor seems to not always send with the P1P-like messages, and I have no clue why. However, layer info seems to be very reliable. So a good automation would be like this:
When Printer Status is RUNNING and Layer = 0, turn light off. When layer changes from 0 to anything else, turn light on. Layer 0 and print of RUNNING will always be the startup procedure, and it will switch to layer 1 as soon as it starts printing the actual print.
I know a few others on the beta firmware who have confirmed the layer 0 approach is very reliable, but the print stage one specifically for figuring out lighting-based automations from calibration is not reliable.
@WolfwithSword I am back to 5 minutes but I have still the problem that the filament colors changing periodicly to white for more then 2 minutes. See picture below. Same for ‘sensor.x1c_nozzle_soll’ … it switchs periodicly from e.g 220°C to unkown. Why this is happening and can I solve it?
Maybe I am playing with the wron value … I used this one … is this the right one?
All the Reset Timer Interval does is every 5 minutes, forces the printer to publish a full message of all sensors, as well as force the nodered filter to reset such that values will be forcefully pushed into the MQTT.
When you click on one of the AMS colours, does it still have values in the attributes when it is all white? It would be nice to see a screenshot of that if possible.
As for the unknown part, I’m not sure. You mention bed temp though but give a 220 which would be the nozzle temp, are you saying the nozzle temp is reporting as the bed temp and also going unknown?
My fault with bett and nozzle … (copy and paste) It should be ‘sensor.x1c_nozzle_soll’
Clor of first tray should be #0086D6FF … when it is white it shows 0086D6FF (without the # in front)
Weird, must be that sometimes an AMS tray message comes in a bit weird. Rather than figure out what’s different, probably much easier to just enforce a check on the color before it goes to mqtt to prefix with a #
In “AMS State” node, find the following if condition
if (msg.topic.match(/tray_\d+/)) {
var oldTopic = msg.topic;
msg.topic = "homeassistant/sensor/" + msg.machine_name + "/" + msg.topic + "/attr";
node.send(msg);
msg.topic = oldTopic;
msg.payload = msg.payload.type;
}
and change it to the following:
if (msg.topic.match(/tray_\d+/)) {
var oldTopic = msg.topic;
if(msg.payload.color != undefined // new
&& !msg.payload.color.startsWith("#")) { // new
msg.payload.color = "#" + msg.payload.color; // new
} // new
msg.topic = "homeassistant/sensor/" + msg.machine_name + "/" + msg.topic + "/attr";
node.send(msg);
msg.topic = oldTopic;
msg.payload = msg.payload.type;
}
I’ll put this in my WIP nodes for a future update when the firmware releases, but for now you can modify that there. It should fix it, by always checking that color starts with a # and if not, will force it to, for each AMS tray.
PS: What HA theme is that which makes the modal popup semi transparent? Looks nice!
I guess I did something wrong … now I get an error warning
// Filter UoM from payload
if (msg.topic == “wifi_signal”)
msg.payload = msg.payload.match(/^-?\d+/)[0];
if (msg.topic.match(/tray_\d+/)) {
var oldTopic = msg.topic;
if (msg.payload.color != undefined // new
&& !msg.payload.color.startsWith("#")) { // new
msg.payload.color = "#" + msg.payload.color; // new
} // new
msg.topic = root_topic + "/sensor/" + msg.machine_name + "/" + msg.topic + "/attr";
node.send(msg);
msg.topic = oldTopic;
msg.payload = msg.payload.type;
}
msg.topic = “homeassistant/sensor/” + msg.machine_name + “/” + msg.topic + “/state”;
node.send(msg);
Oh no that’s my bad, I forgot I did some reorganizing and created “root_topic”.
either replace root_topic with “homeassistant” or set it equal to it at the top for now.
@WolfwithSword … Sorry I am not such an expert like you. What exactly shall I do?
is this what you meant?
But still same error worning:
// Filter UoM from payload
if (msg.topic == “wifi_signal”)
msg.payload = msg.payload.match(/^-?\d+/)[0];
if (msg.topic.match(/tray_\d+/)) {
var oldTopic = msg.topic;
if (msg.payload.color != undefined // new
&& !msg.payload.color.startsWith("#")) { // new
msg.payload.color = "#" + msg.payload.color; // new
} // new
msg.topic = “homeassistant/sensor/" + msg.machine_name + "/" + msg.topic + "/attr";
node.send(msg);
msg.topic = oldTopic;
msg.payload = msg.payload.type;
}
msg.topic = “homeassistant/sensor/” + msg.machine_name + “/” + msg.topic + “/state”;
node.send(msg);
Ah, text formatting. When you copied it over it is using different double-quotes. If you replace the double quotes with proper ones then it should be fine.
Thanks a lot … error is now gone