Controlling Toon [HACKED] from Domoticz

For heating/cooling related questions in Domoticz

Moderator: leecollings

FunFair
Posts: 52
Joined: Wednesday 04 October 2017 11:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair »

michel30 wrote: Thursday 08 February 2018 20:16 Hello,

I use the analog scrip for GAS and POWER, that works super in my domoticz.

Now I want to add the price and I see under the tap setup > settings > Meters/Counters the following fields: RFXMeter/Counter Dividers:

I edit the price in here, but I don't see it in my Domoticz I only see the GAS or power use.

How can I see the price in domoticz? or will this only works if you have a P1 cable?
This is not really Toon specific, but has to do something with Domoticz. I haven't used these before, but my guess is you have to search the forums/google or the wiki from domoticz to know how to enter the correct values.
glsf91
Posts: 58
Joined: Tuesday 14 November 2017 21:56
Target OS: Linux
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by glsf91 »

michel30 wrote: Thursday 08 February 2018 20:16 Hello,

I use the analog scrip for GAS and POWER, that works super in my domoticz.

Now I want to add the price and I see under the tap setup > settings > Meters/Counters the following fields: RFXMeter/Counter Dividers:

I edit the price in here, but I don't see it in my Domoticz I only see the GAS or power use.

How can I see the price in domoticz? or will this only works if you have a P1 cable?
Hit the Report button where you see the the power use graphs in the top right.
FunFair
Posts: 52
Joined: Wednesday 04 October 2017 11:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair »

Created a script to read some data from the boiler unit trough toon. It reads pressure, temperature and setpoint.

Code: Select all

#!/usr/bin/php
<?php

/* Version 1.0 written by FunFair */
/* 06-03-2018 */

/* 
	Changelog version 1.0
	- first attempt to read out information from the boiler.

*/

/* Instructions:
	- Place script in Domoticz folder /home/pi/domoticz/scripts/p1_meter/ or desired folder.
	- Make sure Curl is installed (sudo apt-get install php-curl).
	- Make sure script is executable (chmod +x filename.php).
	- All echo's are used for debugging.
	- Put script in 'crontab -e' to run every minute. */ 
	  #Example crontab: (*/1 * * * * /home/pi/domoticz/scripts/cvketel/cvketel_data_json.php)
	
		
/* Set IP addresses and idx*/
$IPDomoticz = '192.168.0.200:8080'; #use 'username:password@domoticz-ip:port' in case of password protection.
$IPToon = '192.168.0.11';
$idx_pressure = 254;
$idx_temp = 255;
$idx_setpoint = 256;

/* Get current date */
$datum =  date("d-m-Y");
echo "Request for FROM date: " . $datum . "\n";
echo "Now: ". date("Y-m-d H:i:s") . "\n";

/* Get Boiler Pressure from Toon */
$file_string_pressure = file_get_contents("http://$IPToon/hcb_rrd?action=getRrdData&loggerName=thermstat_boilerChPressure&rra=30days&readableTime=1&nullForNaN=1&from=$datum");
$parsed_json = json_decode($file_string_pressure, true);

if ( empty($parsed_json)) {
        echo "Array is empty. Stop executing\n";
        return;
}

/* Get last value of array */
$keys = array_keys($parsed_json);
end($parsed_json);
$key = key($parsed_json);
$BoilerPressureToon = $parsed_json[$key];
echo "Boiler Pressure from Toon = " . $BoilerPressureToon. " Bar";
echo "\n";

/* Get Boiler Temperature from Toon */
$file_string_pressure = file_get_contents("http://$IPToon/hcb_rrd?action=getRrdData&loggerName=thermstat_boilerTemp&rra=30days&readableTime=1&nullForNaN=1&from=$datum");
$parsed_json = json_decode($file_string_pressure, true);

if ( empty($parsed_json)) {
        echo "Array is empty. Stop executing\n";
        return;
}

