PatchworkBoy / homebridge-edomoticz

Domoticz Homebridge-Plugin
Other
118 stars 44 forks source link

API Calls to Domoticz depricated #265

Closed Naqua closed 9 months ago

Naqua commented 1 year ago

Hello since the last beta 15326 of domoticz the api is changed. Domoticz produces the following in the log when edomotics plugin is started. No problem yet but the api calls will soon be depricated and edomoticz wont work anymore. Please refer to https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s for the correct new api calls and please change edomoticz calls accordingly thank you.

023-06-14 22:40:36.085 Status: [WebServer] Depricated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (127.0.0.1) 2023-06-14 22:40:36.096 Status: [WebServer] Depricated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (127.0.0.1)

PvdGulik commented 11 months ago

This also is the case in de the lastest update of Domoticz. It now does not work anymore!! Please change this edomoticz plugin so it will work again.

Homebridge : v1.6.1 Node.js Versie | v18.17.0 homebridge-edomoticz v2.1.46

Domoticz: Version: 2023.2 Build Hash: 19efd039c Compile Date: 2023-07-21 17:23:44 dzVents Version: 3.1.8 Python Version: 3.9.2 (default, Mar 12 2021, 04:06:34) [GCC 10.2.1 20210110]

Domoticz log:

2023-07-25 17:07:03.791 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.101)
2023-07-25 17:07:03.802 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.101)
2023-07-25 17:07:03.811 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.101)
2023-07-25 17:07:03.826 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.101)
2023-07-25 17:07:03.838 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.101)
2023-07-25 17:07:03.848 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.101)
2023-07-25 17:07:33.585 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.101)
2023-07-25 17:07:33.599 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.101)
2023-07-25 17:07:33.610 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.101)
2023-07-25 17:07:33.622 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.101)
2023-07-25 17:07:33.637 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.101)
2023-07-25 17:07:33.650 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.101)

Homebridge log:

[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Current Temperature' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Current Relative Humidity' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Pressure' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Status Fault' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Current Temperature' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Current Relative Humidity' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Status Fault' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Air Quality' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Air Particulate Density' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'On' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'On' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'On' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:30] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'On' was slow to respond! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:31] [LGThinQ] Successfully connected to the MQTT server.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Current Temperature' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Current Relative Humidity' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Pressure' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Status Fault' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Current Temperature' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Current Relative Humidity' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Status Fault' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Air Quality' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'Air Particulate Density' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'On' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'On' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'On' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[25/07/2023, 17:07:36] [homebridge-edomoticz] This plugin slows down Homebridge. The read handler for the characteristic 'On' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
Git-Bruno commented 11 months ago

I had the same problem. In fact file 'lib/domoticz.js' has been updated to use the API calls with the correct syntax but no update was offered in the Homebridge GUI , I guess because the version was unchanged. I fixed the problem by replacing file domoticz.js in /var/lib/homebridge/node_modules/homebridge-edomoticz on my system by the updated one from the github repo. Additionally I made the same change to the file index.js for the homebridge-domoticz-selector-switch plugin (no more maintained) Hope this helps

Madcat-76310 commented 11 months ago

Hi, i've no domoticz.js file in /var/lib/homebridge/node_modules/homebridge-edomoticz [i've no homebridge-edomoticz directory...], how to replace this file ? Thanks

Git-Bruno commented 11 months ago

Hi, Maybe the location of the domoticz.js file shipped with the homebridge-edomoticz plugin is installation dependent. I assume your run Linux and have the hombridge-edomoticz plugin installed. If so, you can search for the domoticz.js file using a find command. Try 'find . -name domoticz.js'. This will search for the file in the current directory as well as in the subdirectories. You may first start from the /var and /opt and next from root if the file was not found. Hope this helps.

Madcat-76310 commented 11 months ago

I'm using a VM, my location is /domoticz/www/js, thanks for this. I've try sudo npm update -g domoticz.js => up to date in 5s... => not solved...

