Giter Site home page Giter Site logo

Error: Invalid URI about homebridge-meross HOT 23 CLOSED

bwp91 avatar bwp91 commented on May 29, 2024
Error: Invalid URI

from homebridge-meross.

Comments (23)

dylanfrankcom avatar dylanfrankcom commented on May 29, 2024 1

I think the issue is with your config file. I believe JSON strings can only be declared with double quotes as opposed to single quotes and almost every key/value pair must be wrapped with double quotes. I think there is an issue with the layout in general as well. If you want you can post your entire config with a couple things redacted and I can look over it if you would like? The bridge's mac-address username value as well as any device's messageID and sign values can be removed or edited. If you don't feel comfortable posting feel free to message me on twitter and we can figure something out. 🙂

Here's an example from my config that can hopefully help.

"accessories": [
    {
        "accessory": "Meross",
        "name": "Bedroom lamp",
        "deviceUrl": "http://192.168.101.xxx",
        "hardwareVersion": 1,
        "channel": 0,
        "messageId": "xxx",
        "timestamp": 1000000048,
        "sign": "xxx"
    }
]

from homebridge-meross.

arohl avatar arohl commented on May 29, 2024 1

OK - its all working now! - thanks!!

I hand edited the config to add the http and also to simplify it (it didn't work with the http added to my previous config); it looks like

"accessories": [
    {
        "accessory": "Meross",
        "name": "amp",
        "deviceUrl": "http://192.168.178.139",
        "hardwareVersion": 2,
        "channel": 0,
        "messageId": "17cfbf76eb100a721715de2c617f87fd",
        "timestamp": 1587218340,
        "sign": "XXXXXXXXXX"
    }
],

from homebridge-meross.

arohl avatar arohl commented on May 29, 2024 1

Can confirm it works!

Once you have updated the repo, I just need to

sudo npm install -g --homebridge-meross

to get back on the release version?

from homebridge-meross.

arohl avatar arohl commented on May 29, 2024 1

from homebridge-meross.

donavanbecker avatar donavanbecker commented on May 29, 2024

@castorpollux285 are you using config-ui-x?

from homebridge-meross.

arohl avatar arohl commented on May 29, 2024

@donavanbecker Is it possible to reopen this? I have the meross plug "mss310" and get a similar error (although I got my parameters using https://github.com/bapirex/meross-api/). I did use config-ui-x.

Many thanks

Andrew

[4/16/2020, 10:07:09 PM] [Meross] Failed to POST to the Meross Plug: Error: Invalid URI "undefined/config"
    at Request.init (/usr/local/lib/node_modules/homebridge-meross/node_modules/request/request.js:273:31)
    at new Request (/usr/local/lib/node_modules/homebridge-meross/node_modules/request/request.js:127:8)
    at request (/usr/local/lib/node_modules/homebridge-meross/node_modules/request/index.js:53:10)
    at /usr/local/lib/node_modules/homebridge-meross/index.js:9:5
    at new Promise (<anonymous>)
    at doRequest (/usr/local/lib/node_modules/homebridge-meross/index.js:8:10)
    at MerossPlug.getOnCharacteristicHandler (/usr/local/lib/node_modules/homebridge-meross/index.js:175:24)
    at Characteristic.On.emit (events.js:310:20)
    at Characteristic.On.Characteristic.getValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Characteristic.js:164:10)
    at Bridge.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:771:20)
[4/16/2020, 10:07:09 PM] [Meross] Retrieved status unsuccessfully.
[4/16/2020, 10:07:09 PM] [Meross] calling getOnCharacteristicHandler: false
[4/16/2020, 10:07:11 PM] [Meross] {
  name: 'Meross',
  accessories: [
    {
      name: 'Amp',
      deviceUrl: '192.168.178.139',
      hardwareVersion: 2,
      channel: 0,
      messageId: 'XXX',
      timestamp: XXX,
      sign: 'XXX'
    }
  ],
  accessory: 'Meross'
} undefined/config

from homebridge-meross.

