Raspi 4 4GB, raspbian buster, OH 2.5.12
OpenJDK Runtime Environment Zulu Embedded 8.25.0.76
Hi,
if I generate a block of new items via python script using OH2 rest api put command a lot of items are generated internally to OH2.
Is it possible to export this internally stored “items” to a txt file, or direct .items file please ?
Thanks for help.
Python example:
import requests
from requests.auth import HTTPBasicAuth
import json
base_url = "http://ip:8080"
auth = HTTPBasicAuth('pi', 'pw')
headers = {"Content-type": "application/json", "Accept": "application/json"}
url = base_url + "/rest/items/ai_1_IN01"
data = {"type": "Contact", "name": "ai_1_IN01", "label": "ai_1_IN01", "groupNames": ["AGVolt"], "-d": ["OPEN"]}
data = json.dumps(data)
print(data)
try:
response = requests.put(url, auth=auth, data=data, headers=headers, timeout=8)
response.raise_for_status()
print(response)
except requests.exceptions.HTTPError as errh:
print(errh)
except requests.exceptions.ConnectionError as errc:
print(errc)
except requests.exceptions.Timeout as errt:
print(errt)
except requests.exceptions.RequestException as err:
print(err)