sql from integer to real

Posted on
Mon Jan 04, 2021 11:48 am
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

sql from integer to real

I still get
Code: Select all
   SQL Logger                      modifying column "pi_00_distance" type of table device_history_51480417 ("beacon-ble bug ") from integer to REAL
with state def:
Code: Select all
         <State id="Pi_00_Distance">
         <ValueType>Float</ValueType>
         <TriggerLabel>Pi_00_Distance</TriggerLabel>
         <ControlPageLabel>Pi_00_Distance</ControlPageLabel>
         </State>

that should not happen anymore w indigo 7.5?
What am I doing wrong (lower case float) ?

Karl

Posted on
Mon Jan 04, 2021 12:48 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: sql from integer to real

Is this for an existing device or a new one? The state info in the XML is only used when a device is newly created.

Image

Posted on
Mon Jan 04, 2021 3:48 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: sql from integer to real

A new device


Sent from my iPhone using Tapatalk

Posted on
Mon Jan 04, 2021 4:32 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: sql from integer to real

The case of "Float" doesn't matter. I tested it creating a new device then immediately dumped to the Event Log the states dict and it showed as a float. Is it possible your plugin is updating the state back to integer somewhere?

Image

Posted on
Mon Jan 04, 2021 5:01 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

Re: sql from integer to real

Converting back to int? How?

There is No xml stuff in plugin.py
Storing an int value would do it?


Sent from my iPhone using Tapatalk

Posted on
Mon Jan 04, 2021 6:19 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: sql from integer to real

kw123 wrote:
Storing an int value would do it?

Yes, updating states is dynamic and will change the type based on the new value type passed in to the update call.

Image

Posted on
Mon Jan 04, 2021 7:16 pm
kw123 offline
User avatar
Posts: 8363
Joined: May 12, 2013
Location: Dallas, TX

sql from integer to real

yes that was it: initialized with 99999 instead of 99999.

works fine now

thanks

Karl

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests