@Dnpwwo,
Dnpwwo wrote:
I did manage to get Python to abort in Device.Update (I've pushed a fix that will be in a beta soon) but I don't think it was related to your problem.
Can you try running this plugin to see if it works for you? It adds a number of Options after the initial creation then selects one by name. You can also update the device in the web ui and it will update it back. This seems to work as expected for me.
The example plugin works, I've done some more testing on Domoticz V3.8007 and have some additional information:
Domoticz does not crash if I remove the switch, the device is than updated correctly. As soon as I add the switch (so the device is not 'unused') Domoticz crashes.
One of the selector switches does not cause a crash, its created with different options.
Switches that cause a crash are created using:
Code: Select all
Domoticz.Log("Receiver input selector device does not exist, creating device")
strSelectorNames = 'Off'
strSelectorActions = ''
for selector in self.XMLRoot.find('device').find('selectorlist'):
strSelectorNames += '|' + selector.get('name')
strSelectorActions += '|'
dictOptions = {"LevelActions": strSelectorActions, \
"LevelNames": strSelectorNames, \
"LevelOffHidden": "true", \
"SelectorStyle": "1"}
Domoticz.Device(Name=(self.XMLRoot.find('device')).find('model').text + \
' ' + zone.get('name') + " Source", Unit=MAINSOURCE, \
TypeName="Selector Switch", Switchtype=18, Image=5, \
Options = dictOptions).Create()
The switch that works correctly:
Code: Select all
Domoticz.Log("Receiver listening mode selector device does not exist, creating device")
strSelectorNames = 'Off'
strSelectorActions = ''
for control in self.XMLRoot.find('device').find('controllist'):
if (control.get('id')[0:3] == 'LMD'):
strSelectorNames += '|' + control.get('id')[4:]
strSelectorActions += '|'
dictOptions = {"LevelActions": strSelectorActions, \
"LevelNames": strSelectorNames, \
"LevelOffHidden": "true", \
"SelectorStyle": "0"}
Domoticz.Device(Name=(self.XMLRoot.find('device')).find('model').text + \
' ' + zone.get('name') + " Mode", Unit=MAINLISTENINGMODE, \
TypeName="Selector Switch", Switchtype=18, Image=5, \
Options = dictOptions).Create()
Kind regards,
Jorg