dylanfrankcom avatar dylanfrankcom commented on May 29, 2024

@castorpollux285 @arohl

Could you both edit the deviceUrl in your config file to include a http:// header and see if that fixes the issue.

Ex. deviceUrl: 'http://192.168.178.139'

Be sure to restart your homebridge instance after making changes to your config.

from homebridge-meross.

arohl avatar arohl commented on May 29, 2024

Will do first thing tomorrow- it’s quite late in Perth :-)

However I did manage to get Charles on my iPhone and the POST seems very simple for this model of smart plug

{
"payload": {
"togglex": {
"onoff": 1,
"channel": 0
}
},
"header": {
"messageId": "164d94c5968c397bd17a90f1797f8650",
"method": "SET",
"from": "http://192.168.178.139/config",
"sign": "7028071d19f39430d61842b9cf303f94",
"namespace": "Appliance.Control.ToggleX",
"triggerSrc": "iOS",
"timestamp": 1587046811,
"payloadVersion": 1
}
}

from homebridge-meross.

dylanfrankcom avatar dylanfrankcom commented on May 29, 2024

Thanks for posting the payload. It will help later if the changes in your config don't. Please report back if it works!

from homebridge-meross.

arohl avatar arohl commented on May 29, 2024

Got the same error
[Meross] Failed to POST to the Meross Plug: Error: Invalid URI "undefined/config" at Request.init (/usr/local/lib/node_modules/homebridge-meross/node_modules/request/request.js:273:31) at new Request (/usr/local/lib/node_modules/homebridge-meross/node_modules/request/request.js:127:8) at request (/usr/local/lib/node_modules/homebridge-meross/node_modules/request/index.js:53:10) at /usr/local/lib/node_modules/homebridge-meross/index.js:9:5 at new Promise (<anonymous>) at doRequest (/usr/local/lib/node_modules/homebridge-meross/index.js:8:10) at MerossPlug.getOnCharacteristicHandler (/usr/local/lib/node_modules/homebridge-meross/index.js:175:24) at Characteristic.On.emit (events.js:310:20) at Characteristic.On.Characteristic.getValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Characteristic.js:164:10) at Bridge.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:771:20) [4/17/2020, 12:32:14 PM] [Meross] Retrieved status unsuccessfully. [4/17/2020, 12:32:14 PM] [Meross] calling getOnCharacteristicHandler: false [4/17/2020, 12:32:16 PM] [Meross]
{
name: 'Meross',
accessories: [
{
name: 'Amp',
deviceUrl: 'http://192.168.178.139',
hardwareVersion: 2,
channel: 0,
messageId: 'XXXXX',
timestamp: 1587043076,
sign: 'XXXXXX'
}
],
accessory: 'Meross'
} undefined/config

from homebridge-meross.

arohl avatar arohl commented on May 29, 2024

I think its much harder than this unfortunately. I have been playing around with this plug and can now send it data but I always get an error.

