2

TLDR:
I want to query Alexa for the current humidity sensor reading by asking:

"What is the current humidity, Alexa?"

The answer should be similar to:

"The current humidity level is 56.7%"

Here is my setup:

  • I have a bunch of ESP8266 with a variety of sensors, which publish the sensor readings via MQTT over WLAN
  • The MQTT broker is running on a Raspberry Pi in the same LAN
  • I also have NodeRed running on the Raspberry Pi, where I am using the Node-RED Alexa Home Skill Bridge, which works perfectly for sending commands to the different Nodes in my network

What I am looking for:

  • I would like to be able to ask Alexa for the current sensor reading of any of my sensors and have her answer with the proper value
  • In theory I understand that the Node-RED Alexa Home Skill Bridge at least should provide the oppurtunity to query for the temperature reading of a device, when you are in the US/UK.
  • However, although I tried, this doesn't seem to work on my German Alexa
  • Futhermore, I would of course also prefer to ask Alexa e.g. for the current humidity directly and not having to misuse the temperature query

Is there any way to achieve what I intend to do, e.g. by using an already existing skill or maybe a NodeRed extension?

3

Alexa does not have any device types that support humidity at the moment, so this is not possible using the Smart Home Skills.1

Here is the list of device types and their capabilities.

You could create your own normal skill, but this would mean asking something like "Alexa, ask FooBar what the humidity is". There is a node for Node-RED to do normal skills but it has been abandoned by it's author for years. You can implement your own just using HTTP-in/HTTP-response nodes, but it's a lot more work.

1 There is a new capability for Smart Home Skills that allows you to add your own custom commands using a CustomIntent. This is currently only in beta at the moment and would require building a custom Smart Home Skill if allowed on to the beta.

(Author of the Node-RED Alexa Home Skill Nodes)

  • Thanks a lot for the different pointers. I guess I will then try my luck with my own custom Alexa skill. Btw. awesome job on the Alexa Home Skill Node! – oh.dae.su Mar 2 at 11:44
0

Finally, I was able to achieve my target to be able to query Alexa for custom sensor readings without the need to program my own skill.


The following elements are used in my setup:

  1. A Raspberry Pi in my home LAN with Node-RED installed on it
  2. Some source for a sensor signal (in my case a Nodemcu with a DHT22 sensor that sends the humidity readings via MQTT to the Raspberry Pi, where the MQTT broker is running)
  3. An Amazon Echo (which does not need to be in the same LAN as the Raspberry Pi!)
  4. The Node-RED Alexa Home Skill Bridge node by @hardillb
  5. The Alexa-remote-control shell script that lets you issue any text-to-speech command to your Alexa devices

Here are the steps that one needs to take:

  1. Register a new device in @hardillb’s Node-RED Alexa Home Skill Bridge. Any device and name combination should do. I chose a smart plug and called it “Humidity_at_home”.
  2. Now let Alexa search for new devices.
  3. Create an Alexa routine in the Alexa app, where you use a custom voice trigger (in my case: “Alexa, what is the current humidity level”) to switch the virtual device “Humidity_at_home” on.
  4. In Node-RED configure a Alexa Home Skill Bridge node for the device “Humidity_at_home”. Depending on the command from Alexa (“Humidity_at_home” plug on/off) the msg.command element of the node output will have the value TurnOnRequest/TurnOffRequest.
  5. In node-red, when the “Humidity_at_home” node is triggered and outputs msg.command = "TurnOnRequest", call the Alexa-remote-control shell script via the exec node issuing a text-to-speech command to an Echo device, e.g. using this command:

    alexa_remote_control.sh -d "Your Echo's name" -e speak:'Here is the text string you construct as answer to your Alexa request for the humidity level value'
    

Needless to say that you can use any kind of virtual device and any kind of setting of the device to trigger actions in node-red.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.