Code: Select all
2021-03-02 07:37:42.427 SQL Logger Error exception trying to insert row into table device_history_1922093003 ("HE Kitchen - Motion Fridge") -- unable to modify table
2021-03-02 07:37:42.427 SQL Logger Error ERROR: column "illuminance_ui" specified more than once at character 89
2021-03-02 07:37:42.427 SQL Logger Error INSERT INTO device_history_1922093003 ("batterylevel", "illuminance", "illuminance_ui", "illuminance_ui", "onoffstate") VALUES (%s, %s, %s, %s, %s);
The code snippet is as follows:
Code: Select all
# Illuminance State
if bool(dev.pluginProps.get("uspIlluminance", False)):
illuminance_state = self.getDeviceStateDictForNumberType(u"illuminance", u"Illuminance Changed", u"Illuminance")
if illuminance_state not in state_list:
state_list.append(illuminance_state)
illuminance_ui_state = self.getDeviceStateDictForStringType(u"illuminance_ui", u"Illuminance Changed", u"Illuminance")
if illuminance_ui_state not in state_list:
state_list.append(illuminance_ui_state)
I suspect the SQL Logger error is caused by the illuminance.ui being renamed to illuminance_ui prior to inserting the record, which causes a duplicate error as the illuminance_ui already exists.
So, I am not sure why the illuminance.ui is being created and/or what Indigo uses a full stop for in a state name.
I have worked around the issue by renaming the illuminance_ui to illuminanceUi which actually is probably more akin to the Indigo standard of using Title case.