Closed tipp88 closed 6 months ago
Please use the syntax as described in the Readme:
sendTo('influxdb.0', 'deleteRange', [
{id: 'Wasserverbrauch_gestern', start: startTimestamp, end: endTimestamp}
], result => console.log('deleted'));
/
Edit: the original comment about the Object ID was incorrect.
I thought the [] were only needed if I have array of objects. At least with the [] the error is gone, but do you get this to delete something? I have TestID in the influxdb2 database, but it won't delete them...
const startTimestamp = new Date('2024-01-01T06:00:00.000Z').getTime();
const endTimestamp = new Date('2024-01-14T06:00:00.000Z').getTime();
console.log(startTimestamp)
console.log(endTimestamp)
sendTo('influxdb.0', 'deleteRange',[
{id: 'TestID', start: startTimestamp, end: endTimestamp}],
result => console.log('deleted')
);
Timestamps should fit. But the influx data is still there:
I have recreated your use case as exactly as possible, there are no problems with deletion here.
const startTimestamp = new Date('2024-01-01T06:00:00.000Z').getTime();
const endTimestamp = new Date('2024-01-14T06:00:00.000Z').getTime();
console.log(startTimestamp)
console.log(endTimestamp)
sendTo('influxdb.1', 'deleteRange',[
{id: 'TestID', start: startTimestamp, end: endTimestamp}],
result => console.log('deleted')
);
Perhaps there is a different bucket in the influxdb.0 instance than the one in which the TestID was written?
Hi Mark,
no it is same bucket. I only have one InfluxDb instance influxdb.0. (InfluxDB v2.7.4), Adapter Version v3.2.0 Bucket is iobroker. I also checked the Token used for the instance, it is Admin Token with full permission.
Please import this simple blockly. It stores the State and should delete same afterwards....store works, delete does nothing. I have no idea why, even if the dubug log says it is deleted it is still there.
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id="PX{Rpn+h.5*l!Xz?+Y7t">datapoint</variable>
<variable id="q;{nBlV@X3WD_[aYuY47">timestamp</variable>
<variable id=",n[$TFmpRe-$N4zc[{~d">value</variable>
<variable id="}*hIpN[^$jOPU/JySw7-">ts_start</variable>
<variable id="y8G)99FN`GIuF6[5/WAN">ts_end</variable>
</variables>
<block type="procedures_defcustomnoreturn" id="OeT+,^V6W/lw:9Sf{9Od" x="-62" y="163">
<mutation statements="false">
<arg name="datapoint" varid="PX{Rpn+h.5*l!Xz?+Y7t"></arg>
<arg name="timestamp" varid="q;{nBlV@X3WD_[aYuY47"></arg>
<arg name="value" varid=",n[$TFmpRe-$N4zc[{~d"></arg>
</mutation>
<field name="NAME">StoreState</field>
<field name="SCRIPT">c2VuZFRvKCdpbmZsdXhkYi4wJywgJ3N0b3JlU3RhdGUnLCB7DQogICAgaWQ6IGRhdGFwb2ludCwNCiAgICBzdGF0ZToge3RzOiB0aW1lc3RhbXAsIHZhbDogdmFsdWUsIGFjazogZmFsc2UsIGZyb206ICdKYXZhc2NyaXB0X1Rlc3RfRGVsZXRlJ30NCn0sIHJlc3VsdCA9PiBjb25zb2xlLmxvZygnYWRkZWQnKSk=</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
</block>
<block type="procedures_defcustomnoreturn" id="52TaR@M(LY4qJ*xO}1]m" x="-62" y="188">
<mutation statements="false">
<arg name="datapoint" varid="PX{Rpn+h.5*l!Xz?+Y7t"></arg>
<arg name="ts_start" varid="}*hIpN[^$jOPU/JySw7-"></arg>
<arg name="ts_end" varid="y8G)99FN`GIuF6[5/WAN"></arg>
</mutation>
<field name="NAME">Delete</field>
<field name="SCRIPT">Y29uc3Qgc3RhcnRUaW1lc3RhbXAgPSB0c19zdGFydDsNCmNvbnN0IGVuZFRpbWVzdGFtcCA9IHRzX2VuZDsNCmNvbnNvbGUubG9nKCdTdGFydCB0aW1lIERhdGUgb2JqZWN0OiAnICtzdGFydFRpbWVzdGFtcCsgJyBEYXR1bTogJyArIGdldERhdGVPYmplY3Qoc3RhcnRUaW1lc3RhbXApKTsNCmNvbnNvbGUubG9nKCdFbmQgdGltZSBkYXRlIG9iamVjdCA6ICcgK2VuZFRpbWVzdGFtcCArICcgRGF0dW06ICcgKyBnZXREYXRlT2JqZWN0KGVuZFRpbWVzdGFtcCkpOw0KDQpzZW5kVG8oJ2luZmx1eGRiLjAnLCAnZGVsZXRlUmFuZ2UnLFsgDQogIHtpZDogZGF0YXBvaW50LCBzdGFydDogc3RhcnRUaW1lc3RhbXAsIGVuZDogZW5kVGltZXN0YW1wfV0sDQogIHJlc3VsdCA9PiBjb25zb2xlLmxvZygnZGVsZXRlZCcpDQopOw0K</field>
<comment pinned="false" h="80" w="160">Beschreibe diese Funktion …</comment>
</block>
<block type="procedures_callcustomnoreturn" id="g)%4MXDDtclK}.}/)ZIc" x="-62" y="238">
<mutation name="StoreState">
<arg name="datapoint"></arg>
<arg name="timestamp"></arg>
<arg name="value"></arg>
</mutation>
<value name="ARG0">
<block type="text" id="G)D+R7w/{3jcfD[L2zZ`">
<field name="TEXT">TestDelete</field>
</block>
</value>
<value name="ARG1">
<block type="time_get" id="d0,ka:=,W2Q`b|S?b,|+">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">object</field>
</block>
</value>
<value name="ARG2">
<block type="math_number" id="qN#e^FU=a~Gyy4d[xnNU">
<field name="NUM">101</field>
</block>
</value>
<next>
<block type="timeouts_wait" id="e@=cGDWp|ggyKQ8x04K(">
<field name="DELAY">3</field>
<field name="UNIT">sec</field>
<next>
<block type="procedures_callcustomnoreturn" id="D0;o_|DY%yX|Jt6iIL5s">
<mutation name="Delete">
<arg name="datapoint"></arg>
<arg name="ts_start"></arg>
<arg name="ts_end"></arg>
</mutation>
<value name="ARG0">
<block type="text" id="QW2e8d=HE?{xEbyECg6J">
<field name="TEXT">TestDelete</field>
</block>
</value>
<value name="ARG1">
<block type="math_arithmetic" id="2yW2s-z|?Jr7XE1__bqA">
<field name="OP">MINUS</field>
<value name="A">
<shadow type="math_number" id="9PcS9)j[Dv.QVz#i{.k4">
<field name="NUM">1</field>
</shadow>
<block type="time_get" id="*9_]43BdHkor0gV2saF;">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">object</field>
</block>
</value>
<value name="B">
<shadow type="math_number" id="(k@;Oerb_=^i/9+Igw5K">
<field name="NUM">86400000</field>
</shadow>
</value>
</block>
</value>
<value name="ARG2">
<block type="time_get" id="JO|RlG6Z7%^6XSS{1@Wq">
<mutation xmlns="http://www.w3.org/1999/xhtml" format="false" language="false"></mutation>
<field name="OPTION">object</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</xml>
Deletion only works from adapter version 4.0.2 for InfluxDB 2.x
Deletion only works from adapter version 4.0.2 for InfluxDB 2.x
I see now. Updated from Github and now of course it works. Thanks. Maybe worth to add a hint in the readme where Delete is explained, that this requires 4.0.2+
What is wrong here? Bug?
Debug mode does not have any further output than this.