Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Nodo

Pages: [1]
1
Integration Ideas / Tutorial: Integrating VC with DomoticZ
« on: December 06, 2015, 07:21:37 AM »
Good day,

In this integration tutorial between VC and the awesome free and open source home automation tool "DomoticZ" I will try to start from basic use to more advanced options.
We are going to assume that your DomoticZ setup is working flawlessly and that all you need is to integrate your existing DomoticZ setup with VC.

First off, the documentation references we should consult are:
1- DomoticZ API https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's

[Will add more references once the tutorial is complete]

This tutorial will be divided into three parts:
Part One: Preparing all the information we will later need.
Part Two: Sending commands to DomoticZ.
Part Three: Getting information from DomoticZ.

Part One - Preparing Info

In this part we will be preparing all the information we need for sending/receiving commands to/from DomoticZ.

1- DomoticZ server`s IP address: if DomoticZ is on the same machine as VC you can safely use the IP mentioned below. Else, if DomoticZ is on a different machine, you would need the IP of that machine on your LAN.
Code: [Select]
DomoticZ IP = 127.0.0.1
2- DomoticZ webserver`s port: By default, the port is "8080".

3- (Optional) DomoticZ username and password: If you already specified username and password for DomoticZ.

4- Specific Switch IDx: Each switch in DomoticZ has its own unique ID, to get this unique ID:
  • Open your browser and go to http://127.0.0.1:8080
  • Enter username and password, if prompted.
  • Click Setup -> Devices
  • In the Devices table, identify the "Name" and "idx" columns as identified in the image below.


Now, we know that the switch "testSwitch" has an idx of 15.


Part Two - Sending Commands to DomoticZ

The most basic feature is to be able to send commands to DomoticZ to turn a switch on/off.

To test this out on the testSwitch we dealt with earlier to turn that switch "on", we need to open our browser and type:
Code: [Select]
http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=15&switchcmd=On
The format for this command is as follows:
Code: [Select]
http://(IP Address):(Port)/json.htm?type=command&param=switchlight&idx=(Switch ID)&switchcmd=On
Okay, what if we have setup a username and password for DomoticZ server ?

In this case we change the format to:
Code: [Select]
http://username:password@127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=15&switchcmd=On
If you noticed at the end of this url after the idx part, we have a
Code: [Select]
switchcmd=On
All we need to do to turn this switch off is to replace "On" by "off" as follows:
Code: [Select]
http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=15&switchcmd=Off
Now that we`ve verified that we can communicate with DomoticZ, it is time to finalize this part integrating what we have learnt with VC.


All we need to do in VC is a "scrape" action in a command group with the phrase of our choice, in the following code snippet, the phrase used is "Turn On Test Switch" to turn on the switch and "Turn Off Test Switch" to turn it off.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.9-->
<commandGroup open="True" name="DomoticZ" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="261" name="Turn Switch On" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape</cmdType>
      <params>
        <param>http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=15&switchcmd=On</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Turn On test Switch</phrase>
  </command>
  <command id="278" name="Turn Switch Off" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape</cmdType>
      <params>
        <param>http://127.0.0.1:8080/json.htm?type=command&param=switchlight&idx=15&switchcmd=Off</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Turn off test Switch</phrase>
  </command>
</commandGroup>
 

All you need to change in that code is the "idx" of the switch you want to turn on/off and of course the phrase needed.

Simply clone these commands to add more switches and change "idx" and the phrase to trigger the different commands.

In the next part we will go through more advanced topics about automating the process of getting device IDs and getting information from DomoticZ in a way that VC understands.

Hope this tutorial was easy to follow and stay tuned for the final part :).

2
Feature Requests / Sending Gmail Attachments
« on: June 16, 2015, 10:51:46 AM »
Good day James,

My objective here is to send an e-mail with an attachment using a Gmail account.

I understand that to send an e-mail I am to set up my username and password in Options and then use SMTP actions. But then I am unable to send attachments with the e-mail. That is the first part of the problem.

The second part is, Gmail for almost a year now started using what they call "Modern Security Standards" which is their fancy way of saying that they now use oauth 2.0 authorization ". To solve this, we have to use Gmail api with oauth functions to get around it or if not possible then to configure the Gmail account enabling "Less Secure Apps" so that we can use SMTP with SSL/TLS.

I have been considering writing my own implementation of Gmail`s api with Gmail library for python. But I noticed Gmail actions in VC and it got me thinking that if VC is already using Gmail`s API for Gmail actions ("GetAllSummeries","GetAllTitles","GetCount", etc) then it would be much easier to implement this directly with more actions to enable sending an email.

My question is should I write my own code using Gmail`s API or should I wait for Gmail actions to have a "send" action with attachment ?

The reason why I am asking is because I know you already have a lot on your plate lately and I do not want to bother you with more  :).

 


3
Feature Requests / Extending Watcher Plugin
« on: June 02, 2015, 11:49:42 PM »
Good day,

I have been experimenting with VC for a long time now and I must apologize for not being active on the forum :).

@James: great updates to VC. VC keeps proving that it is such a valuable tool in home automation. Even though I know you do not need the compliments... but as a programmer I know that it does not hurt to know that your work is appreciated from time to time ;).

@nime5ter: Well done on the excellent support, tutorials and innovative ideas to integerate VC with other tools.

With that being said, I have been experimenting with the watcher plugin recently and I know that you have been busy with all the updates that you have no time for the watcher plugin, but I thought to throw my request out there.

I think the watcher plugin can be a great plugin if it was a bit dynamic (i.e. being able to assign a folder to the watcher plugin through a command with a payload). If that is quite hard to implement I think the next best option is to have a check box to enable watching "Subdirectories" at the plugin interface.

Also, another set of Watch plugin commands to enable and disable the plugin would be nice but I think this is a bit of a lower priority and it can be worked around for the time being.

Thank you again for the great tool and just to let you know I plan on purchasing VC once my setup is complete and I move to my new place.


4
Other Plugins / Domoticz Home Automation and VC
« on: March 04, 2014, 05:49:20 AM »
Hello all,

I am starting my home automation project using Domoticz software and its API/JSON URL`s can be found here: http://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s

I was wondering how to access Domoticz from VoxCommando ?! .. as I understand XJSON plugin is intended only to be used with XBMC. Should I be using RoboB ?! If RoboB is the way to go, how would I be able to read info from Domoticz`s interface (i.e.: status of a device).

Thank you so much for your time and the great application.

Nodo

Pages: [1]