staromeste / homebridge-http-advanced-accessory

Supports all devices on HomeBridge Platform / Bridges devices to http
Apache License 2.0
65 stars 22 forks source link

More Config Examples #15

Closed mitch7391 closed 4 years ago

mitch7391 commented 4 years ago

Hi, I was wondering if you please can add more config.json examples. In Particular I am interested in a temp sensor, thermostat and fan, but have no idea how to set them up. Thank you.

staromeste commented 4 years ago

It really depends on your device. There is no one fit all config.

On Thu, 19 Sep 2019 at 19:32, mitch7391 notifications@github.com wrote:

Hi, I was wondering if you please can add more config.json examples. In Particular I am interested in a temp sensor, thermostat and fan, but have no idea how to set them up. Thank you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/staromeste/homebridge-http-advanced-accessory/issues/15?email_source=notifications&email_token=ABBP2ML3J4IOUVI7SAKDUW3QKOZUTA5CNFSM4IYOAEYKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HMPLGVQ, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBP2MIBCTX6Z25TCSEH7ITQKOZUTANCNFSM4IYOAEYA .

mitch7391 commented 4 years ago

There must at least be a basic config to get started with? Like with the other examples you posted? If not I can provide you with the way my air con ‘gets’ and ‘sets’ data. I wanted to test small by making a temp sensor first, but the idea would be to make a thermostat and fan accessory for my air con.

mitch7391 commented 4 years ago

I am able to set commands like this (I have the full list of set commands), set temp to 23:

http://IPADDRESS:2025/setAircon?json=%7B%22ac1%22:%7B%22info%22:%7B%22setTemp%22:%2223%22%7D%7D%7D

And the get command is variants of this depending what you are after:

curl http://IPADDRESS:2025/getSystemData | jq '.aircons.ac1.zones.z01.measuredTemp'

mitch7391 commented 4 years ago

@staromeste sorry to bug you further but do you have any advice for me on how to set it up? I’d love to get this working.

mitch7391 commented 4 years ago

So I kind of gave it my best go piecing it together from different parts of your readme file and I have out together a config that is accepted:

{ "accessory": "HttpAdvancedAccessory", "service": "TemperatureSensor", "name": "Temp Sensor2", "forceRefreshDelay": 5, "debug": false, "urls": { "getCurrentTemperature": { "url": "http://192.168.0.173:2050/getSystemData", "mappers": [{ "type": "jpath", "parameters": { "jpath": "$.aircons.ac1.zones.z01.measureTemp", "index": "0" } }] } } }

This one returns the following error:

Sep 22 19:29:08 homebridge homebridge[19818]: [9/22/2019, 7:29:08 PM] [Temp Sensor2] GetState function failed: connect ECONNREFUSED 192.168.0.173:2050 Sep 22 19:29:08 homebridge homebridge[19818]: [9/22/2019, 7:29:08 PM] [Temp Sensor2] Emitter errored: Error: connect ECONNREFUSED 192.168.0.173:2050. with data undefined

Do you know what I may have done wrong in my config?

mitch7391 commented 4 years ago

@staromeste I was able to get some advice on the Homebridge sub Reddit that this error is caused by:

“ECONNREFUSED (Connection refused): No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host”

He explained that the plugin fails to connect to the IP address. He further explained that it could be something specific for my aircon controller that requires specific headers to be set when connecting. He had problems with connecting to his Daikin controller with all plugins that use a ‘Request’ library. Later someone found the solution: https://forums.whirlpool.net.au/thread/3n45mp03?p=13#r59257450

He suggested that I add try editing index.js at line 136 to add the following inside the brackets for headers:

Host: 192.168.0.173:2050,

However this or variations of it have not worked. He is not a JavaScript developer so cannot suggest much more and am not any sort of coder. I really need your help to work this one and be able to use your plugin. Can you please take a look at how I could get this to work?

staromeste commented 4 years ago

Can you post the error logs? What is your aircon brand? Does it work with a simple curl?

On Sun, 29 Sep 2019 at 05:08, mitch7391 notifications@github.com wrote:

@staromete I was able to get some advice on the Homebridge sub Reddit that this error is caused by:

“ECONNREFUSED (Connection refused): No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host”

He explained that the plugin fails to connect to the IP address. He further explained that it could be something specific for my aircon controller that requires specific headers to be set when connecting. He had problems with connecting to his Daikin controller with all plugins that use a ‘Request’ library. Later someone found the solution: https://forums.whirlpool.net.au/thread/3n45mp03?p=13#r59257450

He suggested that I add try editing index.js at line 136 to add the following inside the brackets for headers:

Host: 192.168.0.173:2050,

However this or variations of it have not worked. He is not a JavaScript developer so cannot suggest much more and am not any sort of coder. I really need your help to work this one and be able to use your plugin. Can you please take a look at how I could get this to work?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/staromeste/homebridge-http-advanced-accessory/issues/15?email_source=notifications&email_token=ABBP2MMO237BUW4KBB24K43QMALZVA5CNFSM4IYOAEYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD73G5RY#issuecomment-536243911, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBP2MO3XVHQYZVH37GQSOLQMALZVANCNFSM4IYOAEYA .

mitch7391 commented 4 years ago

Hi @staromeste, all the information you have requested is above but I’ll post again.

Error logs: Sep 22 19:29:08 homebridge homebridge[19818]: [9/22/2019, 7:29:08 PM] [Temp Sensor2] GetState function failed: connect ECONNREFUSED 192.168.0.173:2050 Sep 22 19:29:08 homebridge homebridge[19818]: [9/22/2019, 7:29:08 PM] [Temp Sensor2] Emitter errored: Error: connect ECONNREFUSED 192.168.0.173:2050. with data undefined

Works with this curl command: curl http://192.168.0.173:2025/getSystemData | jq '.aircons.ac1.zones.z01.measuredTemp'

The aircon brand is Advantage Air E-zone controller (same API as MyPlace controller by the same company). People have got the MyPlace api working through HA on those forums.

mitch7391 commented 4 years ago

@staromeste it appears that at some point when I was attempting to use your plugin I made a typo in the port for my IP address and that has been the issue. Once correcting that I now have a working temperature sensor.

mitch7391 commented 4 years ago

With this out of the way, it will now bring me back to my original question of more provided configs. I would now like to attempt to add a Thermostat and a Fan accessory, which both say are supported accessories in your list. Are you able to provide how the average/basic config for these accessories should look?

mitch7391 commented 4 years ago

@staromeste are you able to provide some guidance here? Really keen to get this working...

mitch7391 commented 4 years ago

Going to close this out as I found homebridge-cmd4 could do what I needed and will now be uninstalling this plug-in. Still think you should add config more examples for accessories your plug-in supports, but hopefully someone else has more luck in the future.