News:

HOT TIP! Exploring the commands packaged in VC's standard configurations is a great way to learn how to build your own. You can also clone a command as a starting point: just right-click and select "Clone" (or type Alt-C).

Main Menu

Need help with Vox saying Temperature

Started by Cineman, June 05, 2014, 03:01:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Cineman

if i enter in Browser:http://192.168.1.42/control?callback=cname&cmd=get_state_sensor&number=1

i get this:
cname({
   "version": 16,
   "type": "get_state_sensor",
   "sensor": {
      "number": 1,
      "name": "Temperatur",
      "type": "temperature",
      "value": 20.1,
      "state": [ "ok"],
      "unit": "°C",
      "utime": 1401990726,
      "date": {
         "weekday": "th",
         "day": 5,
         "month": 6,
         "year": 2014
      },
      "time": {
         "hour": 19,
         "min": 52,
         "sec": 6
      }
   }
How can i make vox said to me :Temperature 20.1
He had to speak the value

Can anyone please help me ??

nime5ter

Try:
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.5.5-->
<command id="1159" name="What's the temperature" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>http://192.168.1.42/control?callback=cname&amp;cmd=get_state_sensor&amp;number=1</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>"value":.(.*?),</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>The temperature is currently {Match.1} degrees Celsius.</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>What's the temperature</phrase>
</command>
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

#2
Sorry, I see that you're a new member and first-time poster. Welcome to the forum.

To use the xml above, you can select all the "code", copy it, and paste it directly into your command tree.

http://voxcommando.com/mediawiki/index.php?title=XML_on_the_forum

---

The scrape action in VoxCommando is like a get request. http://voxcommando.com/mediawiki/index.php?title=Home_Automation#Scrape

The text returned from the request is stored as {LastResult}. The different Results.**** actions in VoxCommando allow us to do things to {LastResult}. (see http://voxcommando.com/mediawiki/index.php?title=Actions#Results)

In my command above, I used a regular expression (Results.RegEx) to find a particular pattern and capture the text of interest (the temperature).

Each time a pattern is matched in a {LastResult}, it is stored as a match: {Match.1}, {Match.2}, etc.

In this case, the pattern occurs only once on the page, so there is only a {Match.1}.

If the page had the text "value": [something], more than once, then each time VC found that pattern on the page, it would be stored as a separate match.


TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Cineman

Thank you. :) for the very fast reply.
Now i can switch all 64 Aktors in my House and have also a return with Temperature or swtich on or off.

Greetings from Germany

nime5ter

Ganz toll.

Viel Spaß.

... That's the limit of my Deutsch, but Kalle and many others here will be happy to plan clever automation projects with you in German. :)
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Cineman

an other question:

i want to have answer if my jalousines are up( value 100) or down ( value 0)

http://192.168.1.42/control?callback=cname&cmd=get_state_actuator&number=11
i get this:
cname({
   "version": 16,
   "type": "get_state_actuator",
   "actuator": {
      "number": 11,
      "name": "JalousieGarten",
      "type": "switch",
      "value": 100.0,
      "newvalue": 100.0,
      "unit": "%",
      "utime": 1402001006,
      "date": {
         "weekday": "th",
         "day": 5,
         "month": 6,
         "year": 2014
      },
      "time": {
         "hour": 22,
         "min": 43,
         "sec": 26
      }
   }
})

i think it must be going with add logic but how ????

can you help me again?


Kalle

Can more explain this? Did your controller send a event to VC? Or did you only want a answer after you close or open the Jalousie with VC?
***********  get excited and make things  **********

Cineman

I dont wont a speech "Jalousie are down" yet after i Sent a Protokoll to go down.

I want to Check if they are down or Not.



Kalle

#8
Ahh, ok.

Ja hier kannst Du einen "logic block" benutzen.

IF (A==B) -> {Match.1} = 100.0
Then -> tts.speak -> Jalousie ist geschlossen geöffnet.

@nime5ter: you are absolute correct 100 is open 0 is close.

***********  get excited and make things  **********

nime5ter

Quote from: Kalle on June 05, 2014, 07:01:32 PM
IF (A==B) -> {Match.1} = 100.0
Then -> tts.speak -> Jalousie ist geschlossen.

... Oder "Jalousie ist ganz geöffnet", nicht? ;)

(Wenn {Match.1} ist 100.0)



TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

Cineman

Thank you!
It works ...
Is it possibel to Run tts speech over airplay speakers?

jitterjames

I don't have any experience with AirPlay but a quick web search yields this possibility:

https://www.rogueamoeba.com/airfoil/