(Gelöst) BambuLab X1c und MQTT

Begonnen von paul79, 30 März 2023, 21:39:32

Vorheriges Thema - Nächstes Thema

paul79

Hallo,

ich möchte gern meinen BambuLab X1c 3d Drucker mit MQTT abfragen leider bekomme ich keine Verbindung mit MQTT2_CLIENT hin.

meine Device sieht so aus:

nternals:
  BUF       
  Clients    :MQTT2_DEVICE:MQTT_GENERIC_BRIDGE:
  ClientsKeepOrder 1
  DEF        192.168.16.43:8883
  DeviceName 192.168.16.43:8883
  FUUID      6425a908-f33f-c290-1a01-0f7fab11cb39cf27
  NAME      BambuLab
  NEXT_OPEN  1680200568.46674
  NR        1096
  PARTIAL   
  SSL        1
  STATE      disconnected
  TYPE      MQTT2_CLIENT
  WBCallback
  clientId  bblp
  connecting 1
  eventCount 3869
  lastMsgTime 1680200421.28537
  nextOpenDelay 5
  nrConnects 357769
  qosCnt    0
  wantRead  1
  MatchList:
    1:MQTT2_DEVICE ^.
    2:MQTT_GENERIC_BRIDGE ^.
  READINGS:
    2023-03-30 20:22:43  state          disconnected
  hmccu:
Attributes:
  SSL        1
  autocreate simple
  clientId  bblp
  mqttVersion 3.1.1
  qosMaxQueueLength 0
  room      Hardware
  subscriptions device/00x00xxx0xxxxx0
  username  bblp
  verbose    3

Mit dem MQTT Explorer bekomme ich eine Verbindung hin. siehe Anhang

Mehr Infos gibt es einmal hier:

https://forum.iobroker.net/topic/61585/bambu-lab-3d-drucker-mqtt-integration/9

und hier https://wiki.bambulab.com/en/x1/manual/X1-X1C-AMS-firmware-release-history

BambuLab hat erst vor kurzem MQTT auf TLS 1.2 umgestellt, vielleicht ist ein Hinweis.

Zitata. In "LAN only" mode, TLS v1.2 is enabled in MQTT which is used for the direct connection between the printer and Bambu Studio. This improves LAN printer control security.

Über eine Lösung wäre ich sehr glücklich.

Gruß Paul


FHEM5.7 auf Pi3
Busware CUL433 (IT), JeeLink Lacrosse, HM-MOD-RPI-PCB, HM, TabletUI

rudolfkoenig

TLS 1.2 ist in einer halbwegs aktuellen Distribution (bzw. openssl Bibliothek) vorhanden, und MQTT2_CLIENT sollte es deswegen automatisch verwenden.

Steht was Auswertbares im FHEM-Log oder im Log des MQTT-Servers?

paul79

Hallo,

an den MQTT-Server selbst komme ich nicht ran, ist in der Firmware von Drucker.

Ein oder zweimal hat Fhem Daten wohl empfangen und es ein MQTT2_DEVICE angelegt.

2023.03.31 19:50:50 5: BambuLab: sending CONNECT (16)!(0)(4)MQTT(4)(194)(0)(30)(0)(5)fhem2(0)(4)bblp(0)(8)1601f7f6
2023.03.31 19:50:50 5: DevIo_SimpleWrite BambuLab: 102100044d51545404c2001e00056668656d32000462626c7000083136303166376636
2023.03.31 19:50:50 5: BambuLab: received SUBACK (0)L(0)
2023.03.31 19:50:50 5: BambuLab: sending SUBSCRIBE (130)(6)(0)L(0)(1)#(0)
2023.03.31 19:50:50 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:50:50 1: BambuLab: Can't connect to 192.168.16.43:8883: connect to https://192.168.16.43:8883 timed out
2023.03.31 19:50:50 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:50:50 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:50:50 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:50:50 1: BambuLab: Can't connect to 192.168.16.43:8883: connect to https://192.168.16.43:8883 timed out
2023.03.31 19:50:50 1: 192.168.16.43:8883 disconnected, waiting to reappear (BambuLab)
2023.03.31 19:50:50 5: HttpUtils url=https://192.168.16.43:8883/ NonBlocking via https
2023.03.31 19:50:50 4: IP: 192.168.16.43 -> 192.168.16.43