/* Get last value of array */
$keys = array_keys($parsed_json);
end($parsed_json);
$key = key($parsed_json);
$BoilerTempToon = $parsed_json[$key];
echo "Boiler Temperature from Toon = " . $BoilerTempToon. " degrees Celcius";
echo "\n";


/* Get Boiler Setpoint from Toon */
$file_string_pressure = file_get_contents("http://$IPToon/hcb_rrd?action=getRrdData&loggerName=thermstat_boilerSetpoint&rra=30days&readableTime=1&nullForNaN=1&from=$datum");
$parsed_json = json_decode($file_string_pressure, true);

if ( empty($parsed_json)) {
        echo "Array is empty. Stop executing\n";
        return;
}

/* Get last value of array */
$keys = array_keys($parsed_json);
end($parsed_json);
$key = key($parsed_json);
$BoilerSetpointToon = $parsed_json[$key];
echo "Boiler Setpoint from Toon = " . $BoilerSetpointToon. " degrees Celcius";
echo "\n";

/* write new values to Domoticz */
$WriteInitValue = curl_init("http://$IPDomoticz/json.htm?type=command&param=udevice&idx=$idx_pressure&nvalue=0&svalue=$BoilerPressureToon");
curl_exec($WriteInitValue);

$WriteInitValue = curl_init("http://$IPDomoticz/json.htm?type=command&param=udevice&idx=$idx_temp&nvalue=0&svalue=$BoilerTempToon");
curl_exec($WriteInitValue);

$WriteInitValue = curl_init("http://$IPDomoticz/json.htm?type=command&param=udevice&idx=$idx_setpoint&nvalue=0&svalue=$BoilerSetpointToon");
curl_exec($WriteInitValue);

?>
If you want to try to add other variables, here's a list of available variables.
  • boiler_burner_minutes-10yrdays.csv
    boiler_burner_minutes-5yrhours.csv
    thermstat_boilerBurnerHours-30days.csv
    thermstat_BoilerBurnerHours-30days.csv
    thermstat_boilerBurnerHours-year.csv
    thermstat_BoilerBurnerHours-year.csv
    thermstat_boilerChPressure-30days.csv
    thermstat_boilerChPressure-year.csv
    thermstat_boilerDhwBurnerHours-30days.csv
    thermstat_BoilerDhwBurnerHours-30days.csv
    thermstat_boilerDhwBurnerHours-year.csv
    thermstat_BoilerDhwBurnerHours-year.csv
    thermstat_boilerFailedBurnerStarts-30days.csv
    thermstat_BoilerFailedBurnerStarts-30days.csv
    thermstat_boilerFailedBurnerStarts-year.csv
    thermstat_BoilerFailedBurnerStarts-year.csv
    thermstat_boilerOpMode-30days.csv
    thermstat_boilerOpMode-year.csv
    thermstat_boilerPumpStarts-30days.csv
    thermstat_boilerPumpStarts-year.csv
    thermstat_boilerRetTemp-30days.csv
    thermstat_boilerRetTemp-year.csv
    thermstat_boilerSetpoint-30days.csv
    thermstat_boilerSetpoint-year.csv
    thermstat_boilerSuccesfulBurnerStarts-30days.csv
    thermstat_BoilerSuccesfulBurnerStarts-30days.csv
    thermstat_boilerSuccesfulBurnerStarts-year.csv
    thermstat_BoilerSuccesfulBurnerStarts-year.csv
    thermstat_boilerTemp-30days.csv
    thermstat_boilerTemp-year.csv
    thermstat_dhwBurnerStarts-30days.csv
    thermstat_dhwBurnerStarts-year.csv
    thermstat_heatingFactor-30days.csv
    thermstat_heatingFactor-year.csv
    thermstat_internalSetpoint-30days.csv
    thermstat_internalSetpoint-year.csv
    thermstat_longTermOffset-30days.csv
    thermstat_longTermOffset-year.csv
    thermstat_outsideRate-30days.csv
    thermstat_outsideRate-year.csv
    thermstat_programState-30days.csv
    thermstat_programState-year.csv
    thermstat_realTemps-30days.csv
    thermstat_realTemps-year.csv
    thermstat_setpoint-30days.csv
    thermstat_setpoint-year.csv
