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

Liftmaster Light is Not a Light #3

Closed
Horse2370 opened this issue Aug 13, 2021 · 13 comments
Closed

Liftmaster Light is Not a Light #3

Horse2370 opened this issue Aug 13, 2021 · 13 comments

Comments

@Horse2370
Copy link

I have a Liftmaster WiFi enabled opener that is registered with MyQ and appears as 3 devices.
1 - The WiFi Gateway - this is build into the opener and has a unique Serial Number
2 - The Door Opener - This also has a unique serial number
3 - The Linked Light - This has its own unique serial number

I create 3 nodes each with my login credentials and one of the serial numbers.
If I request status each returns correctly and confirms what it is and the name I configured in MyQ cloud.
The Opener Node-Red Nodes display the status under them. The Light and Gateway nodes do not.
I can open and close the doors with the "open" and "close" payload strings (no quotes)
For the Light I get this as the output from a status: (Serial Numbers Redacted)

msg.payload : Object object code: "OK" device: object href: "http://api.myqdevice.com/api/v5/accounts/443ef87b-2daa-4b76-9f04-16cd814405de/devices/XXXXXXXXXX" serial_number: "XXXXXXXXXX" device_family: "lamp" device_platform: "myq" device_type: "lamp" name: "Light" parent_device: "http://api.myqdevice.com/api/v5/accounts/443ef87b-2daa-4b76-9f04-16cd814405de/devices/YYYYYYYYYYYY" parent_device_id: "YYYYYYYYYYYY" created_date: "0001-01-01T00:00:00" state: object lamp_state: "off" lamp_subtype: "remoteledworklight" on: "http://api.myqdevice.com/api/v5/accounts/443ef87b-2daa-4b76-9f04-16cd814405de/devices/XXXXXXXXXX/on" off: "http://api.myqdevice.com/api/v5/accounts/443ef87b-2daa-4b76-9f04-16cd814405de/devices/XXXXXXXXXX/off" last_update: "2021-08-12T05:14:40.4563784Z" online: true last_status: "2021-08-12T05:54:58.7718311Z"

This confirms the serial number is a light. If I send a payload string "on" (no quotes)
I receive the following errors

MyQError: Device with serial number "XXXXXXXXXX" is not a light

Error code: ERR_MYQ_INVALID_DEVICE

I have a different integration that I'm trying to move into Node-Red with this node that controls the light, is this linked remote light (not integrated into the opener) handled differently to other opener lights?
Doors work exactly as I expected.
Light Node does not show status (The code implies it should show on or off like the doors under the node) and I cannot control.

Thanks

@dre2901
Copy link
Owner

dre2901 commented Aug 16, 2021

The underlying library (https://github.com/thomasmunduchira/myq-api) is relying on state.light_state property to control lights. based on your log, your linked light is using state.lamp_state instead. not sure whether it's a general change in apis or there are different devices (eg light and lamp). so the non-breaking way of introducing the support for "lamp" would be to fork myq-api and make the change there as well. I can try to make this change but would not be able to test as I don't have such devices at home.

@dre2901
Copy link
Owner

dre2901 commented Aug 16, 2021

I've pushed new version 0.0.3 with support for "lamp" object. so you can use "lamp_on" and "lamp_off" for them. Please try as I cannot test it myself.

@dre2901 dre2901 closed this as completed Aug 16, 2021
@Horse2370
Copy link
Author

I missed the subtle difference between light and lamp. I will update and verify the added lamp support.
Greatly appreciate your fast update. Will report back

@Horse2370
Copy link
Author

FYI, Installing 0.0.3 does not install the dependent myq-api module as 0.0.2 did: -

16 Aug 11:37:54 - [info] Installed module: node-red-contrib-myq
16 Aug 11:37:54 - [info] Added node types:
16 Aug 11:37:54 - [info]  - node-red-contrib-myq:myq-device-node : Error: Cannot find module 'myq-api'
Require stack:
- /data/node_modules/node-red-contrib-myq/myq.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/loader.js
- /usr/src/node-red/node_modules/@node-red/registry/lib/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/index.js
- /usr/src/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/src/node-red/node_modules/node-red/lib/red.js
- /usr/src/node-red/node_modules/node-red/red.js
16 Aug 11:57:36 - [info] Stopping modified nodes
16 Aug 11:57:36 - [info] Stopped modified nodes
16 Aug 11:57:36 - [info] Waiting for missing types to be registered:
16 Aug 11:57:36 - [info]  - myq-device-node```

@dre2901
Copy link
Owner

dre2901 commented Aug 16, 2021

I have no issues on brand new node-red (via docker). The 0.0.3 is using my own fork of myq-api which is @dre2901/myq-api:
"dependencies": { "@dre2901/myq-api": "2.0.5" },
Maybe some clean up is needed on your environment. Try to uninstall and install node-red-contrib-myq

@Horse2370
Copy link
Author

Horse2370 commented Aug 16, 2021

Manually installed the myq-api npm and the Lamp Node correctly shows the lamp state underneath it
Maybe I am misunderstanding something (I'm not a developer)
I send a payload with lamp_on and receive this from the api

TypeError: api.setLampState is not a function

Using payload with string on I get the previous error about it not being a light as expected.

Will check I installed your version of myq-api

@Horse2370
Copy link
Author

Horse2370 commented Aug 16, 2021

Also running in Docker and did try removing > Restart container > Install myq > restart container - same issue - missing node
This Instance was rebuilt from new using NR 2.x over the weekend and importing my flows.
Just spun up a test NR 2.0.5 and just installed node-red-contrib-myq and same result.

@dre2901
Copy link
Owner

dre2901 commented Aug 16, 2021

yep, my fault - forgot to update reference to the new fork in one require statement, so it was still looking for the old myq-api.
I have updated the node to 0.0.4. Install works without issues now.
There is only weird behaviour of Palette Manager which does not show the latest version 0.0.4 but it does show up on web using https://flows.nodered.org/search?term=node-red-contrib-myq
So for my tests I had to install it manually npm i node-red-contrib-myq and restart node red

@Horse2370
Copy link
Author

Working in the test NR container and much closer to working. Install all good via the Palette Manager, but when I send a payload with lamp_on I get the following: -

Error message: Invalid action parameter 'Symbol(turnOn)' specified for a lamp; valid actions are MyQ.actions.lamp.TURN_ON and MyQ.actions.lamp.TURN_OFF.

Node shows correctly the status of the lamp, which it did not in version 0.0.2. If I turn it on manually and request status, its shows correctly under the node.
The lamp_on is hitting your forked myq-api but seems to be running into an issue. Or am I using the wrong payload?

Again, thank you

@dre2901
Copy link
Owner

dre2901 commented Aug 17, 2021

debug in darkness :) fixed in 0.0.5. now if I am sending lamp_on for my garage door it properly returns that it is not a lamp. try it for your lamp

@Horse2370
Copy link
Author

Debugging in the dark works like a charm!
Confirmed - Status poll works and sets label under node.
lamp_on turns on the lamp and returns status OK
lamp_off turns the lamp off and returns a status OK.
open, close, on and off all return I am not a door or a light as expected
Everything else returns detailed status

Many Thanks -- One more automation moved over into Node Red with your help.

@Horse2370
Copy link
Author

Horse2370 commented Aug 28, 2021 via email

@dre2901
Copy link
Owner

dre2901 commented Aug 30, 2021

Yes, V5 API is down. New oAuth login has to be implemented for V6. It is tracked here thomasmunduchira/myq-api#34

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

2 participants