Page 1 of 1

Change the hardware on existing devices

Posted: Tuesday 31 August 2021 9:40
by EddyG
I use the "SolarEdge via Web API" hardware which creates 6 devices for years now.
Lately I have several errors on that hardware which annoys me.
Now I have a python script what does exactly the same but catches the errors. So devices could be updated "error free".
The problem is that when I disable the "SolarEdge via Web API" the devices are not displayed anymore.
The question is, could I change the the hardware Idx to one of my dummy hardware?
I suppose that the Device Idx is the only key used when I update a device via an API call.
Are the any other fields that I should consider, like DeviceID, Unit.
The "SolarEdge via Web API" is using Type 243 with SubTypes 1, 8, 29 and 31 and Type 80, SubType 5
I could go for Try and Error, but it is a production system, so I ask first.
Who has the answers?

B.t.w. These are the errors, several times a day.

Code: Select all

2021-08-31 09:27:49.661 Error: Solar_GeurtsPV hardware (15) thread seems to have ended unexpectedly
2021-08-31 09:28:03.666 Error: Solar_GeurtsPV hardware (15) thread seems to have ended unexpectedly
2021-08-31 09:28:06.913 Error: Solar_GeurtsPV: Error getting http data (Equipment details)!
2021-08-31 09:28:17.677 Error: Solar_GeurtsPV hardware (15) thread seems to have ended unexpectedly

Re: Change the hardware on existing devices

Posted: Tuesday 31 August 2021 13:47
by waltervl
If they are the same devices type you can use the replace function.
Disable (not delete) the old Solaris hardware so the old are not updated anymore but not deleted. Than you can replace (edit button) the old device by the new one and the history data of the old is taken over by the new device.
See also https://www.domoticz.com/wiki/Managing_ ... ace_device

If you have run them for a longer time on both hardware (native and python) it is better to start with a new python hardware to have no overlap in history data.

If they are not the same devices you can disable (not delete) the old hardware so old data can still be reported on the not updated devices.

Re: Change the hardware on existing devices

Posted: Tuesday 31 August 2021 16:30
by EddyG
That is not what I ment.
I want to use the same devices (idx) as on my SolarEdge API hardware, but change the Hardware IDX in the device table to an Dummy Hardware by SQLite3 commands.
This way I can easy switch back as soon as the SolarEdge API hardware works normal again by doing the 'reverse' commands.

Re: Change the hardware on existing devices

Posted: Tuesday 31 August 2021 16:39
by waltervl
That is not possible without a lot of database hacking and a lot of risk. There is a post somewhere on this forum about this.
Why not using the replace function?????
If the Solaredge API is working again you can replace the devices again.....

Re: Change the hardware on existing devices

Posted: Tuesday 31 August 2021 17:00
by EddyG
Because nobody has the real answer, I decided to do it on the production system.
It just works!!!
Disable the SolarEdge API hardware and I create a new Dummy Hardware (HardwareID 39)
SQLite3 commands:

Code: Select all

UPDATE "DeviceStatus" SET "HardwareID" = 39 WHERE "HardwareID" = 15
and of course to go back:

Code: Select all

UPDATE "DeviceStatus" SET "HardwareID" = 15 WHERE "HardwareID" = 39
The new hardwareID 39 is updated by the python script every 5 minutes on the same Device idx.
That simple, it is possible, no replacing devices and so far no risk.
I think it should continue to work, because in the *_Calendar tables I see no relations to the HardwareID.

Re: Change the hardware on existing devices

Posted: Tuesday 31 August 2021 17:03
by waltervl
Well then I remembered it different, the hacking was not that complex ;-)

Re: Change the hardware on existing devices

Posted: Wednesday 01 September 2021 8:16
by EddyG
A day went by and the *_Calendar tables where updated fine.
So everything is working as it should be.

Re: Change the hardware on existing devices

Posted: Wednesday 01 September 2021 9:21
by mgugu
Looks like that question had already been answered by @waaren ...
viewtopic.php?f=28&t=36403&p=275743#p275743

Re: Change the hardware on existing devices

Posted: Wednesday 01 September 2021 9:29
by EddyG
Sharp!!! I already forgot about that post and the answer. I did not follow up yet on that Zigbee 'change' project.
So it was already far in the back of my mind where I could not reach for that info, problem comes with the years.
Glad that I did the jump here to be sure of the result.

Re: Change the hardware on existing devices

Posted: Wednesday 01 September 2021 9:40
by mgugu
@waaren is still with us !