maomanna
Posts: 94
Joined: Monday 30 November 2015 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by maomanna »

i red this topic, read the wiki and domoticaforum.eu

My toon is rooted and dont want to use it with Eneco.

For the wiki i need to use my username and password from my eneco (dont have)
In this and the other topic i saw many scripts, but now i am confused.

Where do i start to use my toon in Domoticz?
FunFair
Posts: 52
Joined: Wednesday 04 October 2017 11:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair »

maomanna wrote: Wednesday 07 March 2018 22:09 i red this topic, read the wiki and domoticaforum.eu

My toon is rooted and dont want to use it with Eneco.

For the wiki i need to use my username and password from my eneco (dont have)
In this and the other topic i saw many scripts, but now i am confused.

Where do i start to use my toon in Domoticz?
The default domoticz plugin doesnt work anymore.
Use the LUA scripts in this thread.

The php scripts are for reading extra information from toon.
maomanna
Posts: 94
Joined: Monday 30 November 2015 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by maomanna »

I put the lua scripts in event, but after that, my domoticz crashed. after restart, the same story. disable the script, then it runs ok.

1. Toon as device:

Code: Select all

-- Script used for Toon Thermostaat utility device, upon changing temp in Domoticz, temperature is sent to Toon. 
--
commandArray = {}

    ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
    ToonIP = uservariables['UV_ToonIP']
    
    for deviceName,deviceValue in pairs(devicechanged) do
        if (deviceName == ToonThermostatSensorName) then
            if uservariables['UV_ToonChangedByDomoticz'] == 1 then
                commandArray['Variable:UV_ToonChangedByDomoticz'] = '0'
            else
                SetPoint = otherdevices_svalues[ToonThermostatSensorName]
                ToonCommand = string.format('http://%s/happ_thermstat?action=setSetpoint&Setpoint=%s', ToonIP, SetPoint*100)
                
                print('Setting Toon setpoint to '.. SetPoint)
                commandArray['OpenURL'] = ToonCommand
            end
        end
    end

return commandArray
and Toonstates as Time
I changed a line to json = assert(loadfile "/dev-domoticz/scripts/lua/JSON.lua")() -- For Raspberry cause i'm on ubuntu 16.04

Code: Select all

-- Time script runs every minute, intended to sync Domoticz with Toon in case the value is changed on the physical device.
-- Updates Toon Thermostat Sensor to value set on Toon
-- Updates Toon Temperature Sensor to value set on Toon
-- Updates Toon Scenes switch based on program set on Toon
-- Updates Toon Auto Program switch to value set on Toon
-- Updates Toon program information text to value set on Toon