dann kam noch viel dieses

2023.03.31 19:47:56 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:56 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:56 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:56 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:56 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:57 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:57 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:57 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:57 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:57 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:57 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:57 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:57 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:57 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:57 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:57 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:47:57 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory

und das noch

2023.03.31 19:36:58 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:36:58 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:36:58 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:36:58 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:36:58 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:36:59 1: BambuLab: Can't connect to 192.168.16.43:8883: No such file or directory
2023.03.31 19:36:59 1: BambuLab: Can't connect to 192.168.16.43:8883: start_SSL https://192.168.16.43:8883 timed out
2023.03.31 19:37:46 1: 192.168.16.43:8883 disconnected, waiting to reappear (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:39:44 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:40:14 2: BambuLab: No CONNACK, disconnecting
2023.03.31 19:40:14 1: 192.168.16.43:8883 disconnected, waiting to reappear (BambuLab)
2023.03.31 19:47:54 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 1: 192.168.16.43:8883 reappeared (BambuLab)
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883
2023.03.31 19:47:54 3: Opening BambuLab device 192.168.16.43:8883

Mit dem MQTT Explorer empfange ich Daten ohne Aussetzer oder werden disconnected.

Gruß Paul
FHEM5.7 auf Pi3
Busware CUL433 (IT), JeeLink Lacrosse, HM-MOD-RPI-PCB, HM, TabletUI

paul79

Hallo,

ich habe jetzt einen ein anderes Programm gefunden MQTTX was auch wunderbar funktioniert und wo ich eine Log vom dem Verbindungsaufbau habe.

Dabei ist mir aufgefallen MQTTX zu mqtts:// als Protokoll wählt und FHEM https://

Connect client BambuLab, MQTT/SSL connection: mqtts://192.168.16.43:8883

[2023-04-01 09:38:01] [INFO] APP init
[2023-04-01 09:40:07] [INFO] First time created, Name: BambuLab, ID: 5026bb96-9655-4676-9a9a-306ae007337e
[2023-04-01 09:40:08] [INFO] MQTTX client with ID 5026bb96-9655-4676-9a9a-306ae007337e assigned
[2023-04-01 09:40:08] [INFO] Connect client BambuLab, MQTT/SSL connection: mqtts://192.168.16.43:8883 with Properties: {"sessionExpiryInterval":0,"receiveMaximum":null,"maximumPacketSize":null,"topicAliasMaximum":null,"requestResponseInformation":null,"requestProblemInformation":null,"authenticationMethod":null}
[2023-04-01 09:40:14] [INFO] BambuLab connect success, MQTT.js onConnect trigger
[2023-04-01 09:40:37] [INFO] Saved topic: testtopic/#
[2023-04-01 09:40:37] [INFO] Topic: testtopic/# successfully subscribed, Subscription Identifier: undefined, No Local flag: undefined, Retain as Published flag: undefined, Retain Handling: undefined
[2023-04-01 09:40:58] [INFO] Removed topic: testtopic/#
[2023-04-01 09:40:58] [INFO] Unsubscribe topic: testtopic/#
[2023-04-01 09:41:21] [INFO] Saved topic: #
[2023-04-01 09:41:21] [INFO] Topic: # successfully subscribed, Subscription Identifier: undefined, No Local flag: undefined, Retain as Published flag: undefined, Retain Handling: undefined
[2023-04-01 09:41:21] [INFO] Message Arrived with topic: device/00M00????0?????0/report
[2023-04-01 09:41:21] [INFO] BambuLab message arrived: message added "message_5fd8ddff-b764-485d-a0df-1e09c1ae9d5f" and added to topic: "device/00M00A2C0603330/report", payload: "{\n    \"print\": {\n        \"ams\": {\n            \"ams\": [\n                {\n                    \"humidity\": \"4\",\n                    \"id\": \"0\",\n                    \"temp\": \"25.4\",\n                    \"tray\": [\n                        {\n                            \"bed_temp\": \"0\",\n                            \"bed_temp_type\": \"0\",\n                            \"drying_temp\": \"0\",\n                            \"drying_time\": \"0\",\n                            \"id\": \"0\",\n                            \"nozzle_temp_max\": \"230\",\n                            \"nozzle_temp_min\": \"190\",\n                            \"remain\": 0,\n                            \"tag_uid\": \"0000000000000000\",\n                            \"tray_color\": \"000000FF\",\n                            \"tray_diameter\": \"0.00\",\n                            \"tray_id_name\": \"\",\n                            \"tray_info_idx\": \"GFL99\",\n                            \"tray_sub_brands\": \"\",\n                            \"tray_type\": \"PLA\",\n                            \"tray_uuid\": \"00000000000000000000000000000000\",\n                            \"tray_weight\": \"0\",\n                            \"xcam_info\": \"000000000000000000000000\"\n                        },\n                        {\n                            \"bed_temp\": \"45\",\n                            \"bed_temp_type\": \"1\",\n                            \"drying_temp\": \"55\",\n                            \"drying_time\": \"8\",\n                            \"id\": \"1\",\n                            \"nozzle_temp_max\": \"230\",\n                            \"nozzle_temp_min\": \"190\",\n                            \"remain\": 0,\n                            \"tag_uid\": \"17D512BA00000100\",\n                            \"tray_color\": \"FF6A13FF\",\n                            \"tray_diameter\": \"1.75\",\n                            \"tray_id_name\": \"A00-A0\",\n                            \"tray_info_idx\": \"GFA00\",\n                            \"tray_sub_brands\": \"PLA Basic\",\n                            \"tray_type\": \"PLA\",\n                            \"tray_uuid\": \"C155ADB88DD945B8815C6329FD5AC7AF\",

Kann das der Fehler sein?

Gruß Paul
FHEM5.7 auf Pi3
Busware CUL433 (IT), JeeLink Lacrosse, HM-MOD-RPI-PCB, HM, TabletUI

paul79

Hallo,

nachdem ich jetzt noch einmal alles rebootet habe funktioniert es wohl jetzt.

das sind Einstellungen:
defmod BambuLab MQTT2_CLIENT 192.168.16.43:8883
attr BambuLab SSL 1
attr BambuLab autocreate simple
attr BambuLab clientId fhem1
attr BambuLab clientOrder MQTT2_DEVICE
attr BambuLab mqttVersion 3.1.1
attr BambuLab qosMaxQueueLength 0
attr BambuLab room MQTT2_DEVICE
attr BambuLab username bblp
attr BambuLab verbose 3

setstate BambuLab opened
setstate BambuLab 2023-04-01 13:27:42 state opened

PS: Username ist fest von BambuLab vergeben bblp das Passwort ist der Lan only Access Code im Drucker Display.

Gruß Paul
FHEM5.7 auf Pi3
Busware CUL433 (IT), JeeLink Lacrosse, HM-MOD-RPI-PCB, HM, TabletUI

wing350

Moin,

soweit bin ich auch!

Ich tu mich nur unheimlich schwer, aus dem json-String readings oder set-commands zu extrahieren. Deswegen habe ich erstmal den Weg über Homeassistent gewählt und mir die Integration für BambuLab installiert. Ich bin aber ein unverbesserlicher FHEM-Freund und würde die Daten gerne in FHEM haben. Gibts da vielleicht schon eine Template?

Gruß
Reimer

P.S. Ich hab einen P1P und bin total begeistert.
FHEM auf Ubuntu VM/QNAP, FHEM-Native, CUL868, RFTRX433 und Jeelink auf RPi über ser2net an VM angebunden, PCA301/LaCrosse-Gateway (WLAN), FHTs, FS20-Aktoren, FBDECT, div. HM- und HMIP-Komponenten, Raspberrymatic VM auf QNAP, Signalduino für Somfy, optolink-WLAN für Viessmann, div. Shelly

paul79

Hallo Reiner,

ein Template habe ich noch nicht gesehen, ich lasse mir die Readings einfach alle über "attr xxxxxx autocreate simple" selbst anlegen.

Gruß Paul
FHEM5.7 auf Pi3
Busware CUL433 (IT), JeeLink Lacrosse, HM-MOD-RPI-PCB, HM, TabletUI

Wiesel

Hallo,

ich muss das Thema nochmal aufgreifen. Ich bekomme es nicht hin, dass die Readings automatisch angelegt werden.
Neustart FHEM gemacht, Attribut autocreate simple auf dem Client ist drauf.

Internals:
   BUF       
   Clients    :MQTT2_DEVICE:MQTT_GENERIC_BRIDGE:
   ClientsKeepOrder 1
   DEF        192.168.186.105:8883
   DeviceName 192.168.186.105:8883
   FD         34
   FUUID      66da1eb7-f33f-b232-d01d-932be6b0c09e257f
   NAME       Bambi_X1C
   NR         479
   PARTIAL   
   SSL        1
   STATE      opened
   TYPE       MQTT2_CLIENT
   WBCallback
   clientId   Bambi_X1C
   eventCount 4
   lastMsgTime 1725571805.34311
   nextOpenDelay 10
   nrConnects 2
   MatchList:
     1:MQTT2_DEVICE ^.
     2:MQTT_GENERIC_BRIDGE ^.
   READINGS:
     2024-09-05 23:25:18   state           opened
Attributes:
   SSL        1
   autocreate simple
   qosMaxQueueLength 0
   room       MQTT
   username   bblp



Internals:
   Bambi_X1C_MSGCNT 220
   Bambi_X1C_TIME 2024-09-05 23:28:53
   CFGFN     
   CID        Bambi_X1C
   DEF        Bambi_X1C
   FUUID      66da21b0-f33f-b232-35b3-e22230384662b0d7
   IODev      Bambi_X1C
   LASTInputDev Bambi_X1C
   MSGCNT     220
   NAME       MQTT2_Bambi_X1C
   NR         482
   STATE      ???
   TYPE       MQTT2_DEVICE
   eventCount 221
   READINGS:
     2024-09-05 23:25:04   IODev           Bambi_X1C
     2024-09-05 23:28:53   report          {
    "print": {
        "ams": {
            "ams": [
                {
                    "humidity": "2",
                    "id": "0",
                    "temp": "36.7",
                    "tray": [
                        {
                            "bed_temp": "0",
                            "bed_temp_type": "0",
                            "cali_idx": 9967,
                            "cols": [
                                "FFFFFFFF"
                            ],
                            "ctype": 0,
                            "drying_temp": "55",
                            "drying_time": "8",
                            "id": "0",
                            "nozzle_temp_max": "230",
                            "nozzle_temp_min": "190",
                            "remain": 0,
                            "tag_uid": "EAE017DC00000100",
                            "tray_color": "FFFFFFFF",
                            "tray_diameter": "1.75",
                            "tray_id_name": "A00-W1",
                            "tray_info_idx": "GFA00",
                            "tray_sub_brands": "PLA Basic",
                            "tray_type": "PLA",
                            "tray_uuid": "03D8332974CC49B69AE8959DCC058CEA",
                            "tray_weight": "250",
                            "xcam_info": "34218813F401E8030000003F"
                        },
                        {
                            "bed_temp": "0",
                            "bed_temp_type": "0",
                            "cali_idx": 9016,
                            "cols": [
                                "898989FF"
                            ],
                            "ctype": 0,
                            "drying_temp": "0",
                            "drying_time": "0",
                            "id": "1",
                            "nozzle_temp_max": "225",
                            "nozzle_temp_min": "195",
                            "remain": 0,
                            "tag_uid": "0000000000000000",
                            "tray_color": "898989FF",
                            "tray_diameter": "0.00",
                            "tray_id_name": "",
                            "tray_info_idx": "Pb212859",
                            "tray_sub_brands": "",
                            "tray_type": "PLA",
                            "tray_uuid": "00000000000000000000000000000000",
                            "tray_weight": "0",
                            "xcam_info": "000000000000000000000000"
                        },
                        {
                            "bed_temp": "0",
                            "bed_temp_type": "0",
                            "cali_idx": 1152,
                            "cols": [
                                "0ACC38FF"
                            ],
                            "ctype": 0,
                            "drying_temp": "0",
                            "drying_time": "0",
                            "id": "2",
                            "nozzle_temp_max": "225",
                            "nozzle_temp_min": "195",
                            "remain": 0,
                            "tag_uid": "0000000000000000",
                            "tray_color": "0ACC38FF",
                            "tray_diameter": "0.00",
                            "tray_id_name": "",
                            "tray_info_idx": "Pb212859",
                            "tray_sub_brands": "",
                            "tray_type": "PLA",
                            "tray_uuid": "00000000000000000000000000000000",
                            "tray_weight": "0",
                            "xcam_info": "000000000000000000000000"
                        },
                        {
                            "bed_temp": "0",
                            "bed_temp_type": "0",
                            "cali_idx": 3325,
                            "cols": [
                                "898989FF"
                            ],
                            "ctype": 0,
                            "drying_temp": "0",
                            "drying_time": "0",
                            "id": "3",
                            "nozzle_temp_max": "225",
                            "nozzle_temp_min": "195",
                            "remain": 0,
                            "tag_uid": "0000000000000000",
                            "tray_color": "898989FF",
                            "tray_diameter": "0.00",
                            "tray_id_name": "",
                            "tray_info_idx": "Pb212859",
                            "tray_sub_brands": "",
                            "tray_type": "PLA",
                            "tray_uuid": "00000000000000000000000000000000",
                            "tray_weight": "0",
                            "xcam_info": "000000000000000000000000"
                        }
                    ]
                }
            ],
            "ams_exist_bits": "1",
            "ams_exist_bits_raw": "1",
            "insert_flag": true,
            "power_on_flag": false,
            "tray_exist_bits": "f",
            "tray_is_bbl_bits": "f",
            "tray_now": "3",
            "tray_pre": "2",
            "tray_read_done_bits": "f",
            "tray_reading_bits": "0",
            "tray_tar": "3",
            "version": 795
        },
        "ams_rfid_status": 2,
        "ams_status": 263,
        "aux_part_fan": true,
        "bed_target_temper": 60.0,
        "bed_temper": 60.0,
        "big_fan1_speed": "0",
        "big_fan2_speed": "0",
        "cali_version": 4,
        "chamber_temper": 38.0,
        "command": "push_status",
        "cooling_fan_speed": "0",
        "ctt": 0,
        "device": {
            "fan": 53248,
            "nozzle": {
                "0": {
                    "info": 136,
                    "temp": 14745825
                },
                "info": 0
            }
        },
        "fail_reason": "0",
        "fan_gear": 0,
        "filam_bak": [
            10
        ],
        "force_upgrade": false,
        "gcode_file": "/data/Metadata/plate_5.gcode",
        "gcode_file_prepare_percent": "100",
        "gcode_state": "RUNNING",
        "heatbreak_fan_speed": "13",
        "hms": [],
        "home_flag": 14798143,
        "hw_switch_state": 1,
        "ipcam": {
            "agora_service": "disable",
            "ipcam_dev": "1",
            "ipcam_record": "enable",
            "mode_bits": 2,
            "resolution": "1080p",
            "rtsp_url": "rtsps://192.168.186.105:322/streaming/live/1",
            "timelapse": "enable",
            "tutk_server": "enable"
        },
        "job_id": "127985051",
        "layer_num": 10,
        "lights_report": [
            {
                "mode": "on",
                "node": "chamber_light"
            },
            {
                "mode": "flashing",
                "node": "work_light"
            }
        ],
        "maintain": 3,
        "mc_percent": 12,
        "mc_print_error_code": "0",
        "mc_print_stage": "2",
        "mc_print_sub_stage": 0,
        "mc_remaining_time": 382,
        "net": {
            "conf": 16,
            "info": [
                {
                    "ip": 1773840576,
                    "mask": 16777215
                },
                {
                    "ip": 0,
                    "mask": 0
                }
            ]
        },
        "nozzle_diameter": "0.4",
        "nozzle_target_temper": 225.0,
        "nozzle_temper": 225.0,
        "nozzle_type": "hardened_steel",
        "online": {
            "ahb": false,
            "ext": false,
            "version": 4
        },
        "print_error": 0,
        "print_gcode_action": 0,
        "print_real_action": 0,
        "print_type": "cloud",
        "profile_id": "120227709",
        "project_id": "124859982",
        "queue_est": 0,
        "queue_number": 0,
        "queue_sts": 0,
        "queue_total": 0,
        "s_obj": [],
        "sdcard": true,
        "sequence_id": "2021",
        "spd_lvl": 2,
        "spd_mag": 100,
        "stg": [
            2,
            14,
            1
        ],
        "stg_cur": 0,
        "subtask_id": "248461036",
        "subtask_name": "BLV - AMS Riser for X1C / P1P / P1S V3.1 Final",
        "task_id": "248461035",
        "total_layer_num": 164,
        "upgrade_state": {
            "ahb_new_version_number": "",
            "ams_new_version_number": "",
            "consistency_request": false,
            "dis_state": 0,
            "err_code": 0,
            "ext_new_version_number": "",
            "force_upgrade": false,
            "idx": 4,
            "idx1": 0,
            "lower_limit": "00.00.00.00",
            "message": "",
            "module": "",
            "new_version_state": 2,
            "ota_new_version_number": "",
            "progress": "0",
            "sequence_id": 0,
            "sn": "00M09D461802139",
            "status": "IDLE"
        },
        "upload": {
            "file_size": 0,
            "finish_size": 0,
            "message": "Good",
            "oss_url": "",
            "progress": 0,
            "sequence_id": "0903",
            "speed": 0,
            "status": "idle",
            "task_id": "",
            "time_remaining": 0,
            "trouble_id": ""
        },
        "vt_tray": {
            "bed_temp": "0",
            "bed_temp_type": "0",
            "cali_idx": -1,
            "cols": [
                "00000000"
            ],
            "ctype": 0,
            "drying_temp": "0",
            "drying_time": "0",
            "id": "254",
            "nozzle_temp_max": "0",
            "nozzle_temp_min": "0",
            "remain": 0,
            "tag_uid": "0000000000000000",
            "tray_color": "00000000",
            "tray_diameter": "0.00",
            "tray_id_name": "",
            "tray_info_idx": "",
            "tray_sub_brands": "",
            "tray_type": "",
            "tray_uuid": "00000000000000000000000000000000",
            "tray_weight": "0",
            "xcam_info": "000000000000000000000000"
        },
        "wifi_signal": "-68dBm",
        "xcam": {
            "allow_skip_parts": false,
            "buildplate_marker_detector": true,
            "first_layer_inspector": true,
            "halt_print_sensitivity": "medium",
            "print_halt": true,
            "printing_monitor": true,
            "spaghetti_detector": true
        },
        "xcam_status": "0"
    }
}
Attributes:
   readingList Bambi_X1C:device/00M09D461802139/report:.* report
   room       MQTT2_DEVICE


Gruß Tobias
Raspi 4 mit FHEM und CUL / Conbee2

TomLee

Hallo,

ändere den automatisch erstellten ReadingList-Eintrag zu:

attr MQTT2_Bambi_X1C readingList device/00M09D461802139/report:.* { json2nameValue($EVENT)}
Gruß Thomas

Wiesel

Raspi 4 mit FHEM und CUL / Conbee2

Wiesel

Noch eine Frage. Der Bambu schickt ja jede Sekunde ein update. Kann man irgendwie sagen bitte nur alle X Sekunden ?



Achja, ich habe eine Subroutine für ein devStateIcon mit Text und Icons erstellt.
Vielleicht kann ja der ein oder andere damit was anfangen  :)

P.S. Code schreiben ist NICHT mein täglich Brot. Ich bin froh wenn es funktioniert  ;D
Verbesserungsvorschläge gerne gesehen.

attr MQTT2_DEVICE devStateIcon {bambuDevStateIcon($name)}

sub bambuDevStateIcon($) {

my ($deviceName) = @_;

#Log 3, "deviceName: " . $deviceName;

my $chamberTemp = ReadingsVal($deviceName,"print_chamber_temper",'');
#Log 3, "chamberTemp: " . $chamberTemp;

my $colorTray1 = '@#' . ReadingsVal($deviceName,"print_ams_ams_1_tray_1_tray_color",'');
my $colorTray2 = '@#' . ReadingsVal($deviceName,"print_ams_ams_1_tray_2_tray_color",'');
my $colorTray3 = '@#' . ReadingsVal($deviceName,"print_ams_ams_1_tray_3_tray_color",'');
my $colorTray4 = '@#' . ReadingsVal($deviceName,"print_ams_ams_1_tray_4_tray_color",'');

#Log 3, "colorTray1: " . $colorTray1;

my $iconActive = 'rc_dot';
my $iconPassive = 'radio_checked';

my $iconTray1 = $iconPassive . $colorTray1;
my $iconTray2 = $iconPassive . $colorTray2;
my $iconTray3 = $iconPassive . $colorTray3;
my $iconTray4 = $iconPassive . $colorTray4;

my $activeTray = ReadingsVal($deviceName,"print_ams_tray_now",'');
if ($activeTray == 1) {
$iconTray1 = $iconActive . $colorTray1;
$iconTray2 = $iconPassive . $colorTray2;
$iconTray3 = $iconPassive . $colorTray3;
$iconTray4 = $iconPassive . $colorTray4;
} elsif ($activeTray == 2) {
$iconTray1 = $iconPassive . $colorTray1;
$iconTray2 = $iconActive . $colorTray2;
$iconTray3 = $iconPassive . $colorTray3;
$iconTray4 = $iconPassive . $colorTray4;
} elsif ($activeTray == 3) {
$iconTray1 = $iconPassive . $colorTray1;
$iconTray2 = $iconPassive . $colorTray2;
$iconTray3 = $iconActive . $colorTray3;
$iconTray4 = $iconPassive . $colorTray4;
} elsif ($activeTray == 4) {
$iconTray1 = $iconPassive . $colorTray1;
$iconTray2 = $iconPassive . $colorTray2;
$iconTray3 = $iconPassive . $colorTray3;
$iconTray4 = $iconActive . $colorTray4;
}


my $printStatus;
my $nozzleStatus;
my $bedStatus;
if (ReadingsVal($deviceName,"print_gcode_state",'') eq "RUNNING") {
$printStatus = "RUNNING - " . ReadingsVal($deviceName,"print_mc_percent",'') . "/100" ;
$nozzleStatus = int(ReadingsVal($deviceName,"print_nozzle_temper",'')) . "/" . int(ReadingsVal($deviceName,"print_nozzle_target_temper",''));
$bedStatus = int(ReadingsVal($deviceName,"print_bed_temper",'')) . "/" . int(ReadingsVal($deviceName,"print_bed_target_temper",''));
} else {
$printStatus = ReadingsVal($deviceName,"print_gcode_state",'');
$nozzleStatus = int(ReadingsVal($deviceName,"print_nozzle_temper",''));
$bedStatus = int(ReadingsVal($deviceName,"print_bed_temper",''));
}

my $state = "<div>" . "Status: " . $printStatus . "% | Nozzle: " . $nozzleStatus . "°C | Bed: " . $bedStatus . "°C | Chamber: " . $chamberTemp . "°C | AMS: " . FW_makeImage($iconTray1) . " " . FW_makeImage($iconTray2) . " " . FW_makeImage($iconTray3) . " " . FW_makeImage($iconTray4) . "</div>";

return $state;
}
Raspi 4 mit FHEM und CUL / Conbee2