Hi sim0nx,
I tried your code and I am receiving the following error when using
items = openhab.fetch_all_items()
>>> ================================ RESTART ================================
>>>
Traceback (most recent call last):
File "/Users/Guest/Public/python-openhab-master/test.py", line 34, in <module>
items = openhab.fetch_all_items()
File "/Users/Guest/Public/python-openhab-master/openhab/openhab.py", line 145, in fetch_all_items
items[i['name']] = self.json_to_item(i)
File "/Users/Guest/Public/python-openhab-master/openhab/openhab.py", line 180, in json_to_item
return NumberItem(self, json_data)
File "/Users/Guest/Public/python-openhab-master/openhab/items.py", line 45, in __init__
self.init_from_json(json_data)
File "/Users/Guest/Public/python-openhab-master/openhab/items.py", line 57, in init_from_json
self.__set_state(json_data['state'])
File "/Users/Guest/Public/python-openhab-master/openhab/items.py", line 100, in __set_state
self._state = self._parse_rest(value)
File "/Users/Guest/Public/python-openhab-master/openhab/items.py", line 198, in _parse_rest
return float(value)
ValueError: could not convert string to float: gruen
The item probably causing this error has the following json representation.
"link": "http://nac:8080/rest/items/Alarm_scharf_Diode",
"state": "gruen",
"stateDescription": {
"pattern": "",
"readOnly": false,
"options": []
},
"type": "Number",
"name": "Alarm_scharf_Diode",
"label": "Alarm scharf",
"category": "shield",
"tags": [],
"groupNames": [
"Diodendisplay"
]
},
I am using a transformation file containing the following contents
0=aus
1=rot
2=gruen
3=orange
NULL=NULL
It seems that the json file is containing the transformed value and not the numerical value which is 2 in my example