commandArray = {}

    ToonThermostatSensorName = uservariables['UV_ToonThermostatSensorName'] -- Sensor showing current setpoint
    ToonTemperatureSensorName = uservariables['UV_ToonTemperatureSensorName'] -- Sensor showing current room temperature
    ToonScenesSensorName  = uservariables['UV_ToonScenesSensorName'] -- Sensor showing current program
    ToonAutoProgramSensorName = uservariables['UV_ToonAutoProgramSensorName'] -- Sensor showing current auto program status
    ToonProgramInformationSensorName = uservariables['UV_ToonProgramInformationSensorName'] -- Sensor showing displaying program information status
    ToonIP = uservariables['UV_ToonIP']
    DomoticzIP = uservariables['UV_DomoticzIP']

    json = assert(loadfile "/dev-domoticz/scripts/lua/JSON.lua")() -- For Raspberry
    
    local handle = assert(io.popen(string.format('curl http://%s/happ_thermstat?action=getThermostatInfo', ToonIP)))
        local ThermostatInfo = handle:read('*all')
    handle:close()
    
    jsonThermostatInfo = json:decode(ThermostatInfo)
    
    currentSetpoint = tonumber(jsonThermostatInfo.currentSetpoint) / 100
    currentTemperature = tonumber(jsonThermostatInfo.currentTemp) / 100
    currentProgramState = tonumber(jsonThermostatInfo.programState)
    currentActiveState = tonumber(jsonThermostatInfo.activeState)
    currentNextTime = jsonThermostatInfo.nextTime
    currentNextSetPoint = tonumber(jsonThermostatInfo.nextSetpoint) / 100
    
    -- Update the thermostat sensor to current setpoint
    if otherdevices_svalues[ToonThermostatSensorName]*100 ~= currentSetpoint*100 then  
        print('Updating thermostat sensor to new set point: ' ..currentSetpoint)
        commandArray[1] = {['Variable:UV_ToonChangedByDomoticz'] = '1'} -- Set variable changed to 1 to prevent script ToonSetPoint from shooting an event at Toon
        commandArray[2] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonThermostatSensorName], currentSetpoint)}
    end
    
    -- Update the temperature sensor to current room temperature
    if otherdevices_svalues[ToonTemperatureSensorName]*100 ~= currentTemperature*100 then 
        print('Updating the temperature sensor to new value: ' ..currentTemperature)
        commandArray[3] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonTemperatureSensorName], currentTemperature)}
    end
    
    -- Update the toon scene selector sensor to current program state
    CurrentToonScenesSensorValue = otherdevices_svalues[ToonScenesSensorName]
    
    if currentActiveState == -1 then currentActiveState = '50' -- Manual
    elseif currentActiveState == 0 then currentActiveState = '40' -- Comfort
    elseif currentActiveState == 1 then currentActiveState = '30' -- Home
    elseif currentActiveState == 2 then currentActiveState = '20' -- Sleep
    elseif currentActiveState == 3 then currentActiveState = '10' -- Away
    end
    
    if CurrentToonScenesSensorValue ~= currentActiveState then  -- Update toon selector if it has changed
        print ('Updating Toon Scenes selector')
        commandArray[4] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonScenesSensorName], currentActiveState)}
    end
    
    -- Updates the toon auto program switch 
    CurrentToonAutoProgramSensorValue = otherdevices_svalues[ToonAutoProgramSensorName]
    
    if currentProgramState == 0 then currentProgramState = '10' -- No
    elseif currentProgramState == 1 then currentProgramState = '20' -- Yes
    elseif currentProgramState == 2 then currentProgramState = '30' -- Temporary       
    end
    
    if CurrentToonAutoProgramSensorValue ~= currentProgramState then -- Update toon auto program selector if it has changed
        print ('Updating Toon Auto Program selector')
        commandArray[5] = {['UpdateDevice'] = string.format('%s|1|%s', otherdevices_idx[ToonAutoProgramSensorName], currentProgramState)}
    end
    
    -- Updates the toon program information text box
    CurrentToomProgramInformationSensorValue = otherdevices_svalues[ToonProgramInformationSensorName]
    if currentNextTime == 0 or currentNextSetPoint == 0 then
        ToonProgramInformationSensorValue = 'Op ' ..currentSetpoint.. '°'
    else
        ToonProgramInformationSensorValue = 'Om ' ..os.date('%H:%M', currentNextTime).. ' op ' ..currentNextSetPoint.. '°'
    end
    
    if CurrentToomProgramInformationSensorValue ~= ToonProgramInformationSensorValue then
        commandArray[6] = {['UpdateDevice'] = string.format('%s|0|%s', otherdevices_idx[ToonProgramInformationSensorName], ToonProgramInformationSensorValue)}
    end
        
--

return commandArray
are there newer scripts?

EDIT:
Guess i forgot local json = assert(loadfile "/home/maes/domoticz/scripts/lua/JSON.lua")() -- For Linux
Not helping

Line of error: Error: EventSystem: in Toonstates: [string "-- Time script runs every minute, intended to..."]:26: attempt to index global 'jsonThermostatInfo' (a nil value)

I believe my toon is on softwareversion 3.7.x I'll update it when I get home.
User avatar
gijsje
Posts: 132
Joined: Saturday 19 August 2017 14:28
Target OS: NAS (Synology & others)
Domoticz version: Stable
Location: Berkel Enschot, NL
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by gijsje »

I have the gas and electric script working now to get this data into domoticz.
I only have a strange issue.
The logging of the data stops at 17:00 and starts again at 00:00
I have the script running on the synology and if i look at the output there it is working fine and it can see the data in the log file but it is not comming into domoticz.

Image
Synology DS218+ - RFXtrx433 - Aeotec Z-Stick Gen5 - Toon Thermostat - Neo CoolCam plug - Neo CoolCam PIR - FIBARO PIR - Heiman Smart Smoke Senso - Neo CoolCam Leakage Detector - BeNext Tag Reader - P1 and S0 USB - many Mi-Light lights - KAKU switches
FunFair
Posts: 52
Joined: Wednesday 04 October 2017 11:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair »

gijsje wrote: Thursday 08 March 2018 19:41 I have the gas and electric script working now to get this data into domoticz.
I only have a strange issue.
The logging of the data stops at 17:00 and starts again at 00:00
I have the script running on the synology and if i look at the output there it is working fine and it can see the data in the log file but it is not comming into domoticz.

Image
Seems the low tariff counter is not added correctly or something? Though 'laagtarief' starts after 22 oclock instead of 17 I think. Which script are you using? The last one I have posted?
User avatar
gijsje
Posts: 132
Joined: Saturday 19 August 2017 14:28
Target OS: NAS (Synology & others)
Domoticz version: Stable
Location: Berkel Enschot, NL
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by gijsje »

I guess so
I have tried so many i lost count ;)

Code: Select all

/* Version 1.0 written by Ierlandfan */
/* Version 1.0 modified by DennisD */
/* Version 2.0 rewritten by FunFair */
/* Version 2.1 update by FunFair */
/* Version 3.0 modified by glsf91 for using RRD */
/* Version 3.1 update by FunFair */
/* 05-03-2018 */
Synology DS218+ - RFXtrx433 - Aeotec Z-Stick Gen5 - Toon Thermostat - Neo CoolCam plug - Neo CoolCam PIR - FIBARO PIR - Heiman Smart Smoke Senso - Neo CoolCam Leakage Detector - BeNext Tag Reader - P1 and S0 USB - many Mi-Light lights - KAKU switches
FunFair
Posts: 52
Joined: Wednesday 04 October 2017 11:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair »

gijsje wrote: Friday 09 March 2018 20:56 I guess so
I have tried so many i lost count ;)

Code: Select all

/* Version 1.0 written by Ierlandfan */
/* Version 1.0 modified by DennisD */
/* Version 2.0 rewritten by FunFair */
/* Version 2.1 update by FunFair */
/* Version 3.0 modified by glsf91 for using RRD */
/* Version 3.1 update by FunFair */
/* 05-03-2018 */
Ifyou enable 'energieverbruik' does the graph show an increase in watt/h?
The value that is not updating is the current power usage in watt. I don't know why it stops doing this. If the counter doesn't update as well it looks like there is no connection to update the values or something... Maybe a dumb question, but is the wifi turned off during this time?

And what does the graph on the toon unit show?
User avatar
gijsje
Posts: 132
Joined: Saturday 19 August 2017 14:28
Target OS: NAS (Synology & others)
Domoticz version: Stable
Location: Berkel Enschot, NL
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by gijsje »

How could i enable this?
On the Toon the graph is ok
Wifi is also working ok as in the the log of the nas i can see the data asked from the Toon.
I also have a Pi USb and there it works ok.
The night tarif is from 23:00 until 07:00 here and with the USB P1 it is ok.
Synology DS218+ - RFXtrx433 - Aeotec Z-Stick Gen5 - Toon Thermostat - Neo CoolCam plug - Neo CoolCam PIR - FIBARO PIR - Heiman Smart Smoke Senso - Neo CoolCam Leakage Detector - BeNext Tag Reader - P1 and S0 USB - many Mi-Light lights - KAKU switches
User avatar
gijsje
Posts: 132
Joined: Saturday 19 August 2017 14:28
Target OS: NAS (Synology & others)
Domoticz version: Stable
Location: Berkel Enschot, NL
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by gijsje »

