HTTPMOD json auslesen (grocy)

Begonnen von Kharim, 25 Juni 2022, 17:18:25

Vorheriges Thema - Nächstes Thema

Kharim

Hi ihr,

ich habe hier ein grocy laufen....
(https://grocy.info/de)

Das Teil hat eine API und soll Json zurück geben.
Leider bekomme ich dies mit HTTPMOD nicht ausgelesen...

Sieht jemand den Fehler?

Ausgabe im Browser:
{
  "due_products": [],
  "overdue_products": [
    {
      "amount": "2",
      "amount_aggregated": "2",
      "value": "0.0",
      "best_before_date": "2020-08-30",
      "amount_opened": "1",
      "amount_opened_aggregated": "1",
      "is_aggregated_amount": "0",
      "due_type": "1",
      "product_id": "4",
      "product": {
        "id": "4",
        "name": "Vomacur",
        "description": "<p>Bei Schwindel, Übelkeit und Erbrechen<br /></p>",
        "product_group_id": "1",
        "active": "1",
        "location_id": "4",
        "shopping_location_id": "",
        "qu_id_purchase": "4",
        "qu_id_stock": "4",
        "qu_factor_purchase_to_stock": "1.0",
        "min_stock_amount": "0",
        "default_best_before_days": "0",
        "default_best_before_days_after_open": "0",
        "default_best_before_days_after_freezing": "0",
        "default_best_before_days_after_thawing": "0",
        "picture_file_name": "",
        "enable_tare_weight_handling": "0",
        "tare_weight": "0.0",
        "not_check_stock_fulfillment_for_recipes": "0",
        "parent_product_id": "24",
        "calories": "0",
        "cumulate_min_stock_amount_of_sub_products": "0",
        "due_type": "1",
        "quick_consume_amount": "1.0",
        "hide_on_stock_overview": "0",
        "default_stock_label_type": "0",
        "should_not_be_frozen": "0",
        "row_created_timestamp": "2022-06-25 10:25:28",
        "treat_opened_as_out_of_stock": "1",
        "no_own_stock": "0",
        "default_consume_location_id": "4",
        "move_on_open": "0"
      }
    },
    {
      "amount": "3",
      "amount_aggregated": "3",
      "value": "0.0",
      "best_before_date": "2020-12-30",
      "amount_opened": "0",
      "amount_opened_aggregated": "0",
      "is_aggregated_amount": "0",
      "due_type": "1",
      "product_id": "5",
      "product": {
        "id": "5",
        "name": "Otriven",
        "description": "<p>Schnupfen und Nasentropfen<br /></p>",
        "product_group_id": "1",
        "active": "1",
        "location_id": "4",
        "shopping_location_id": "",
        "qu_id_purchase": "4",
        "qu_id_stock": "4",
        "qu_factor_purchase_to_stock": "1.0",
        "min_stock_amount": "0",
        "default_best_before_days": "0",
        "default_best_before_days_after_open": "0",
        "default_best_before_days_after_freezing": "0",
        "default_best_before_days_after_thawing": "0",
        "picture_file_name": "",
        "enable_tare_weight_handling": "0",
        "tare_weight": "0.0",
        "not_check_stock_fulfillment_for_recipes": "0",
        "parent_product_id": "22",
        "calories": "0",
        "cumulate_min_stock_amount_of_sub_products": "0",
        "due_type": "1",
        "quick_consume_amount": "1.0",
        "hide_on_stock_overview": "0",
        "default_stock_label_type": "0",
        "should_not_be_frozen": "0",
        "row_created_timestamp": "2022-06-25 10:27:54",
        "treat_opened_as_out_of_stock": "1",
        "no_own_stock": "0",
        "default_consume_location_id": "4",
        "move_on_open": "0"
      }
    },
    {
      "amount": "3",
      "amount_aggregated": "3.0",
      "value": "0.0",
      "best_before_date": "2021-03-30",
      "amount_opened": "0",
      "amount_opened_aggregated": "0.0",
      "is_aggregated_amount": "0",
      "due_type": "1",
      "product_id": "16",
      "product": {
        "id": "16",
        "name": "Zinkoxidsalbe",
        "description": "",
        "product_group_id": "1",
        "active": "1",
        "location_id": "4",
        "shopping_location_id": "",
        "qu_id_purchase": "4",
        "qu_id_stock": "4",
        "qu_factor_purchase_to_stock": "1.0",
        "min_stock_amount": "0",
        "default_best_before_days": "0",
        "default_best_before_days_after_open": "0",
        "default_best_before_days_after_freezing": "0",
        "default_best_before_days_after_thawing": "0",
        "picture_file_name": "",
        "enable_tare_weight_handling": "0",
        "tare_weight": "0.0",
        "not_check_stock_fulfillment_for_recipes": "0",
        "parent_product_id": null,
        "calories": "0",
        "cumulate_min_stock_amount_of_sub_products": "0",
        "due_type": "1",
        "quick_consume_amount": "1.0",
        "hide_on_stock_overview": "0",
        "default_stock_label_type": "0",
        "should_not_be_frozen": "0",
        "row_created_timestamp": "2022-06-25 10:54:22",
        "treat_opened_as_out_of_stock": "1",
        "no_own_stock": "0",
        "default_consume_location_id": "",
        "move_on_open": "0"
      }
    },
    {
      "amount": "2",
      "amount_aggregated": "2",
      "value": "0.0",
      "best_before_date": "2020-10-30",
      "amount_opened": "1",
      "amount_opened_aggregated": "1",
      "is_aggregated_amount": "0",
      "due_type": "1",
      "product_id": "17",
      "product": {
        "id": "17",
        "name": "Salbubronch",
        "description": "",
        "product_group_id": "1",
        "active": "1",
        "location_id": "4",
        "shopping_location_id": "",
        "qu_id_purchase": "4",
        "qu_id_stock": "4",
        "qu_factor_purchase_to_stock": "1.0",
        "min_stock_amount": "0",
        "default_best_before_days": "0",
        "default_best_before_days_after_open": "120",
        "default_best_before_days_after_freezing": "0",
        "default_best_before_days_after_thawing": "0",
        "picture_file_name": "",
        "enable_tare_weight_handling": "0",
        "tare_weight": "0.0",
        "not_check_stock_fulfillment_for_recipes": "0",
        "parent_product_id": "23",
        "calories": "0",
        "cumulate_min_stock_amount_of_sub_products": "0",
        "due_type": "1",
        "quick_consume_amount": "1.0",
        "hide_on_stock_overview": "0",
        "default_stock_label_type": "0",
        "should_not_be_frozen": "0",
        "row_created_timestamp": "2022-06-25 10:58:12",
        "treat_opened_as_out_of_stock": "1",
        "no_own_stock": "0",
        "default_consume_location_id": "4",
        "move_on_open": "0"
      }
    },
    {
      "amount": "1",
      "amount_aggregated": "1.0",
      "value": "0.0",
      "best_before_date": "2022-01-30",
      "amount_opened": "1",
      "amount_opened_aggregated": "1.0",
      "is_aggregated_amount": "0",
      "due_type": "1",
      "product_id": "18",
      "product": {
        "id": "18",
        "name": "Fiebersaft Paracetamol",
        "description": "<p>Fiebersaft<br /></p>",
        "product_group_id": "1",
        "active": "1",
        "location_id": "4",
        "shopping_location_id": "",
        "qu_id_purchase": "4",
        "qu_id_stock": "4",
        "qu_factor_purchase_to_stock": "1.0",
        "min_stock_amount": "1",
        "default_best_before_days": "0",
        "default_best_before_days_after_open": "180",
        "default_best_before_days_after_freezing": "0",
        "default_best_before_days_after_thawing": "0",
        "picture_file_name": "",
        "enable_tare_weight_handling": "0",
        "tare_weight": "0.0",
        "not_check_stock_fulfillment_for_recipes": "0",
        "parent_product_id": null,
        "calories": "0",
        "cumulate_min_stock_amount_of_sub_products": "0",
        "due_type": "1",
        "quick_consume_amount": "1.0",
        "hide_on_stock_overview": "0",
        "default_stock_label_type": "0",
        "should_not_be_frozen": "0",
        "row_created_timestamp": "2022-06-25 11:01:26",
        "treat_opened_as_out_of_stock": "1",
        "no_own_stock": "0",
        "default_consume_location_id": "",
        "move_on_open": "0"
      }
    },
    {
      "amount": "0",
      "amount_aggregated": "5.0",
      "value": "0",
      "best_before_date": "2020-12-30",
      "amount_opened": "0",
      "amount_opened_aggregated": "0.0",
      "is_aggregated_amount": "1",
      "due_type": "1",
      "product_id": "22",
      "product": {
        "id": "22",
        "name": "SA Nasentropfen  ",
        "description": "",
        "product_group_id": "",
        "active": "1",
        "location_id": "4",
        "shopping_location_id": "",
        "qu_id_purchase": "4",
        "qu_id_stock": "4",
        "qu_factor_purchase_to_stock": "1.0",
        "min_stock_amount": "1",
        "default_best_before_days": "0",
        "default_best_before_days_after_open": "0",
        "default_best_before_days_after_freezing": "0",
        "default_best_before_days_after_thawing": "0",
        "picture_file_name": null,
        "enable_tare_weight_handling": "0",
        "tare_weight": "0.0",
        "not_check_stock_fulfillment_for_recipes": "0",
        "parent_product_id": null,
        "calories": "0",
        "cumulate_min_stock_amount_of_sub_products": "1",
        "due_type": "1",
        "quick_consume_amount": "1.0",
        "hide_on_stock_overview": "0",
        "default_stock_label_type": "0",
        "should_not_be_frozen": "0",
        "row_created_timestamp": "2022-06-25 11:12:06",
        "treat_opened_as_out_of_stock": "1",
        "no_own_stock": "0",
        "default_consume_location_id": "4",
        "move_on_open": "0"
      }
    },
    {
      "amount": "0",
      "amount_aggregated": "5.0",
      "value": "0",
      "best_before_date": "2020-10-30",
      "amount_opened": "0",
      "amount_opened_aggregated": "2.0",
      "is_aggregated_amount": "1",
      "due_type": "1",
      "product_id": "23",
      "product": {
        "id": "23",
        "name": "SA Hustensaft  ",
        "description": "",
        "product_group_id": "",
        "active": "1",
        "location_id": "4",
        "shopping_location_id": "",
        "qu_id_purchase": "4",
        "qu_id_stock": "4",
        "qu_factor_purchase_to_stock": "1.0",
        "min_stock_amount": "1",
        "default_best_before_days": "0",
        "default_best_before_days_after_open": "0",
        "default_best_before_days_after_freezing": "0",
        "default_best_before_days_after_thawing": "0",
        "picture_file_name": null,
        "enable_tare_weight_handling": "0",
        "tare_weight": "0.0",
        "not_check_stock_fulfillment_for_recipes": "0",
        "parent_product_id": null,
        "calories": "0",
        "cumulate_min_stock_amount_of_sub_products": "1",
        "due_type": "1",
        "quick_consume_amount": "1.0",
        "hide_on_stock_overview": "0",
        "default_stock_label_type": "0",
        "should_not_be_frozen": "0",
        "row_created_timestamp": "2022-06-25 11:12:50",
        "treat_opened_as_out_of_stock": "1",
        "no_own_stock": "0",
        "default_consume_location_id": "4",
        "move_on_open": "0"
      }
    },
    {
      "amount": "0",
      "amount_aggregated": "3.0",
      "value": "0",
      "best_before_date": "2020-08-30",
      "amount_opened": "0",
      "amount_opened_aggregated": "1.0",
      "is_aggregated_amount": "1",
      "due_type": "1",
      "product_id": "24",
      "product": {
        "id": "24",
        "name": "SA Übelkeit  ",
        "description": "",
        "product_group_id": "",
        "active": "1",
        "location_id": "4",
        "shopping_location_id": "",
        "qu_id_purchase": "4",
        "qu_id_stock": "4",
        "qu_factor_purchase_to_stock": "1.0",
        "min_stock_amount": "1",
        "default_best_before_days": "0",
        "default_best_before_days_after_open": "0",
        "default_best_before_days_after_freezing": "0",
        "default_best_before_days_after_thawing": "0",
        "picture_file_name": null,
        "enable_tare_weight_handling": "0",
        "tare_weight": "0.0",
        "not_check_stock_fulfillment_for_recipes": "0",
        "parent_product_id": null,
        "calories": "0",
        "cumulate_min_stock_amount_of_sub_products": "1",
        "due_type": "1",
        "quick_consume_amount": "1.0",
        "hide_on_stock_overview": "0",
        "default_stock_label_type": "0",
        "should_not_be_frozen": "0",
        "row_created_timestamp": "2022-06-25 11:14:38",
        "treat_opened_as_out_of_stock": "1",
        "no_own_stock": "0",
        "default_consume_location_id": "4",
        "move_on_open": "0"
      }
    }
  ],
  "expired_products": [],
  "missing_products": [
    {
      "id": "18",
      "name": "Fiebersaft Paracetamol",
      "amount_missing": "1.0",
      "is_partly_in_stock": "1"
    },
    {
      "id": "20",
      "name": "Zäpfchen Nurofen",
      "amount_missing": "1.0",
      "is_partly_in_stock": "1"
    }
  ]


HTTPMOD Device:
Internals:
   BUSY       0
   DEF        http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14 0
   FUUID      62b72336-f33f-8ab7-2d88-66a1f39d2622b0d1
   Interval   0
   MainURL    http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14
   ModuleVersion 4.1.12 - 19.4.2022
   NAME       grocy
   NOTIFYDEV  global
   NR         495
   NTFY_ORDER 50-grocy
   STATE      ???
   TYPE       HTTPMOD
   value     
   HttpUtils:
     NAME       
     addr       http://192.168.xxx.xxx:9283
     auth       0
     code       200
     compress   1
     conn       
     data       
     displayurl http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14
     header     GROCY-API-KEY: 9spjl8oNvKVopd6c7gXXXXXXXXXXXXXX5MT4bw28J
     host       192.168.xxx.xxx
     httpheader HTTP/1.1 200 OK
Server: nginx/1.20.2
Date: Sat, 25 Jun 2022 15:08:30 GMT
Content-Type: application/json
Connection: close
X-Powered-By: PHP/8.0.13
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: *
     httpversion 1.0
     hu_blocking 0
     hu_filecount 1
     hu_port    9283
     hu_portSfx :9283
     ignoreredirects 1
     loglevel   4
     path       /api/stock/volatile?due_soon_days=14
     protocol   http
     redirects  0
     timeout    2
     url        http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14
     sslargs:
   QUEUE:
   READINGS:
   REQUEST:
     context    reading
     data       
     header     GROCY-API-KEY: 9spjl8oNvKVopd6c7gXXXXXXXXXXXXXX5MT4bw28J
     ignoreredirects 0
     num        unknown
     retryCount 0
     type       update
     url        http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14
Attributes:
   getHeader1 Content-Type: application/json
   getHeader2 Accept: */*
   reading01JSON name
   reading01Name Name
   reading01RecombineExpr join ",", @matchlist
   requestHeader01 GROCY-API-KEY: 9spjl8oNvKVopd6c7gXXXXXXXXXXXXXX5MT4bw28J
   room       Grocy
   userattr   get01URL getHeader1:textField-long getHeader2:textField-long getURL reading01JSON reading01Name reading01RecombineExpr:textField-long requestHeader01
   verbose    5


FHEM Log:
2022.06.25 17:15:10 5: grocy: set called with reread
2022.06.25 17:15:10 4: grocy: GetUpdate called (reread)
2022.06.25 17:15:10 5: grocy: AddToQueue adds type update to URL http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14, no data, header GROCY-API-KEY: 9spjl8oNvKVopd6c7gXXXXXXXXXXXXXX5MT4bw28J, retry 0, initial queue len: 0
2022.06.25 17:15:10 5: grocy: HandleSendQueue called from HTTPMOD::AddToSendQueue, qlen = 1
2022.06.25 17:15:10 4: grocy: HandleSendQueue sends update with timeout 2 to http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14, No Data,
header: GROCY-API-KEY: 9spjl8oNvKVopd6c7gXXXXXXXXXXXXXX5MT4bw28J
2022.06.25 17:15:10 5: grocy: ReadCallback called from __ANON__
2022.06.25 17:15:10 4: grocy: Read callback: request type was update retry 0,
header: HTTP/1.1 200 OK
Server: nginx/1.20.2
Date: Sat, 25 Jun 2022 15:15:10 GMT
Content-Type: application/json
Connection: close
X-Powered-By: PHP/8.0.13
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: *, body length 9176
2022.06.25 17:15:10 5: grocy: Read callback: body
{"due_products":[],"overdue_products":[{"amount":"2","amount_aggregated":"2","value":"0.0","best_before_date":"2020-08-30","amount_opened":"1","amount_opened_aggregated":"1","is_aggregated_amount":"0","due_type":"1","product_id":"4","product":{"id":"4","name":"Vomacur","description":"<p>Bei Schwindel, \u00dcbelkeit und Erbrechen<br \/><\/p>","product_group_id":"1","active":"1","location_id":"4","shopping_location_id":"","qu_id_purchase":"4","qu_id_stock":"4","qu_factor_purchase_to_stock":"1.0","min_stock_amount":"0","default_best_before_days":"0","default_best_before_days_after_open":"0","default_best_before_days_after_freezing":"0","default_best_before_days_after_thawing":"0","picture_file_name":"","enable_tare_weight_handling":"0","tare_weight":"0.0","not_check_stock_fulfillment_for_recipes":"0","parent_product_id":"24","calories":"0","cumulate_min_stock_amount_of_sub_products":"0","due_type":"1","quick_consume_amount":"1.0","hide_on_stock_overview":"0","default_stock_label_type":"0","should_not_be_frozen":"0","row_created_timestamp":"2022-06-25 10:25:28","treat_opened_as_out_of_stock":"1","no_own_stock":"0","default_consume_location_id":"4","move_on_open":"0"}},{"amount":"3","amount_aggregated":"3","value":"0.0","best_before_date":"2020-12-30","amount_opened":"0","amount_opened_aggregated":"0","is_aggregated_amount":"0","due_type":"1","product_id":"5","product":{"id":"5","name":"Otriven","description":"<p>Schnupfen und Nasentropfen<br \/><\/p>","product_group_id":"1","active":"1","location_id":"4","shopping_location_id":"","qu_id_purchase":"4","qu_id_stock":"4","qu_factor_purchase_to_stock":"1.0","min_stock_amount":"0","default_best_before_days":"0","default_best_before_days_after_open":"0","default_best_before_days_after_freezing":"0","default_best_before_days_after_thawing":"0","picture_file_name":"","enable_tare_weight_handling":"0","tare_weight":"0.0","not_check_stock_fulfillment_for_recipes":"0","parent_product_id":"22","calories":"0","cumulate_min_stock_amount_of_sub_products":"0","due_type":"1","quick_consume_amount":"1.0","hide_on_stock_overview":"0","default_stock_label_type":"0","should_not_be_frozen":"0","row_created_timestamp":"2022-06-25 10:27:54","treat_opened_as_out_of_stock":"1","no_own_stock":"0","default_consume_location_id":"4","move_on_open":"0"}},{"amount":"3","amount_aggregated":"3.0","value":"0.0","best_before_date":"2021-03-30","amount_opened":"0","amount_opened_aggregated":"0.0","is_aggregated_amount":"0","due_type":"1","product_id":"16","product":{"id":"16","name":"Zinkoxidsalbe","description":"","product_group_id":"1","active":"1","location_id":"4","shopping_location_id":"","qu_id_purchase":"4","qu_id_stock":"4","qu_factor_purchase_to_stock":"1.0","min_stock_amount":"0","default_best_before_days":"0","default_best_before_days_after_open":"0","default_best_before_days_after_freezing":"0","default_best_before_days_after_thawing":"0","picture_file_name":"","enable_tare_weight_handling":"0","tare_weight":"0.0","not_check_stock_fulfillment_for_recipes":"0","parent_product_id":null,"calories":"0","cumulate_min_stock_amount_of_sub_products":"0","due_type":"1","quick_consume_amount":"1.0","hide_on_stock_overview":"0","default_stock_label_type":"0","should_not_be_frozen":"0","row_created_timestamp":"2022-06-25 10:54:22","treat_opened_as_out_of_stock":"1","no_own_stock":"0","default_consume_location_id":"","move_on_open":"0"}},{"amount":"2","amount_aggregated":"2","value":"0.0","best_before_date":"2020-10-30","amount_opened":"1","amount_opened_aggregated":"1","is_aggregated_amount":"0","due_type":"1","product_id":"17","product":{"id":"17","name":"Salbubronch","description":"","product_group_id":"1","active":"1","location_id":"4","shopping_location_id":"","qu_id_purchase":"4","qu_id_stock":"4","qu_factor_purchase_to_stock":"1.0","min_stock_amount":"0","default_best_before_days":"0","default_best_before_days_after_open":"120","default_best_before_days_after_freezing":"0","default_best_before_days_after_thawing":"0","picture_file_name":"","enable_tare_weight_handling":"0","tare_weight":"0.0","not_check_stock_fulfillment_for_recipes":"0","parent_product_id":"23","calories":"0","cumulate_min_stock_amount_of_sub_products":"0","due_type":"1","quick_consume_amount":"1.0","hide_on_stock_overview":"0","default_stock_label_type":"0","should_not_be_frozen":"0","row_created_timestamp":"2022-06-25 10:58:12","treat_opened_as_out_of_stock":"1","no_own_stock":"0","default_consume_location_id":"4","move_on_open":"0"}},{"amount":"1","amount_aggregated":"1.0","value":"0.0","best_before_date":"2022-01-30","amount_opened":"1","amount_opened_aggregated":"1.0","is_aggregated_amount":"0","due_type":"1","product_id":"18","product":{"id":"18","name":"Fiebersaft Paracetamol","description":"<p>Fiebersaft<br \/><\/p>","product_group_id":"1","active":"1","location_id":"4","shopping_location_id":"","qu_id_purchase":"4","qu_id_stock":"4","qu_factor_purchase_to_stock":"1.0","min_stock_amount":"1","default_best_before_days":"0","default_best_before_days_after_open":"180","default_best_before_days_after_freezing":"0","default_best_before_days_after_thawing":"0","picture_file_name":"","enable_tare_weight_handling":"0","tare_weight":"0.0","not_check_stock_fulfillment_for_recipes":"0","parent_product_id":null,"calories":"0","cumulate_min_stock_amount_of_sub_products":"0","due_type":"1","quick_consume_amount":"1.0","hide_on_stock_overview":"0","default_stock_label_type":"0","should_not_be_frozen":"0","row_created_timestamp":"2022-06-25 11:01:26","treat_opened_as_out_of_stock":"1","no_own_stock":"0","default_consume_location_id":"","move_on_open":"0"}},{"amount":"0","amount_aggregated":"5.0","value":"0","best_before_date":"2020-12-30","amount_opened":"0","amount_opened_aggregated":"0.0","is_aggregated_amount":"1","due_type":"1","product_id":"22","product":{"id":"22","name":"SA Nasentropfen  ","description":"","product_group_id":"","active":"1","location_id":"4","shopping_location_id":"","qu_id_purchase":"4","qu_id_stock":"4","qu_factor_purchase_to_stock":"1.0","min_stock_amount":"1","default_best_before_days":"0","default_best_before_days_after_open":"0","default_best_before_days_after_freezing":"0","default_best_before_days_after_thawing":"0","picture_file_name":null,"enable_tare_weight_handling":"0","tare_weight":"0.0","not_check_stock_fulfillment_for_recipes":"0","parent_product_id":null,"calories":"0","cumulate_min_stock_amount_of_sub_products":"1","due_type":"1","quick_consume_amount":"1.0","hide_on_stock_overview":"0","default_stock_label_type":"0","should_not_be_frozen":"0","row_created_timestamp":"2022-06-25 11:12:06","treat_opened_as_out_of_stock":"1","no_own_stock":"0","default_consume_location_id":"4","move_on_open":"0"}},{"amount":"0","amount_aggregated":"5.0","value":"0","best_before_date":"2020-10-30","amount_opened":"0","amount_opened_aggregated":"2.0","is_aggregated_amount":"1","due_type":"1","product_id":"23","product":{"id":"23","name":"SA Hustensaft  ","description":"","product_group_id":"","active":"1","location_id":"4","shopping_location_id":"","qu_id_purchase":"4","qu_id_stock":"4","qu_factor_purchase_to_stock":"1.0","min_stock_amount":"1","default_best_before_days":"0","default_best_before_days_after_open":"0","default_best_before_days_after_freezing":"0","default_best_before_days_after_thawing":"0","picture_file_name":null,"enable_tare_weight_handling":"0","tare_weight":"0.0","not_check_stock_fulfillment_for_recipes":"0","parent_product_id":null,"calories":"0","cumulate_min_stock_amount_of_sub_products":"1","due_type":"1","quick_consume_amount":"1.0","hide_on_stock_overview":"0","default_stock_label_type":"0","should_not_be_frozen":"0","row_created_timestamp":"2022-06-25 11:12:50","treat_opened_as_out_of_stock":"1","no_own_stock":"0","default_consume_location_id":"4","move_on_open":"0"}},{"amount":"0","amount_aggregated":"3.0","value":"0","best_before_date":"2020-08-30","amount_opened":"0","amount_opened_aggregated":"1.0","is_aggregated_amount":"1","due_type":"1","product_id":"24","product":{"id":"24","name":"SA \u00dcbelkeit  ","description":"","product_group_id":"","active":"1","location_id":"4","shopping_location_id":"","qu_id_purchase":"4","qu_id_stock":"4","qu_factor_purchase_to_stock":"1.0","min_stock_amount":"1","default_best_before_days":"0","default_best_before_days_after_open":"0","default_best_before_days_after_freezing":"0","default_best_before_days_after_thawing":"0","picture_file_name":null,"enable_tare_weight_handling":"0","tare_weight":"0.0","not_check_stock_fulfillment_for_recipes":"0","parent_product_id":null,"calories":"0","cumulate_min_stock_amount_of_sub_products":"1","due_type":"1","quick_consume_amount":"1.0","hide_on_stock_overview":"0","default_stock_label_type":"0","should_not_be_frozen":"0","row_created_timestamp":"2022-06-25 11:14:38","treat_opened_as_out_of_stock":"1","no_own_stock":"0","default_consume_location_id":"4","move_on_open":"0"}}],"expired_products":[],"missing_products":[{"id":"18","name":"Fiebersaft Paracetamol","amount_missing":"1.0","is_partly_in_stock":"1"},{"id":"20","name":"Z\u00e4pfchen Nurofen","amount_missing":"1.0","is_partly_in_stock":"1"}]}
2022.06.25 17:15:10 4: grocy: BodyDecode found no charset header (bodyDecode was set to auto)
2022.06.25 17:15:10 4: grocy: extracted JSON values to internal
2022.06.25 17:15:10 5: grocy: GetCookies is looking for Cookies
2022.06.25 17:15:10 5: grocy: ExtractSid called, context reading, num unknown
2022.06.25 17:15:10 4: grocy: checking for redirects, code=200, ignore=0
2022.06.25 17:15:10 4: grocy: no redirects to handle
2022.06.25 17:15:10 5: grocy: Read callback sets LAST_REQUEST to update
2022.06.25 17:15:10 5: grocy: CheckAuth decided no authentication required
2022.06.25 17:15:10 5: grocy: UpdateReadingList created list of reading.* nums to parse during getUpdate as 01
2022.06.25 17:15:10 5: grocy: Read starts parsing response to update with defined readings: 01
2022.06.25 17:15:10 5: grocy: ExtractReading Name with json name ...
2022.06.25 17:15:10 5: grocy: ExtractReading Name with json name did not match a key directly - trying regex match to create a list
2022.06.25 17:15:10 5: grocy: ExtractReading Name with json /^name/ got keylist
2022.06.25 17:15:10 5: grocy: ExtractReading Name did not match
2022.06.25 17:15:10 4: grocy: Read response to update didn't match any Reading
2022.06.25 17:15:10 5: grocy: HandleSendQueue called from HTTPMOD::ReadCallback, qlen = 0
2022.06.25 17:15:10 5: grocy: HandleSendQueue found no usable entry in queue


Im Read callback: body liegt der Inhalt... Zugang und Abfrageergebnis sind also da.....aber er findet nichts??


Danke,
Kharim
Raspberry Pi 2 + Minibian + 2x MAX Cube CUN (868/433Mhz) + Thermostate + Fensterkontakte + Taster+RGB-LED Band über pigpiod + TFA Sensoren 30.3169/3125
Raspberry Pi 2 + Minibian +Z-Wave (USB) + Bewegungsmelder + Fensterkontakt + Sirene + SMS Steuer-/Benachrichtigung (ohne Internet)

betateilchen

#1
Warum nimmst Du nicht JsonMod?

Deinen JSON-Inhalt habe ich in eine Datei /tmp/grocy.json geschrieben, die am Ende fehlende geschweifte Klammer ergänzt und folgendes probiert:


defmod json_test JsonMod file://tmp/grocy.json
attr json_test readingList complete()


Das liefert als Ergebnis


setstate json_test 2022-06-25 17:44:30 missing_products.0.amount_missing 1.0
setstate json_test 2022-06-25 17:44:30 missing_products.0.id 18
setstate json_test 2022-06-25 17:44:30 missing_products.0.is_partly_in_stock 1
setstate json_test 2022-06-25 17:44:30 missing_products.0.name Fiebersaft Paracetamol
setstate json_test 2022-06-25 17:44:30 missing_products.1.amount_missing 1.0
setstate json_test 2022-06-25 17:44:30 missing_products.1.id 20
setstate json_test 2022-06-25 17:44:30 missing_products.1.is_partly_in_stock 1
setstate json_test 2022-06-25 17:44:30 missing_products.1.name Zäpfchen Nurofen
setstate json_test 2022-06-25 17:44:30 overdue_products.0.amount 2
setstate json_test 2022-06-25 17:44:30 overdue_products.0.amount_aggregated 2
setstate json_test 2022-06-25 17:44:30 overdue_products.0.amount_opened 1
setstate json_test 2022-06-25 17:44:30 overdue_products.0.amount_opened_aggregated 1
setstate json_test 2022-06-25 17:44:30 overdue_products.0.best_before_date 2020-08-30
setstate json_test 2022-06-25 17:44:30 overdue_products.0.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.0.is_aggregated_amount 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.active 1
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.calories 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.cumulate_min_stock_amount_of_sub_products 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.default_best_before_days 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.default_best_before_days_after_freezing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.default_best_before_days_after_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.default_best_before_days_after_thawing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.default_consume_location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.default_stock_label_type 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.description <p>Bei Schwindel, Übelkeit und Erbrechen<br /></p>
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.enable_tare_weight_handling 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.hide_on_stock_overview 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.min_stock_amount 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.move_on_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.name Vomacur
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.no_own_stock 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.not_check_stock_fulfillment_for_recipes 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.parent_product_id 24
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.picture_file_name
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.product_group_id 1
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.qu_factor_purchase_to_stock 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.qu_id_purchase 4
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.qu_id_stock 4
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.quick_consume_amount 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.row_created_timestamp 2022-06-25 10:25:28
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.shopping_location_id
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.should_not_be_frozen 0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.tare_weight 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product.treat_opened_as_out_of_stock 1
setstate json_test 2022-06-25 17:44:30 overdue_products.0.product_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.0.value 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.amount 3
setstate json_test 2022-06-25 17:44:30 overdue_products.1.amount_aggregated 3
setstate json_test 2022-06-25 17:44:30 overdue_products.1.amount_opened 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.amount_opened_aggregated 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.best_before_date 2020-12-30
setstate json_test 2022-06-25 17:44:30 overdue_products.1.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.1.is_aggregated_amount 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.active 1
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.calories 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.cumulate_min_stock_amount_of_sub_products 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.default_best_before_days 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.default_best_before_days_after_freezing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.default_best_before_days_after_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.default_best_before_days_after_thawing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.default_consume_location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.default_stock_label_type 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.description <p>Schnupfen und Nasentropfen<br /></p>
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.enable_tare_weight_handling 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.hide_on_stock_overview 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.id 5
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.min_stock_amount 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.move_on_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.name Otriven
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.no_own_stock 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.not_check_stock_fulfillment_for_recipes 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.parent_product_id 22
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.picture_file_name
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.product_group_id 1
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.qu_factor_purchase_to_stock 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.qu_id_purchase 4
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.qu_id_stock 4
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.quick_consume_amount 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.row_created_timestamp 2022-06-25 10:27:54
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.shopping_location_id
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.should_not_be_frozen 0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.tare_weight 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product.treat_opened_as_out_of_stock 1
setstate json_test 2022-06-25 17:44:30 overdue_products.1.product_id 5
setstate json_test 2022-06-25 17:44:30 overdue_products.1.value 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.amount 3
setstate json_test 2022-06-25 17:44:30 overdue_products.2.amount_aggregated 3.0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.amount_opened 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.amount_opened_aggregated 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.best_before_date 2021-03-30
setstate json_test 2022-06-25 17:44:30 overdue_products.2.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.2.is_aggregated_amount 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.active 1
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.calories 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.cumulate_min_stock_amount_of_sub_products 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.default_best_before_days 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.default_best_before_days_after_freezing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.default_best_before_days_after_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.default_best_before_days_after_thawing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.default_consume_location_id
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.default_stock_label_type 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.description
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.enable_tare_weight_handling 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.hide_on_stock_overview 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.id 16
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.min_stock_amount 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.move_on_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.name Zinkoxidsalbe
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.no_own_stock 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.not_check_stock_fulfillment_for_recipes 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.parent_product_id
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.picture_file_name
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.product_group_id 1
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.qu_factor_purchase_to_stock 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.qu_id_purchase 4
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.qu_id_stock 4
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.quick_consume_amount 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.row_created_timestamp 2022-06-25 10:54:22
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.shopping_location_id
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.should_not_be_frozen 0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.tare_weight 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product.treat_opened_as_out_of_stock 1
setstate json_test 2022-06-25 17:44:30 overdue_products.2.product_id 16
setstate json_test 2022-06-25 17:44:30 overdue_products.2.value 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.amount 2
setstate json_test 2022-06-25 17:44:30 overdue_products.3.amount_aggregated 2
setstate json_test 2022-06-25 17:44:30 overdue_products.3.amount_opened 1
setstate json_test 2022-06-25 17:44:30 overdue_products.3.amount_opened_aggregated 1
setstate json_test 2022-06-25 17:44:30 overdue_products.3.best_before_date 2020-10-30
setstate json_test 2022-06-25 17:44:30 overdue_products.3.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.3.is_aggregated_amount 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.active 1
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.calories 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.cumulate_min_stock_amount_of_sub_products 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.default_best_before_days 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.default_best_before_days_after_freezing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.default_best_before_days_after_open 120
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.default_best_before_days_after_thawing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.default_consume_location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.default_stock_label_type 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.description
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.enable_tare_weight_handling 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.hide_on_stock_overview 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.id 17
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.min_stock_amount 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.move_on_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.name Salbubronch
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.no_own_stock 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.not_check_stock_fulfillment_for_recipes 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.parent_product_id 23
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.picture_file_name
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.product_group_id 1
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.qu_factor_purchase_to_stock 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.qu_id_purchase 4
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.qu_id_stock 4
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.quick_consume_amount 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.row_created_timestamp 2022-06-25 10:58:12
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.shopping_location_id
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.should_not_be_frozen 0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.tare_weight 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product.treat_opened_as_out_of_stock 1
setstate json_test 2022-06-25 17:44:30 overdue_products.3.product_id 17
setstate json_test 2022-06-25 17:44:30 overdue_products.3.value 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.amount 1
setstate json_test 2022-06-25 17:44:30 overdue_products.4.amount_aggregated 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.amount_opened 1
setstate json_test 2022-06-25 17:44:30 overdue_products.4.amount_opened_aggregated 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.best_before_date 2022-01-30
setstate json_test 2022-06-25 17:44:30 overdue_products.4.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.4.is_aggregated_amount 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.active 1
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.calories 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.cumulate_min_stock_amount_of_sub_products 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.default_best_before_days 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.default_best_before_days_after_freezing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.default_best_before_days_after_open 180
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.default_best_before_days_after_thawing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.default_consume_location_id
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.default_stock_label_type 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.description <p>Fiebersaft<br /></p>
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.enable_tare_weight_handling 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.hide_on_stock_overview 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.id 18
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.min_stock_amount 1
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.move_on_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.name Fiebersaft Paracetamol
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.no_own_stock 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.not_check_stock_fulfillment_for_recipes 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.parent_product_id
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.picture_file_name
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.product_group_id 1
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.qu_factor_purchase_to_stock 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.qu_id_purchase 4
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.qu_id_stock 4
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.quick_consume_amount 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.row_created_timestamp 2022-06-25 11:01:26
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.shopping_location_id
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.should_not_be_frozen 0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.tare_weight 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product.treat_opened_as_out_of_stock 1
setstate json_test 2022-06-25 17:44:30 overdue_products.4.product_id 18
setstate json_test 2022-06-25 17:44:30 overdue_products.4.value 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.amount 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.amount_aggregated 5.0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.amount_opened 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.amount_opened_aggregated 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.best_before_date 2020-12-30
setstate json_test 2022-06-25 17:44:30 overdue_products.5.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.5.is_aggregated_amount 1
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.active 1
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.calories 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.cumulate_min_stock_amount_of_sub_products 1
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.default_best_before_days 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.default_best_before_days_after_freezing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.default_best_before_days_after_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.default_best_before_days_after_thawing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.default_consume_location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.default_stock_label_type 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.description
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.enable_tare_weight_handling 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.hide_on_stock_overview 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.id 22
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.min_stock_amount 1
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.move_on_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.name SA Nasentropfen 
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.no_own_stock 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.not_check_stock_fulfillment_for_recipes 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.parent_product_id
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.picture_file_name
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.product_group_id
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.qu_factor_purchase_to_stock 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.qu_id_purchase 4
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.qu_id_stock 4
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.quick_consume_amount 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.row_created_timestamp 2022-06-25 11:12:06
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.shopping_location_id
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.should_not_be_frozen 0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.tare_weight 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product.treat_opened_as_out_of_stock 1
setstate json_test 2022-06-25 17:44:30 overdue_products.5.product_id 22
setstate json_test 2022-06-25 17:44:30 overdue_products.5.value 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.amount 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.amount_aggregated 5.0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.amount_opened 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.amount_opened_aggregated 2.0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.best_before_date 2020-10-30
setstate json_test 2022-06-25 17:44:30 overdue_products.6.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.6.is_aggregated_amount 1
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.active 1
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.calories 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.cumulate_min_stock_amount_of_sub_products 1
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.default_best_before_days 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.default_best_before_days_after_freezing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.default_best_before_days_after_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.default_best_before_days_after_thawing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.default_consume_location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.default_stock_label_type 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.description
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.enable_tare_weight_handling 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.hide_on_stock_overview 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.id 23
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.min_stock_amount 1
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.move_on_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.name SA Hustensaft 
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.no_own_stock 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.not_check_stock_fulfillment_for_recipes 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.parent_product_id
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.picture_file_name
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.product_group_id
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.qu_factor_purchase_to_stock 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.qu_id_purchase 4
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.qu_id_stock 4
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.quick_consume_amount 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.row_created_timestamp 2022-06-25 11:12:50
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.shopping_location_id
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.should_not_be_frozen 0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.tare_weight 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product.treat_opened_as_out_of_stock 1
setstate json_test 2022-06-25 17:44:30 overdue_products.6.product_id 23
setstate json_test 2022-06-25 17:44:30 overdue_products.6.value 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.amount 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.amount_aggregated 3.0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.amount_opened 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.amount_opened_aggregated 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.best_before_date 2020-08-30
setstate json_test 2022-06-25 17:44:30 overdue_products.7.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.7.is_aggregated_amount 1
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.active 1
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.calories 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.cumulate_min_stock_amount_of_sub_products 1
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.default_best_before_days 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.default_best_before_days_after_freezing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.default_best_before_days_after_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.default_best_before_days_after_thawing 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.default_consume_location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.default_stock_label_type 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.description
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.due_type 1
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.enable_tare_weight_handling 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.hide_on_stock_overview 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.id 24
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.location_id 4
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.min_stock_amount 1
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.move_on_open 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.name SA Übelkeit 
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.no_own_stock 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.not_check_stock_fulfillment_for_recipes 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.parent_product_id
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.picture_file_name
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.product_group_id
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.qu_factor_purchase_to_stock 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.qu_id_purchase 4
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.qu_id_stock 4
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.quick_consume_amount 1.0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.row_created_timestamp 2022-06-25 11:14:38
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.shopping_location_id
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.should_not_be_frozen 0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.tare_weight 0.0
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product.treat_opened_as_out_of_stock 1
setstate json_test 2022-06-25 17:44:30 overdue_products.7.product_id 24
setstate json_test 2022-06-25 17:44:30 overdue_products.7.value 0


Einfacher geht es doch gar nicht?
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

Kharim

Weil es mir da nicht gelingt, eine vernünftige Rückmeldung zu bekommen.
Vermutlich durch den nötigen API Key....

Log:
2022.06.26 13:58:08 5: HttpUtils url=http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14
2022.06.26 13:58:08 4: IP: 192.168.xxx.xxx -> 192.168.xxx.xxx
2022.06.26 13:58:08 5: HttpUtils request header:
GET /api/stock/volatile?due_soon_days=14 HTTP/1.0
Host: 192.168.xxx.xxx:9283
User-Agent: fhem
Accept-Encoding: gzip,deflate

Accept: application/json
Accept-Charset: utf-8, iso-8859-1

2022.06.26 13:58:08 4: http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14: HTTP response code 401
2022.06.26 13:58:08 5: HttpUtils http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14: Got data, length: 0
2022.06.26 13:58:08 5: HttpUtils response header:
HTTP/1.1 401 Unauthorized
Server: nginx/1.20.2
Date: Sun, 26 Jun 2022 11:58:08 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
X-Powered-By: PHP/8.0.13
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: *
2022.06.26 13:58:08 4: [grocy2] api encoding is UTF-8, designated encoder is utf-8-strict



Device:
Internals:
   API_LAST_RES 1656244800.16419
   API__LAST_MSG invalid server response
   DEF        http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14
   FUUID      62b84962-f33f-8ab7-46cc-e2533cf93dd8bb66
   NAME       grocy2
   NEXT       2022-06-26 15:00:00
   NR         19461
   SECRETS    GROCY-API-KEY
   SOURCE     http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14 (401)
   STATE      ???
   SVN        22987 2020-10-18 13:26:05 UTC
   TYPE       JsonMod
   CONFIG:
     IN_REQUEST 0
     SOURCE     http://192.168.xxx.xxx:9283/api/stock/volatile?due_soon_days=14
     SECRET:
Attributes:
   room       Grocy
   verbose    5


Es gibt ja hier keinen requestHeader, sondern nur dieses secret...das will aber irgendwie nicht....
Raspberry Pi 2 + Minibian + 2x MAX Cube CUN (868/433Mhz) + Thermostate + Fensterkontakte + Taster+RGB-LED Band über pigpiod + TFA Sensoren 30.3169/3125
Raspberry Pi 2 + Minibian +Z-Wave (USB) + Bewegungsmelder + Fensterkontakt + Sirene + SMS Steuer-/Benachrichtigung (ohne Internet)

betateilchen

Zitat von: Kharim am 26 Juni 2022, 14:01:57
Weil es mir da nicht gelingt, eine vernünftige Rückmeldung zu bekommen.
Vermutlich durch den nötigen API Key....

Entweder gibst Du den API Key einfach in der URL mit


defmod grocy JsonMod https://<myGrocyServer>/api/stock?GROCY-API-KEY=eJLluu0x...


oder Du verwendest das Attribut httpHeader


defmod grocy JsonMod https://<myGrocyServer>/api/stock
attr grocy httpHeader GROCY-API-KEY: eJLluu0x...


Das funktioniert beides einwandfrei.

Zitat von: Kharim am 26 Juni 2022, 14:01:57
Es gibt ja hier keinen requestHeader

Doch, gibt es. Siehe zweite Variante.

Die Variante mit dem secret funktioniert bei mir auch nicht dauerhaft zuverlässig, deshalb habe ich den APIkey in das Attribut gepackt.
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!

Kharim

Ah...ich danke dir.
Dann werde ich das noch einmal umbauen....

Meine Fehler oben beim HTTPMOD habe ich nun doch noch gefunden...
Nicht nach "name" suchen, sondern nach "missing_products_[0-9]{2}_name"

Keine Ahnung ob typisch JSON oder Anwendungsfall, aber man muss quasi den "Pfad" angeben und dann auch noch per RegEx durchzählen.
Raspberry Pi 2 + Minibian + 2x MAX Cube CUN (868/433Mhz) + Thermostate + Fensterkontakte + Taster+RGB-LED Band über pigpiod + TFA Sensoren 30.3169/3125
Raspberry Pi 2 + Minibian +Z-Wave (USB) + Bewegungsmelder + Fensterkontakt + Sirene + SMS Steuer-/Benachrichtigung (ohne Internet)

betateilchen

Zitat von: Kharim am 26 Juni 2022, 14:52:04
aber man muss quasi den "Pfad" angeben und dann auch noch per RegEx durchzählen.

Den Pfad musst Du bei JsonMod auch angeben, aber das Durchzählen übernimmt das device glücklicherweise selbst.

Hier ein funktionierendes Beispiel, vielleicht hilft es Dir zum Verständnis:


defmod grocy JsonMod https://<myGrocyServer>/api/stock
attr grocy httpHeader GROCY-API-KEY: eJLluu0x...
attr grocy interval 7 * * * *
attr grocy readingList multi(jsonPath('$.[*]'),property('product.name'),property('amount'))


Die Erzeugung der readings läßt sich natürlich beliebig komplex ausbauen.


---
-----------------------
Formuliere die Aufgabe möglichst einfach und
setze die Lösung richtig um - dann wird es auch funktionieren.
-----------------------
Lesen gefährdet die Unwissenheit!