Can't replace Device

Subforum for general discussions. Do not dump your questions/problems here, but try to find the subforum where it belongs!
Post Reply
EDsteve
Posts: 38
Joined: Thursday 13 October 2016 11:43
Target OS: Linux
Domoticz version:
Contact:

Can't replace Device

Post by EDsteve » Saturday 19 May 2018 12:11

Hi,

since one year i have a BME280 with temperature, humidity and pressure running which sends data via NRF24L01+ to Domoticz.
Now i changed all my sensors to MQTT via ESP8266. So when i disable my serial gateway all the devices connected to the serial gateway disappear in Domoticz which is ok. But i want to keep my weather data from the last year and the MQTT BME280 should add the data to the existing Weather device from the NRF24L01+.

I thought no problem. Domoticz has the "replace" function..... Replace old weather device with new one. But that doesn't work. I already add a new virtual device for Temp,Hum,Baro and when i press "Replace" on the old device it says:

No devices to Transfer too!

What do i do now? How can i keep my old weather data?

User avatar
waaren
Posts: 1350
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Can't replace Device

Post by waaren » Saturday 19 May 2018 12:36

I was not aware of the replace function. Thanks for that.
I played a little bit with it and what I see is that it only comes up with devices to replace to, if they are the same type/ subtype. So your new device must be the same typ/ subtype as your old one.


What I used before to copy history data from old temp device to new one is:
!! stop domoticz first and make a copy of your database, Before doing this !!

sqlite3 domoticz.db

Code: Select all

INSERT INTO Temperature_Calendar        (DeviceRowID,Temp_Min,Temp_Max,Temp_Avg,Chill_Min,Chill_Max,Humidity,Barometer,DewPoint,SetPoint_Min,SetPoint_Max,SetPoint_Avg,Date)
SELECT "New", DeviceRowID,Temp_Min,Temp_Max,Temp_Avg,Chill_Min,Chill_Max,Humidity,Barometer,DewPoint,SetPoint_Min,SetPoint_Max,SetPoint_Avg,Date
FROM Temperature_Calendar WHERE DeviceRowID = "Old";
where "Old" and "New" are the deviceID's between quotes
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

EDsteve
Posts: 38
Joined: Thursday 13 October 2016 11:43
Target OS: Linux
Domoticz version:
Contact:

Re: Can't replace Device

Post by EDsteve » Monday 21 May 2018 15:28

Very nice. I was looking for a database solution long ago.
And you are right. The subtype is different. But i guess there is no easy way to modify the subtype of a device, is there?

User avatar
waaren
Posts: 1350
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Can't replace Device

Post by waaren » Friday 25 May 2018 9:26

Ik am not aware of an easy way but you can always try to change it in the DeviceStatus table provided you have a backup and a tested restore procedure in place. Or even better; a test environment.

Verstuurd vanaf mijn ONEPLUS A3003 met Tapatalk

Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

Post Reply

Who is online

Users browsing this forum: alanlsmith and 2 guests