Author Topic: Need help with Vox saying Temperature  (Read 2770 times)

0 Members and 1 Guest are viewing this topic.

Cineman

  • Jr. Member
  • **
  • Posts: 12
  • Karma: 1
    • View Profile
Need help with Vox saying Temperature
« on: June 05, 2014, 03:01:57 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Need help with Vox saying Temperature
« Reply #1 on: June 05, 2014, 03:09:23 PM »
Try:
Code: [Select]
<?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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Need help with Vox saying Temperature
« Reply #2 on: June 05, 2014, 03:21:30 PM »
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.


« Last Edit: June 05, 2014, 03:32:59 PM by nime5ter »
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

  • Jr. Member
  • **
  • Posts: 12
  • Karma: 1
    • View Profile
Re: Need help with Vox saying Temperature
« Reply #3 on: June 05, 2014, 03:51:03 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Need help with Vox saying Temperature
« Reply #4 on: June 05, 2014, 04:24:45 PM »
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

  • Jr. Member
  • **
  • Posts: 12
  • Karma: 1
    • View Profile
Re: Need help with Vox saying Temperature
« Reply #5 on: June 05, 2014, 05:56:36 PM »
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

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Need help with Vox saying Temperature
« Reply #6 on: June 05, 2014, 06:24:50 PM »
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

  • Jr. Member
  • **
  • Posts: 12
  • Karma: 1
    • View Profile
Re: Need help with Vox saying Temperature
« Reply #7 on: June 05, 2014, 06:37:34 PM »
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

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Need help with Vox saying Temperature
« Reply #8 on: June 05, 2014, 07:01:32 PM »
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.

« Last Edit: June 06, 2014, 09:20:00 AM by Kalle »
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Need help with Vox saying Temperature
« Reply #9 on: June 05, 2014, 09:54:51 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

  • Jr. Member
  • **
  • Posts: 12
  • Karma: 1
    • View Profile
Re: Need help with Vox saying Temperature
« Reply #10 on: June 06, 2014, 09:03:28 AM »
Thank you!
It works ...
Is it possibel to Run tts speech over airplay speakers?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Need help with Vox saying Temperature
« Reply #11 on: June 06, 2014, 09:22:49 AM »
I don't have any experience with AirPlay but a quick web search yields this possibility:

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