Get data from Homewizard

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
robpijpers
Posts: 4
Joined: Saturday 14 February 2015 21:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Get data from Homewizard

Post by robpijpers »

Hello all,

I have a Homewizard running with several kaku devices. Because its hard to script against the homewizard I started to play arround with Domoticz.
I can get information or change a switch on the homewizard by sending a http url http://<homewizard-ip>/<password>/sensor.
Is it possible to send an http url from a (dummy) Domoticz switch or something else?

Regards,

Rob
ThinkPad
Posts: 890
Joined: Tuesday 30 September 2014 8:49
Target OS: Linux
Domoticz version: beta
Location: The Netherlands
Contact:

Re: Get data from Homewizard

Post by ThinkPad »

Yep, click on the 'Edit' button below a switch, and you see two fields, the 'on action' and the 'off action'. There you can fill in a HTTP-url.

Oh and welcome to Domoticz :)
I am not active on this forum anymore.
robpijpers
Posts: 4
Joined: Saturday 14 February 2015 21:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Get data from Homewizard

Post by robpijpers »

That works very nice, thanks for your quick responce.
Is there a way to parse json return data from the Homewizard?
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Get data from Homewizard

Post by gizmocuz »

You could write a python script, and use the domoticz json api to upload the results into domoticz (see wiki)
Quality outlives Quantity!
yellow
Posts: 1
Joined: Sunday 08 February 2015 10:30
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Get data from Homewizard

Post by yellow »

You could also use https://json-csv.com to turn the JSON data into a spreadsheet.
herscotty
Posts: 13
Joined: Wednesday 06 May 2015 22:57
Target OS: Linux
Domoticz version: beta
Location: Germany
Contact:

Re: Get data from Homewizard

Post by herscotty »

Does someone already create a script?
Sounds very Interesting. Its my first day with Domoticz. I already have HomeWizard since 2 years now and would be great to compare them.
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Get data from Homewizard

Post by Egregius »

Maybe http://www.domoticz.com/forum/viewtopic.php?f=17&t=6117 is womething you can start with?
It pulls data fromo thermometers, rain and wind from Homewizard and stores it in Domoticz.
User avatar
sincze
Posts: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Get data from Homewizard

Post by sincze »

Egregius wrote:Maybe http://www.domoticz.com/forum/viewtopic.php?f=17&t=6117 is womething you can start with?
It pulls data fromo thermometers, rain and wind from Homewizard and stores it in Domoticz.
:D Great, that opened an additional playground for me.
I still use Domoticz because I think it can do more for less compared to Home Wizard.
However if I have to install the system at a non programmers house I would suggest Home Wizard.

For people that want flexibility I'll pick Domoticz. Have several systems running stable Domoticz for over a year monitoring the P1.
People never complained.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Get data from Homewizard

Post by Egregius »

6 months ago I was quit entertained by homewizard, now I think it's a complete waste of my money. Domoticz is evenly simple starters, but way more flexible for advanced users.
User avatar
sincze
Posts: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Get data from Homewizard

Post by sincze »

Egregius wrote:6 months ago I was quit entertained by homewizard, now I think it's a complete waste of my money. Domoticz is evenly simple starters, but way more flexible for advanced users.
:lol: +1 Egregius

at least the starter has to know what a raspberry is :D
I can assure you not everybody I talk to knows.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
herscotty
Posts: 13
Joined: Wednesday 06 May 2015 22:57
Target OS: Linux
Domoticz version: beta
Location: Germany
Contact:

Re: Get data from Homewizard

Post by herscotty »