Something strange i see now.
If i look at the data generated from the script on my nas, it makes a txt file every minut when enabled.
The time for the file itself for this on is 10-3-2018 10:11
But when i look in the file i see this

Code: Select all

Request for FROM date: 10-03-2018
Now: 2018-03-10 17:11:03
Electricity Usage Toon = 400 Watt
Electricity Production Toon = 0 Watt
Electricity LT counter from Toon = 9530159 Wh
Electricity NT counter from Toon = 8221494 Wh
Electricity production counter LT from Toon = 13 Wh
Electricity production counter NT from Toon = 50 Wh
{
   "status" : "OK",
   "title" : "Update Device"
}
The time stamp there is 17:11
So it is off by a few hours.
The time on the nas is set ok.
So i have no clue where is comes from as the time on the toon is also ok
Synology DS218+ - RFXtrx433 - Aeotec Z-Stick Gen5 - Toon Thermostat - Neo CoolCam plug - Neo CoolCam PIR - FIBARO PIR - Heiman Smart Smoke Senso - Neo CoolCam Leakage Detector - BeNext Tag Reader - P1 and S0 USB - many Mi-Light lights - KAKU switches
FunFair
Posts: 52
Joined: Wednesday 04 October 2017 11:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair »

Updated the script again. Re-added the comparisments with domoticz db values.
When I updated my Toon to the latest version, for some reason domoticz wrote a value into the trillions while Toon was updating/rebooting/reconnecting and therefore I had to restore the database.

See new versions attached.
Attachments
p1_meter_v3.1.zip
(5.32 KiB) Downloaded 127 times
FunFair
Posts: 52
Joined: Wednesday 04 October 2017 11:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair »

gijsje wrote: Saturday 10 March 2018 10:15 Something strange i see now.
If i look at the data generated from the script on my nas, it makes a txt file every minut when enabled.
The time for the file itself for this on is 10-3-2018 10:11
But when i look in the file i see this

Code: Select all

Request for FROM date: 10-03-2018
Now: 2018-03-10 17:11:03
Electricity Usage Toon = 400 Watt
Electricity Production Toon = 0 Watt
Electricity LT counter from Toon = 9530159 Wh
Electricity NT counter from Toon = 8221494 Wh
Electricity production counter LT from Toon = 13 Wh
Electricity production counter NT from Toon = 50 Wh
{
   "status" : "OK",
   "title" : "Update Device"
}
The time stamp there is 17:11
So it is off by a few hours.
The time on the nas is set ok.
So i have no clue where is comes from as the time on the toon is also ok
That's strange. Maybe a timezone issue?
What happens if you type in "date" on your NAS? What time is it reporting?

My RPi reports: Mon 12 Mar 13:52:15 CET 2018 which is correct.
My Synology NAS reports the same.

Although the script uses only the date and not the time.
Maybe glsf91 can help?
User avatar
gijsje
Posts: 132
Joined: Saturday 19 August 2017 14:28
Target OS: NAS (Synology & others)
Domoticz version: Stable
Location: Berkel Enschot, NL
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by gijsje »

There is a difference there
I have found that the time/date on the toon is Mon Mar 12 14:42:57 UTC 2018
The time and date on the nas is Mon Mar 12 15:43:34 CET 2018

i made a topic on the domoticaforum how to change the time zone and time
Synology DS218+ - RFXtrx433 - Aeotec Z-Stick Gen5 - Toon Thermostat - Neo CoolCam plug - Neo CoolCam PIR - FIBARO PIR - Heiman Smart Smoke Senso - Neo CoolCam Leakage Detector - BeNext Tag Reader - P1 and S0 USB - many Mi-Light lights - KAKU switches
glsf91
Posts: 58
Joined: Tuesday 14 November 2017 21:56
Target OS: Linux
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by glsf91 »

gijsje wrote: Monday 12 March 2018 15:50 There is a difference there
I have found that the time/date on the toon is Mon Mar 12 14:42:57 UTC 2018
The time and date on the nas is Mon Mar 12 15:43:34 CET 2018

i made a topic on the domoticaforum how to change the time zone and time
That is also the case with my Toon.
In the end it is the same time. CET = UTC +1 (wintertijd)
User avatar
gijsje
Posts: 132
Joined: Saturday 19 August 2017 14:28
Target OS: NAS (Synology & others)
Domoticz version: Stable
Location: Berkel Enschot, NL
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by gijsje »

If i look at this line

Code: Select all

$datum =  date("d-m-Y");
and change it to

Code: Select all

$datum =  date("d-m-Y e");
to add the time zone i do get

Code: Select all

Request for FROM date: 13-03-2018 Asia/Taipei
So i do not know where this date is coming from.
Any suggestion were it is getting the date time from?
Synology DS218+ - RFXtrx433 - Aeotec Z-Stick Gen5 - Toon Thermostat - Neo CoolCam plug - Neo CoolCam PIR - FIBARO PIR - Heiman Smart Smoke Senso - Neo CoolCam Leakage Detector - BeNext Tag Reader - P1 and S0 USB - many Mi-Light lights - KAKU switches
FunFair
Posts: 52
Joined: Wednesday 04 October 2017 11:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair »

gijsje wrote: Monday 12 March 2018 23:58 If i look at this line

Code: Select all

$datum =  date("d-m-Y");
and change it to

Code: Select all

$datum =  date("d-m-Y e");
to add the time zone i do get

Code: Select all

Request for FROM date: 13-03-2018 Asia/Taipei
So i do not know where this date is coming from.
Any suggestion were it is getting the date time from?
I think the timezone settings on your Synology NAS are wrong.
So when it's a new day in asia, it's still an old day in the Netherlands and the script is asking for data from a day that doesn't excist yet.

On your NAS, go to Control Panel --> Regional Options (somewhere in the middle) and change it to (GMT+01:00 Amsterdam)
User avatar
gijsje
Posts: 132
Joined: Saturday 19 August 2017 14:28
Target OS: NAS (Synology & others)
Domoticz version: Stable
Location: Berkel Enschot, NL
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by gijsje »

This is setup ok
Image

Could the time of the php installed on the nas be different?
I have no idea if this one is coming from the nas clock but i guess so.
Synology DS218+ - RFXtrx433 - Aeotec Z-Stick Gen5 - Toon Thermostat - Neo CoolCam plug - Neo CoolCam PIR - FIBARO PIR - Heiman Smart Smoke Senso - Neo CoolCam Leakage Detector - BeNext Tag Reader - P1 and S0 USB - many Mi-Light lights - KAKU switches
FunFair
Posts: 52
Joined: Wednesday 04 October 2017 11:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair »

gijsje wrote: Tuesday 13 March 2018 21:09 This is setup ok
Image

Could the time of the php installed on the nas be different?
I have no idea if this one is coming from the nas clock but i guess so.
I've ran the date script on my synology and I get the same output.

Request for FROM date: 15-03-2018 Asia/Taipei
Now: 2018-03-15 22:19:26
But when I enter 'date' in the prompt it sais: Thu Mar 15 15:19:41 CET 2018

Change your code to:

Code: Select all

/* Get current date */
date_default_timezone_set("Europe/Amsterdam");
echo "Timezone " . date_default_timezone_get() . "\n";
$datum =  date("d-m-Y");
echo "Request for FROM date: " . $datum . "\n";
echo "Now: ". date("Y-m-d H:i:s") . "\n";
For some reason it is not needed to set the timezone of php on RaspberryPi, but it is on Synology.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest