Author Topic: Alexa echo interface to Gateway for binary state devices needs status command  (Read 473 times)

wmljames

  • Newbie
  • *
  • Posts: 3
Background on project:
I have been working on a project that uses a Moteino to drive a step motor to open a dog kennel door.  The foundation for the Moteino is the GarateMote.  The goal was to be able to open the dog kennels remotely via smartphone.  After getting the gateway to work I decided to try to interface with the Alexa echo, and I have been successful. 

Communicating to Alexa:
To communicate to the Alexa, I found a python script on Github (makermusings fauxmo) that emulates a Belkin Wemo smart plugs on the PI.  The only short-coming is that the python script only emulates smart plugs (binary on/off) but for my project it works fine: binary/on is mapped to the GarageMote Open status and all other GarageMote status metrics are mapped to binary/off.

To interface the Gateway with the python Wemo/fauxmo script, I installed a python-shell script from Github (extrabacon/python-shell) that allows running a python shell as a child process to the Gatewayís node.js platform.  I developed the API protocol to send JSON objects between the Wemo/fauxmo script and the Gateway.js nodes that control the binary/on/off and status commands.

The code can work for any gateway node that can be controlled as binary on/off switch.   There are a few places that gateway.js code needs to call the fauxmo JSON API (e.g whenever a node update occurs) and the metrics.js need to show which metrics have a binary attribute and the state 0/1. 

The code also depends on getting the current status of the node devices during initialization.

I can release the code to the project forum (assuming Felix doesnít have a problem with sharing it) but I thought it would be useful to also get the SwitchMote working first. I have been simulating the Switchmote with my Garagemote since I donít have a SwitchMote and Iím fairly close. 


My Ask:

I know the basic on/off commands for the 3-buttons on the SwitchMote (btn0:0/1), but Iím not sure what command to send to get the status (on/off) of each button switch.  For the Garage mote, the status command is [node]:STS.  Can anyone tell me what action command can be sent from the gateway to the SwitchMote and the output expected from the SwitchMote to get the on/off status of each button switch?


Felix

  • Administrator
  • Hero Member
  • *****
  • Posts: 5938
  • Country: us
    • LowPowerLab
I know the basic on/off commands for the 3-buttons on the SwitchMote (btn0:0/1), but Iím not sure what command to send to get the status (on/off) of each button switch.  For the Garage mote, the status command is [node]:STS.  Can anyone tell me what action command can be sent from the gateway to the SwitchMote and the output expected from the SwitchMote to get the on/off status of each button switch?

@wmljames - there is no status command programmed in the SwitchMote example. You can follow the pattern found in GarageMote to query the status of the 3 buttons. Perhaps something like STS[0,2].

Maybe if I get some time sometime, I can code this up. But hey give it a try.
I would also be interested in adding a SwitchMote configuration option to indicate how many buttons/relays are installed, so the SwitchMote Gateway node UI can be populated accurately when the node is added in the Gateway app.

mhaggerty

  • Newbie
  • *
  • Posts: 14
@wmljames

I just published code on GitHub that will allow control of a GarageMote (see: https://github.com/mikehagg/garagemote.alexa ).  It may help with the interface you are working on.