PvdGulik commented 11 months ago

In trying to replace the domoticz.js file I also failed. And also by trying to fully deinstall and install again I have the same results. I assumed by totally deinstall and reinstall it would be solved because I install the latest version of domoticz.js. But apparently not…

Op 1 aug. 2023 om 17:19 heeft Madcat-76310 @.***> het volgende geschreven:



I'm using a VM, my location is /domoticz/www/js, thanks for this. I've try sudo npm update -g domoticz.js => up to date in 5s... => not solved...

— Reply to this email directly, view it on GitHubhttps://github.com/PatchworkBoy/homebridge-edomoticz/issues/265#issuecomment-1660540820, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACH4FIS4N5ZXHYPFOP2LKN3XTEM7RANCNFSM6AAAAAAZJK5TFY. You are receiving this because you commented.Message ID: @.***>

Git-Bruno commented 11 months ago

@Madcat-76310 Hmm. This file is the file shipped with Domoticz. You don't want to replace it as it is used by Domoticz itself ..this is not the file part of the homebridge-edomoticz code. The domoticz.js file you are looking for should look like the one on this github repo in the lib directory. I installed the homebridge-edomoticz via the Homebridge Config UI X page on my systemConfig UI X and this created several directories among them the /var/lib/homebridge/node_modules/homebridge-edomoticz directory in my case. I run Mint. I guess the installation under a VM should produce something similar. People running Domoticz in a VM may help here.

PatchworkBoy commented 11 months ago

Your global node_modules folder is dependant on your system and how node was installed etc.

What you’ve done is overwrite Domoticz’ own JS lib, not this plug-in’s, so you’ll need to reinstall Domoticz to fix Domoticz, and then either wait for me to test and publish update to NPM (GitHub is not NPM. Just cos it’s changed here does not mean it’s changed/published to NPM yet, hence no version numbers have been changed yet), or roll back to prev version of Domoticz in the meantime, or learn how to manually update installed node_modules direct from GitHub properly rather than guess at it.

When my personal commitments give me the time to sort it, upgrade my own installs to latest, then test submitted changes thoroughly, I’ll sort it and push it up to NPM where it’ll then advertise itself as having an update available via config ui-x.

PatchworkBoy commented 11 months ago

Ps:

sudo find / -type d -name "homebridge-edomoticz"

...should tell you where all folders reside on your system called homebridge-edomoticz...

daserra23 commented 10 months ago

I just updated for the first time in a couple of years to the latest eDomoticz but the update still causes these issues.

GravityRZ commented 10 months ago

i also have this problem now after updating

akamming was so nice to update his thermostat plugin to this error would not be gennerated anymore. now it turns out that the edomoticz plugin has the same problem

i get 13 times this error exactly the amount of all the homebridge devices

please update the json strings send to domoticz

old code depreciated /json.htm?type=devices&rid=IDX

new code to use /json.htm?type=command&param=getdevices&rid=IDX

it should not be that hard to fix

2023-08-24 12:53:45.714 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.50)

DewGew commented 10 months ago

@PatchworkBoy Npm package is not uppdated with new API

PatchworkBoy commented 10 months ago

It isn't that hard to fix, but I have a severely disabled child I have to care for and a dayjob, therefore, you're all just going to have to wait til I have the time available. Sorry.

On Thursday, 24 August 2023 at 11:58:50 BST, GravityRZ ***@***.***> wrote:  

i also have this problem now after updating

akamming was so nice to update his thermostat plugin to this error would not be gennerated anymore. now it turns out that the edomoticz plugin has the same problem

i get 13 times this error exactly the amount of all the homebridge devices

please update the json strings send to domoticz

old code depreciated /json.htm?type=devices&rid=IDX

new code to use /json.htm?type=command&param=getdevices&rid=IDX

it should not be that hard to fix

2023-08-24 12:53:45.714 [WebServer] Deprecated RType (devices) for API request. Handled via fallback (getdevices), please use correct API Command! (192.168.1.50)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

GravityRZ commented 10 months ago

take your time family always comes first

Naqua commented 10 months ago

intermediate solution: (on raspberry) Download new domoticz.js from this github search for the location of edomoticz with: sudo find / -type d -name "homebridge-edomoticz" go to lib subdirectory of edomoticz directory stop homebridge with: sudo hb-service stop replace domoticz.js with the new version watch the permissions and owner are the same as the original file if neccessary change with chown and/or chmod +775 sudo hb-service start

works like a charm

GravityRZ commented 10 months ago

good workaround @Naqua and @Git-Bruno i had to do it inside a docker container but it seems to work

also it looks like this problem was solved 2 months ago but somehow did not end up in the build we download

Madcat-76310 commented 10 months ago

Hi, To do this : replace domoticz.js with the new version Which command you used ? Thanks

PvdGulik commented 10 months ago

I tried the following, but no succes:

cd /var/lib/homebridge/node_modules/homebridge-edomoticz ls -l git pull cd lib ls -l rn domoticz.j domoticz.js.old mv domoticz.j domoticz.js.old mv domoticz.js domoticz.js.old sudo mv domoticz.js domoticz.js.old ls -l git get https://github.com/PatchworkBoy/homebridge-edomoticz/blob/master/lib/domoticz.js grep https://github.com/PatchworkBoy/homebridge-edomoticz/blob/master/lib/domoticz.js cd .. ls -l cd ~ ls -l cd /var/lib/homebridge/node_modules/homebridge-edomoticz ls -l cd lib ls -l cd ~ exit

Maybe I did something wrong? Thanks!

Madcat-76310 commented 10 months ago

Same problem... i've tried git get / grep (after sudo hb-service stop), without success. edomoticz is the problem...

GravityRZ commented 10 months ago

i just downloaded the domoticz.js file from github(the raw version) so no git get command, just using the browser GUI moved it to a place which is shared with the homebridge container

terminaled into the homebridge container using the synology docker gui went to the lib subdirectory /homebridge/node_modules/homebridge-edomoticz/lib replaced the file done

Madcat-76310 commented 10 months ago

Ok, i used scp from my iMac to send the file on a Virtual Machine (Freebox Delta) after downloading the file domoticz.js on my Mac. Command used in the iMac terminal : scp domoticz.js freebox@192.168.X.YYY:/home/pi But same error message : Domoticz deprecated...

GravityRZ commented 10 months ago

/home/pi is not where homebridge is running or is it.

you need to find out where homebridge is running THIS IS NOT A DOMOTICZ PROBLEM look at the post from Naqua. findout where Homebridge is runnning, go to that directory, goto the lib directory there should be a domoticz.js file which you need to replace with the new one.

i run homebridge in a container and it looks like this

image

Madcat-76310 commented 10 months ago

Yes, /home/pi was just a step (for showing how to use scp), i've copyied domoticz.js to /homebridge/node_modules/homebridge-edomoticz/lib (after making a domoticz.js.old backup). I'm agree with you, it's not a domoticz problem. I suspect it was homebridge-edomoticz because the other plugins are all inactives.

PvdGulik commented 10 months ago

That's what I also tried, but failed. I'll try again today


Van: GravityRZ @.> Verzonden: zaterdag 26 augustus 2023 16:55 Aan: PatchworkBoy/homebridge-edomoticz @.> CC: Tebogo @.>; Comment @.> Onderwerp: Re: [PatchworkBoy/homebridge-edomoticz] API Calls to Domoticz depricated (Issue #265)

i just downloaded the domoticz.js file from github(the raw version) so no git get command, just using the browser GUI moved it to a place which is shared with the homebridge container went to the lib subdirectory /homebridge/node_modules/homebridge-edomoticz/lib replaced the file done

— Reply to this email directly, view it on GitHubhttps://github.com/PatchworkBoy/homebridge-edomoticz/issues/265#issuecomment-1694375840, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACH4FIT4DBJZC7LYP4KJLXLXXIE55ANCNFSM6AAAAAAZJK5TFY. You are receiving this because you commented.Message ID: @.***>

marktn commented 10 months ago

This is new for me, how to find the new domoticz.js file, and replace it?

This is the location, afbeelding

GravityRZ commented 10 months ago

This is new for me, how to find the new domoticz.js file, and replace it?

This is the location, afbeelding

from that directory cd lib ls -l

the domoticz.js file you see is the one you need to replace.

it looks like you are not in a container so download the correct file like decribed earlier and copy it to this lib directory looking at other people somehow git get does not work so just download it by using a browser and find a way to copy it

from here https://github.com/PatchworkBoy/homebridge-edomoticz/blob/master/lib/domoticz.js

marktn commented 10 months ago

Thanks,

Unfortunately it does not work: password never changed. did try raspberry and admin.

C:\Windows\System32>scp domoticz.js pi@192.168.1.185:lib/ pi@192.168.1.185's password: Permission denied, please try again. pi@192.168.1.185's password: Permission denied, please try again. pi@192.168.1.185's password: pi@192.168.1.185: Permission denied (publickey,password). lost connection

C:\Windows\System32>

GravityRZ commented 10 months ago

i am not familiar with linux on a pi but did you try user root otherwise try it with winscp that way you can figur out how to login first succesfully

akamming commented 10 months ago

tested the new code. i hope @PatchworkBoy finds time to publish to npm. Cause latest commit works fine for me...

I also noticed the discussion on how to fix manually above. The instructions here seem quite complicated. I would not manually copy/paste files. Here's the easy way to run from source (which includes the new .js files) , by typing the following commands on your console:

  1. sudo hb-service shell (get you into the homebridge shell)
  2. cd node_modules (gets you into the dir where the plugins are stored)
  3. rm -rf homebridge-edomoticz (removes the old plugin which was installed by npm. Not necessary if you did not install homebrdige-edomotics yet)
  4. git clone https://github.com/PatchworkBoy/homebridge-edomoticz (clones the sources to your system)
  5. cd homebridge-edomoticz (enters the dir you just downloaded)
  6. npm link (makes sure homebridge can find your plugin)
  7. exit (exits the homebridge shell) And restart homebridge to make it work.

If there are new commits you want to test, just upgrade by

  1. sudo hb-service shell (get you into the homebridge shell)
  2. cd node_modules (gets you into the dir where the plugins are stored)
  3. cd homebridge-edomoticz (enters the dir of the plugin)
  4. git pull (updates all files to latest source)
  5. exit (exits the homebridge shell)

good luck!

Madcat-76310 commented 10 months ago

Hi, I've tried the two solutions, nothing changed. I'm not lucky...

GravityRZ commented 10 months ago

Hi, I've tried the two solutions, nothing changed. I'm not lucky...

if you can not get it fixed this way your problem is not with this plugin but somewhere else. perhaps another plugin, esp's

Madcat-76310 commented 10 months ago

I'm not lucky, really 👍🏻 ERROR LOADING PLUGIN homebridge-edomoticz: [9/4/2023, 5:05:21 PM] Error: Cannot find module 'request' Require stack:

Madcat-76310 commented 10 months ago

I made a test with a Raspberry Pi 3 + Raspbian Bulleyes lite (official download) + Domoticz (without any material) + homebridge-edomoticz => error...

PatchworkBoy commented 9 months ago

Merges now published up to NPM.

Madcat-76310 commented 7 months ago

Problem solved with with [homebridge-domoticz-selector-switch] using this method : Useful if you use old and not maintened plugins

1°) Connect to Raspberry / VM / or other with ssh terminal 2°) Go to /var/lib/homebridge/node_modules/ 3°) Enter your plugin directory which give problem 4°) Use sudo nano index.js (to edit the code) 5°) Make correction using wiki : https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's 6°) Save / Close nano and reboot your system