Egregius wrote:Maybe http://www.domoticz.com/forum/viewtopic.php?f=17&t=6117 is womething you can start with?
It pulls data fromo thermometers, rain and wind from Homewizard and stores it in Domoticz.
Great! Thank you! Helped me a lot.
Now the last step is to push the data into Domoticz. For this i open the URL with the specific variables. I already found a list of the types of the sensors (http://www.domoticz.com/wiki/Domoticz_A ... ual_Sensor) but what kind of Sensor is the 'Contact'-Sensor in Domoticz?

The reason/idea is: Check the state of the magnetic contact in HomeWizard and write the state into Domitcz (Switch->Contact).
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Get data from Homewizard

Post by Egregius »

Can you do anything with the Udevice function from this script?
http://www.domoticz.com/forum/viewtopic ... 344#p41353
herscotty
Posts: 13
Joined: Wednesday 06 May 2015 22:57
Target OS: Linux
Domoticz version: beta
Location: Germany
Contact:

Re: Get data from Homewizard

Post by herscotty »

It's done! Thank you all for help!

I attach the final script. It search for Sensors and Switches in Domoticz and synchronize the state of them with HomeWizard. For that the name of the Switches and Sensors in Homewizard and Domoticz must be the same.
It was my first script so excuse me :D
Maybe some one can improve the script.

Code: Select all

<?php
while(true){									//opend with rc.local and sync all 5 seconds
$json = file_get_contents('http://192.168.178.25/PASSWORD/get-sensors');	//get Homewizard status
$datahw = null;
$datahw = json_decode($json,true);
$json2 = file_get_contents('http://192.168.178.46:8080/json.htm?type=devices');	//get devices from Domoticz
$datadm = null;
$datadm = json_decode($json2,true);


if($datahw) {
        foreach($datahw['response']['kakusensors'] as $tmp) {			//for every Sensor; write new Array
                $namehw = null;
                $statushw = null;
                $idhw = null;
                $namehw=($tmp['name']);
                $statushw=($tmp['status']);
                $idhw=($tmp['id']);
                if("$statushw"=="no") $statushw=0;				//to compare the state with Domoticz
                if("$statushw"=="yes") $statushw=1;
                if("$namehw"=="HelligkeitSenso"){
                if("$statushw"=="0") $statushw="Off";
                if("$statushw"=="1") $statushw="On";
                }

                foreach ($datadm['result'] as $domotic) {			//for every Domoticz Sensor
                        $namedm = null;
                        $idxdm = null;						//idx for the idx number; dm stand for Domoticz
                        $hwiddm = null;
                        $statusdm = null;
                        $namedm=($domotic['Name']);
                        if($namedm=="Garage rechts") $namedm="GTorRechts";	//example if the Domoticz Name is different then
                        if($namedm=="Garage linkss") $namedm="GTorLinks";	//the name in Homewizard 
                        $idxdm=($domotic['idx']);
                        $hwiddm=($domotic['HardwareID']);
                        $statusdm=($domotic['Status']);
                        if("$statusdm"=="Closed")$statusdm=0;			//to set status for the URL
                        if("$statusdm"=="Open")$statusdm=1;
                        if("$namehw"=="$namedm" && "$hwiddm"=="6"){		//select Hardware ID of Virtual HomeWizard Switch
                                $URL="http://192.168.178.46:8080/json.htm?type=command&param=udevice&idx=$idxdm&nvalue=$statushw";
                                if("$statushw"!="$statusdm")file_get_contents($URL); //send the URL to change the state
                        }
                }
        }

        foreach($datahw['response']['switches'] as $tmp) {			//for every Switch
                $namehw = null;
                $statushw = null;
                $idhw = null;
                $namehw=($tmp['name']);
                $statushw=($tmp['status']);
                $idhw=($tmp['id']);
                if("$statushw"=="on") $statushw="1";
                if("$statushw"=="off") $statushw="0";

                foreach ($datadm['result'] as $domotic) {
                        $namedm = null;
                        $idxdm = null;
                        $hwiddm = null;
                        $statusdm = null;
                        $namedm=($domotic['Name']);
                        if($namedm=="Küche Decke") $namedm="Kueche Decke";	//different Names in HW and DM
                        $idxdm=($domotic['idx']);
                        $hwiddm=($domotic['HardwareID']);
                        $statusdm=($domotic['Status']);
                        if("$statusdm"=="On")$statusdm=1;
                        if("$statusdm"=="Off")$statusdm=0;
                        if("$namehw"=="$namedm" && "$hwiddm"=="6"){
                                $URL="http://192.168.178.46:8080/json.htm?type=command&param=udevice&idx=$idxdm&nvalue=$statushw";
                                if("$statushw"!="$statusdm")file_get_contents($URL) ;
                        }
                }
        }
}

sleep (5);									//Sync every 5 Seconds
}
Last edited by herscotty on Tuesday 12 May 2015 11:15, edited 1 time in total.
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Get data from Homewizard

Post by Egregius »

Looks nice :)
Just watch out with to many connections to homewizard, I had many timeouts when requesting more than every 20 seconds.
herscotty
Posts: 13
Joined: Wednesday 06 May 2015 22:57
Target OS: Linux
Domoticz version: beta
Location: Germany
Contact:

Re: Get data from Homewizard

Post by herscotty »

I changed the time now to 10 seconds. Since yesterday evening it checks every 5 seconds and i had no problem. I watched at same time with the HomeWizard App at the iPhone and it doesn't had a disconnection.
Do you have any other hint or good idea to improve it? As i already told, i haven't much experience so far.
User avatar
Egregius
Posts: 2582
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: v2024.7
Location: Beitem, BE
Contact:

Re: Get data from Homewizard

Post by Egregius »

You could consider to only repeat the while loop for one minute (like 5 times or so) and start the script every minute by cron.
That way you avoid that the script would stop in case something went wrong.

There's nothing in your script that warns you in case something went wrong.
Whit a if(!$datahw) mail... you could be warned about that. (That's how I saw all the connection errors from HW)
rfvdboom
Posts: 38
Joined: Tuesday 20 September 2016 8:32
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Netherlands
Contact:

Re: Get data from Homewizard

Post by rfvdboom »

Hi there,

i'm trying to use this script (swtiches), but i keep getting an error on line 65: $statusdm=($domotic['Status']);

I changed line in my onw specifications:
3: $json
6: $json2
62: "if($namedm==
69: $URL

Can somebody tell me what 'm doing wrong?

Thx
Odroid N2+ | Raspberry P 3 ModelB | RFXcom | AEOTEC Zwave | Honeywell Lyric T6| Milight | Milighthub (NodeMCU) | SolarEdge | P1 Smart meter USB | KAKU | Wemos D1 (esphome) | Denon | Logitech Harmony
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest