Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SOLVED] Not very clear documentation + issues with magnet sensor + issues with gateway #17

Open
MrTomAsh opened this issue Feb 22, 2018 · 0 comments

Comments

@MrTomAsh
Copy link

MrTomAsh commented Feb 22, 2018

Hi,

sorry for a not very technical issue, but from yesterday I'm struggling with setting up this thing and maybe the problem isn't with the code itself but with my configuration.

Please give me a clue how the config.json should look for the:

  1. Gateway as a Light
  2. Miija Magnet

I've tried to quest what parameters they require and even analyze the code but with no luck. I had issues like _device[name] is not a function or _device[name] not set...

At the moment my config.json looks like that:

{ 
	"platform": "smarthome-mijia",
 	"web": {
        	"port": 8888
      	},
	"mijia": {
        	"sids": [
          		"7812ddb22ab4"
        	],
        	"passwords": [
          		"afh7a2txrl5wb6ix"
        	],
		"devices": [
         		 {
            			"sid": "71456492",
            			"name": "Gateway LightSensor",
            			"type": "wifi",
				"ip": "192.168.0.46",
				"token": "6cb8177f4e2bae52d3d5225604e523fa",
            			"model": "gateway"
          		},
			{
            			"sid": "154d0201d822f1",
            			"name": "Magnet",
            			"type": "wifi",
            			"model": "magnet"
          		}
        	]
	
    	}
     },
     {
      "platform": "smarthome-broadlink",
      "broadlink": {
        "devices": [
         
        ]
      }
    }

Homebridge gives me that error when loading:

[smarthome-mijia] mijia init upd socket error->TypeError: this._devices[model] is not a function
home

NodeJS: 7.9.0
NPM: 5.6.0
homebridge-smartphone: 1.1.3
Homebridge: 0.4.33

It shows me now Contact Sensor, Light Sensor and Light Bulb in my Home App but it doesn't work at all. Whatever I change or do - it doesn't react.

I've marked in red squares the Mi hardware and in a blue my own. The differences in reading are horrendous when the Mi Gateway has been partly covered from the sun anyway.

img_1063
img_1064

Please give me an example.

Many thanks!


UPDATE 1

I found the first issues and solutions:

  1. config.json

devices can be an empty array like this:

"devices": [

    ]

and it's totally fine!

  1. in file kit/mijia/magnet.js on line 53 the correct code should be
    if (status == 'close') {

This fixes the issue with "always open" contact sensors

Now I want work out why I can read the LightBulb but can't set it up.


UPDATE 2

OK, I've found out what was wrong!

The key generated by the script was wrong cause for some unknown reason my password has been changed. Updating the password sort the issue with controlling the lightbulb!

I'll advise adding an error to the script if the "Invalid key" appears to double check the password as most likely it's wrong.

The last issue is that the reading from the gateway is few times too high.

Thanks!

@MrTomAsh MrTomAsh changed the title Documentation isn't clear Not very clear documentation + issues with magnet sensor + issues with gateway Feb 23, 2018
@MrTomAsh MrTomAsh changed the title Not very clear documentation + issues with magnet sensor + issues with gateway [SOLVED] Not very clear documentation + issues with magnet sensor + issues with gateway Mar 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant