richardwillars / thinglator

Provides a uniform interface for interacting with IOT and home automation devices
MIT License
19 stars 4 forks source link

How do I know the type and driver? #51

Open ameyer opened 6 years ago

ameyer commented 6 years ago

In the documentation I see this:

GET discover/:type/:driver

E.g. GET discover/speaker/sonos

But how do I know the type and driver for the aeotec-multisensor?

ameyer commented 6 years ago

I was able to kinda figure out something.... maybe? http://localhost:3003/discover/thinglator-driver-aeotec-multisensor

I just get a blank array. Should I expect to see my multisensor? - I see a lot of dada coming through in terminal, jut nothing from the API

ameyer commented 6 years ago

I reloaded it 100x and I see some data now

richardwillars commented 6 years ago

Sorry, I'll update the docs, they're really misleading. This is the order of play for using a driver:

  1. Install the driver using yarn add thinglator-driver-XXX
  2. Reboot thinglator yarn dev
  3. Call GET /authenticate/:driver - if it returns an empty array skip to no.5
  4. Call POST /authenticate/:driver/:stepId - until each authentication step is completed
  5. Zwave devices have an additional step at this point if they're not already on your Zwave network. Call GET /pairingMode and then hit the button on the back of your zwave device to pair it to the network. You have up to 1 minute to pair the device before it leaves pairing mode.
  6. Call GET /discover/:driver - that'll find any devices and return info about them

At this point the device is added and it's good to go. You can get info about a device by calling GET /devices You can control the device by calling POST /device/:deviceId/:command

In your case the multisensor doesn't have any commands, it just has events, so you can do this: GET /event/device - returns a list of all events Thinglator is receiving and processing in the past 2 days GET /event/latestCommands - this is the most useful one. It gets the latest value of each event. So if you're receiving lots of temperature updates from the multisensor, it'll only return the latest one.

With the documentation being completely out of date I feel really bad about how fustrating it must be trying to get things up and running. Happy to have a session on skype or google hangouts to get you up and running if that helps?

ameyer commented 6 years ago

Thanks! It hasn't been too bad, iv'e been poking around the code to figure out a few commands. I think my biggest mistake was not reading how to pair the devices. I have the Aeotec zwave stick and pairing it is a little weird.

Have you had any luck getting motion events from this sensor? I think I get everything but that. In latestCommands - Some sort of alarm event does print out in the terminal.

valueChanged 2 113 0 { value_id: '2-113-1-0',
  node_id: 2,
  class_id: 113,
  type: 'byte',
  genre: 'user',
  instance: 1,
  index: 0,
  label: 'Alarm Type',
  units: '',
  help: '',
  read_only: true,
  write_only: false,
  min: 0,
  max: 255,
  is_polled: false,
  value: 0 }

valueChanged 2 113 1 { value_id: '2-113-1-1',
  node_id: 2,
  class_id: 113,
  type: 'byte',
  genre: 'user',
  instance: 1,
  index: 1,
  label: 'Alarm Level',
  units: '',
  help: '',
  read_only: true,
  write_only: false,
  min: 0,
  max: 255,
  is_polled: false,
  value: 0 }
richardwillars commented 5 years ago

Sorry for the delay replying to this, completely forgot it was here. I've been running the motion sensor in my house for around a year without issues. Did you manage to solve this? Perhaps there's some slight variations between devices in different countries etc