{
header: {
messageId: 'c3222c7d2b9163fe2968f06c45338a9f',
namespace: 'Appliance.Control.ToggleX',
method: 'ERROR',
payloadVersion: 1,
from: '/appliance/19090313123344251h1448e1e900e715/publish',
timestamp: 1587132239,
timestampMs: 245,
sign: '7c8b932061c9cea12444284cc7d2626c'
},
payload: { error: { code: 5001, detail: 'sign error' } }

When I look at what is being sent from the Meross App to the plug, the sign changes everytime so I am guessing that they have improved their security and until I find out how the sign is generated, I am out of luck :-(

from homebridge-meross.

dylanfrankcom avatar dylanfrankcom commented on May 29, 2024

You’re right! The sign does change with every request sent through the Meross app, however a unique sign is not required with every new payload sent. The sign is able to be reused and is why it is included in the config file. I share the same messageID, sign, and time stamp between four plugs and two different hardware revisions.

As for the security aspect, it could be that the messageID, sign, and time stamp are associated with each other and are used to form some sort of authentication on the server. I really have no idea though. They might have to be taken from the same payload to work correctly. You could try replacing the values in your config with fresh ones from a new payload.

So far, this is expected behaviour and happens on all Meross devices. This also means there is still hope and I believe your device should be able to work.

from homebridge-meross.

arohl avatar arohl commented on May 29, 2024

OK

SO here is my config (copy and pasted from web gui)

{
"bridge": {
"name": "Homebridge A578",
"username": "0E:35:C2:82:A5:78",
"port": 51901,
"pin": "XXXXXXXXX"
},
"accessories": [
{
"accessory": "CmdTriggerSwitch",
"name": "amp",
"stateful": true,
"onCmd": "/Users/andrew/src/MSS310/start_amp.sh",
"offCmd": "/Users/andrew/src/MSS310/stop_amp.sh"
},
{
"name": "Meross",
"accessories": [
{
"name": "amp2",
"deviceUrl": "192.167.178.139",
"hardwareVersion": 2,
"channel": 0,
"messageId": "17cfbf76eb100a721715de2c617f87fd",
"timestamp": 1587218340,
"sign": "XXXXXXXXX"
}
],
"accessory": "Meross"
}
],
"platforms": [
{
"name": "Config",
"port": 8581,
"platform": "config"
}
]
}

from homebridge-meross.

arohl avatar arohl commented on May 29, 2024

Note that I have got something working using CmdTriggerSwitch - it calls a shell script which in turn uses a python library I found BUT this does it via talking to the meross cloud so has a lot of latency

from homebridge-meross.

arohl avatar arohl commented on May 29, 2024

Errors still like:

[4/18/2020, 10:09:02 PM] [Meross] Failed to POST to the Meross Plug: Error: Invalid URI "undefined/config"
at Request.init (/usr/local/lib/node_modules/homebridge-meross/node_modules/request/request.js:273:31)
at new Request (/usr/local/lib/node_modules/homebridge-meross/node_modules/request/request.js:127:8)
at request (/usr/local/lib/node_modules/homebridge-meross/node_modules/request/index.js:53:10)
at /usr/local/lib/node_modules/homebridge-meross/index.js:9:5
at new Promise ()
at doRequest (/usr/local/lib/node_modules/homebridge-meross/index.js:8:10)
at MerossPlug.getOnCharacteristicHandler (/usr/local/lib/node_modules/homebridge-meross/index.js:175:24)
at Characteristic.On.emit (events.js:310:20)
at Characteristic.On.Characteristic.getValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Characteristic.js:164:10)
at Bridge. (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:771:20)

from homebridge-meross.

donavanbecker avatar donavanbecker commented on May 29, 2024

@arohl Your device url still doesn’t have http:// in front of it. Also I need to update the config.schema to match that. Sorry!

from homebridge-meross.

dylanfrankcom avatar dylanfrankcom commented on May 29, 2024

Fantastic! Was about to send you the exact same thing. Enjoy! 🙂

from homebridge-meross.

donavanbecker avatar donavanbecker commented on May 29, 2024

@arohl would you be willing to test a change that I just made to the beta branch?

from homebridge-meross.

arohl avatar arohl commented on May 29, 2024

@arohl would you be willing to test a change that I just made to the beta branch?

Sure - but you will have to give me some basic instructions on how to install beta branch

from homebridge-meross.

donavanbecker avatar donavanbecker commented on May 29, 2024

thanks,

from terminal install beta using this command:

sudo npm install -g --unsafe-perm homebridge-meross@beta

Then in your config schema, change the Device URL to just be an IP address. without the http:// in front of it. and let me know if you are still able to control your device?

Let me know if you need help installing it.

from homebridge-meross.

donavanbecker avatar donavanbecker commented on May 29, 2024

with @latest at the end just to make sure it pulls the latest from npm.

from homebridge-meross.

donavanbecker avatar donavanbecker commented on May 29, 2024

Thanks, for doing that!

from homebridge-meross.

donavanbecker avatar donavanbecker commented on May 29, 2024

Just released Version 1.1.0, if you want to give it a try.

from homebridge-meross.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.