Page 4 of 9

Re: HowTo: Voice control of BCS with Amazon Alexa

Posted: Thu Mar 16, 2017 8:42 pm
by JonW
oakbarn wrote:
Thu Mar 16, 2017 2:49 pm
BTW: What is the friendly description used for?
Friendly description shows in the Alexa App on your phone. Not really used for much other than a description. The "friendly name" is the actual spoken name that you use to command thing on/off.

Re: HowTo: Voice control of BCS with Amazon Alexa

Posted: Fri Mar 17, 2017 11:13 am
by oakbarn
Assume that you have Probe_0 to Probe_7 for "applianceId" for a BCS 462.
"applianceId": "PROBE_1",

Is the assumption correct?

This is some modified code

// This example changes the setpoint at Process 1(Strike/Mash), State 1(PreHeat NS) , Output 6 (Big Mac (HLT)e).
// The value 99999 is a placeholder that gets replaced with the correct value.
{
"applianceId": "PROBE_2",
"friendlyName": "Big Mac Probe",
"friendlyDescription": "Big Mac pre-Strike Temp",
"manufacturerName": "Embedded Control Concepts",
"modelName": "BCS",
"version": "2",
"isReachable": true,
"additionalApplianceDetails": {
"extraDetail1": "",
"extraDetail2": "",
"extraDetail3": "/api/process/1/state/1/output_controllers",
"extraDetail4": JSON.stringify({"key": 6,"value": {"setpoint": 99999}})
},
"actions": [
"getTargetTemperature",
"getTemperatureReading",
"setTargetTemperature",
"incrementTargetTemperature",
"decrementTargetTemperature"
]
},

Re: HowTo: Voice control of BCS with Amazon Alexa

Posted: Fri Mar 17, 2017 11:19 am
by JonW
Correct.

From the comments in the file:
* The applianceId field must follow a specified format for proper handling.
* PROCESS_x = used for all processes. Replace x with the process number.
* OUTPUT_x = used for all outputs. Replace x with the output number.
* PROBE_x = used for all temp probes. Replace x with the probe number.
* CUSTOM_xyz = used for custom BCS commands. Replace xyz with unique text.

Re: HowTo: Voice control of BCS with Amazon Alexa

Posted: Fri Mar 17, 2017 11:27 am
by oakbarn
What is the

"applianceId": PROBE_3_STRIKE

in the next example. I am not clear on the STRIKE part of the "applianceId":

Re: HowTo: Voice control of BCS with Amazon Alexa

Posted: Fri Mar 17, 2017 11:51 am
by JonW
Anything following the PROBE_X is just for annotation.

This is still beta and docs will improve, but your questions are letting me know where I need to clarify things.

Re: HowTo: Voice control of BCS with Amazon Alexa

Posted: Fri Mar 17, 2017 3:30 pm
by oakbarn
Would this code work to change two setpoints at once (using same friendly name)

// This example changes the setpoint at Process 1 (Mash/Strike), State 6 (Mash Tm), Output 7 (Herms Return where
// Output Control (Configurable) Output 7 Herms Return under Mode Hysteresis control with Temperature Probe 0 Herms Rtn
// The value 99999 is a placeholder that gets replaced with the correct value.
{
"applianceId": "PROBE_0_Herms_Rtn",
"friendlyName": "Mash Temperature",
"friendlyDescription": "Mash Temperature Herms Out",
"manufacturerName": "Embedded Control Concepts",
"modelName": "BCS",
"version": "2",
"isReachable": true,
"additionalApplianceDetails": {
"extraDetail1": "",
"extraDetail2": "",
"extraDetail3": "/api/process/1/state/6/output_controllers",
"extraDetail4": JSON.stringify({"key": 7,"value": {"setpoint": 99999}})
},
"actions": [
"getTargetTemperature",
"getTemperatureReading",
"setTargetTemperature",
"incrementTargetTemperature",
"decrementTargetTemperature"
]
},
// This example changes the setpoint at Process 1 (Mash/Strike), State 6 (Mash Tm), Output 0 (MLTe) where
// Output Control (Configurable) Output 0 (MLTe) under Mode Hysteresis control with Temperature Probe 1 MLT Out Herms In
// The value 99999 is a placeholder that gets replaced with the correct value.
{
"applianceId": "PROBE_1_MLT_OUT_HERMS_In",
"friendlyName": "Mash Temperature",
"friendlyDescription": "Mash Temperature MLT Out",
"manufacturerName": "Embedded Control Concepts",
"modelName": "BCS",
"version": "2",
"isReachable": true,
"additionalApplianceDetails": {
"extraDetail1": "",
"extraDetail2": "",
"extraDetail3": "/api/process/1/state/6/output_controllers",
"extraDetail4": JSON.stringify({"key": 0,"value": {"setpoint": 99999}})
},
"actions": [
"getTargetTemperature",
"getTemperatureReading",
"setTargetTemperature",
"incrementTargetTemperature",
"decrementTargetTemperature"
]
},

Re: HowTo: Voice control of BCS with Amazon Alexa

Posted: Sat Mar 18, 2017 8:43 am
by oakbarn
Maybe I was not clear as what I am trying to do. With one command Utterance:

Advance 2 or more Different States in different Processes

Turn On or Off two or More Outputs

Set 2 or more Setpoints

Re: HowTo: Voice control of BCS with Amazon Alexa

Posted: Sat Mar 18, 2017 9:26 am
by oakbarn
Something like this work? :roll:

// This example command activates a specific state at Process 0, State 3.
// This example command activates a specific state at Process 2, State 2.
// Jumping to, or starting a state only needs the "turnOn" action defined.
{
"applianceId": "CUSTOM_Process_2_State_2",
"friendlyName": "B.D.A. Transfer First Run",
"friendlyDescription": "Advances to Xfer 1stRunNS State in SPARGE PROCESS. Advances to Boil Process State in BREW DAY PROCESS. ",
"manufacturerName": "Embedded Control Concepts",
"modelName": "BCS",
"version": "2",
"isReachable": true,
"additionalApplianceDetails": {
"extraDetail1": "/api/process/0",
"extraDetail4": JSON.stringify({"current_state": 3})
"extraDetail3": "/api/process/2",
"extraDetail4": JSON.stringify({"current_state": 2})
},
"actions": [
"turnOn"
]
},

Re: HowTo: Voice control of BCS with Amazon Alexa

Posted: Sun Mar 19, 2017 5:59 am
by oakbarn
In the AWS instructions, it says to use the lambda_function.lambda_handler for the handler. Mine defaulted to index.handler and that Tests OK. I also tried lambda_function.exports.handler
_handler.png
_handler.png (115.99 KiB) Viewed 12926 times
I got it to test in the AWS Console with the index.handler but it will not discover in the Test of the Alexa Skills
Test.png
Test.png (139.71 KiB) Viewed 12926 times

Re: HowTo: Voice control of BCS with Amazon Alexa

Posted: Sun Mar 19, 2017 11:30 am
by JonW
oakbarn wrote:
Sun Mar 19, 2017 5:59 am
In the AWS instructions, it says to use the lambda_function.lambda_handler for the handler. Mine defaulted to index.handler and that Tests OK. I also tried lambda_function.exports.handler
_handler.png

I got it to test in the AWS Console with the index.handler but it will not discover in the Test of the Alexa Skills
It is supposed to be index.handler. Don't mess with the others, because they won't work. Since we know your lambda function is working (because your test works), I can assume that the problem lies in your response to the discovery. Likely it is just an editing error that messed up the JSON. Your Lambda logs should allow you to zero in on where the problem is.

Edit: In looking at your other message trying to setup changing setpoints on multiple probes, you are coding extraDetail4 multiple times and using duplicate "friendlyName". Not only will that not work, that will cause your discovery to fail.

Take baby steps. You're doing too much at once. Run discovery on my default devices so you know it's working. Then change the naming to be what you want and ensure it is still working. Then move on to some of the custom stuff once you know you've done everything else prior properly.