Controlling Toon [HACKED] from Domoticz

For heating/cooling related questions in Domoticz
User avatar
gielie
Posts: 216
Joined: Tuesday 12 January 2016 12:40
Target OS: Raspberry Pi
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by gielie » Thursday 03 May 2018 15:10

I have a strange problem with my Toon P1 script.
The return amount is way too high, about 1.8.10^16.
When i look at the script, it gives nothing, which is right.

Code: Select all

pi@raspberrypi:~/domoticz/scripts/php $ ./p1_meter_data_json.php
Request for FROM date: 03-05-2018
Now: 2018-05-03 15:06:46
Electricity Usage Counter Domoticz = 7941058 Wh
Electricity Production Counter Domoticz = 8110649752 Wh

Electricity Usage Toon = 470 Watt
Electricity Production Toon = 0 Watt
Electricity LT counter from Toon = 4045973 Wh
Electricity NT counter from Toon = 3895103 Wh
Electricity Counter Toon Total = 7941076 Wh
Electricity production counter LT from Toon =  Wh
Electricity production counter NT from Toon =  Wh
Write new value 
{
   "status" : "OK",
   "title" : "Update Device"
the usage is right, how can i solve this
- Vision ZU1401 USB Stick
- Aeotec MultiSensor 6
- FIBARO FGS222
- FIBARO FGWPE Wall Plug
- Everspring AN157
- Neo CoolCam Power plug
- Neo CoolCam PIR Sensor
- Popp Smoke Detector
- Toon
- Kodi Media Server

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

Re: Controlling Toon [HACKED] from Domoticz

Post by FunFair » Friday 04 May 2018 21:03

I
gielie wrote:
Thursday 03 May 2018 15:10
I have a strange problem with my Toon P1 script.
The return amount is way too high, about 1.8.10^16.
When i look at the script, it gives nothing, which is right.

Code: Select all

pi@raspberrypi:~/domoticz/scripts/php $ ./p1_meter_data_json.php
Request for FROM date: 03-05-2018
Now: 2018-05-03 15:06:46
Electricity Usage Counter Domoticz = 7941058 Wh
Electricity Production Counter Domoticz = 8110649752 Wh

Electricity Usage Toon = 470 Watt
Electricity Production Toon = 0 Watt
Electricity LT counter from Toon = 4045973 Wh
Electricity NT counter from Toon = 3895103 Wh
Electricity Counter Toon Total = 7941076 Wh
Electricity production counter LT from Toon =  Wh
Electricity production counter NT from Toon =  Wh
Write new value 
{
   "status" : "OK",
   "title" : "Update Device"
the usage is right, how can i solve this
I sometimes get strang values when the meteradapter has been disconnected. Domoticz needs a day to adjust the values for some reason.
According to the debug echos the script is reading correct values now.

ArieKanarie
Posts: 44
Joined: Saturday 12 December 2015 14:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by ArieKanarie » Monday 07 May 2018 12:23

I'm about to purchase a second hand toon to play with it en connect it to Domoticz.

Maybe a N00b question, but can I control more from domoticz than only the temperature?
As I learned Toon has a Zwave controller, so can I start buying Zwave devices to control them via Domoticz (through Toon)?

User avatar
gielie
Posts: 216
Joined: Tuesday 12 January 2016 12:40
Target OS: Raspberry Pi
Domoticz version: latest β
Location: The Netherlands (Alkmaar)
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by gielie » Monday 07 May 2018 14:44

FunFair wrote:
Friday 04 May 2018 21:03
I
gielie wrote:
Thursday 03 May 2018 15:10
I have a strange problem with my Toon P1 script.
The return amount is way too high, about 1.8.10^16.
When i look at the script, it gives nothing, which is right.

Code: Select all

pi@raspberrypi:~/domoticz/scripts/php $ ./p1_meter_data_json.php
Request for FROM date: 03-05-2018
Now: 2018-05-03 15:06:46
Electricity Usage Counter Domoticz = 7941058 Wh
Electricity Production Counter Domoticz = 8110649752 Wh

Electricity Usage Toon = 470 Watt
Electricity Production Toon = 0 Watt
Electricity LT counter from Toon = 4045973 Wh
Electricity NT counter from Toon = 3895103 Wh
Electricity Counter Toon Total = 7941076 Wh
Electricity production counter LT from Toon =  Wh
Electricity production counter NT from Toon =  Wh
Write new value 
{
   "status" : "OK",
   "title" : "Update Device"
the usage is right, how can i solve this
I sometimes get strang values when the meteradapter has been disconnected. Domoticz needs a day to adjust the values for some reason.
According to the debug echos the script is reading correct values now.
I get this high value for a couple of days now and it is increasing while the production is 0 (no solar collectors connected)
- Vision ZU1401 USB Stick
- Aeotec MultiSensor 6
- FIBARO FGS222
- FIBARO FGWPE Wall Plug
- Everspring AN157
- Neo CoolCam Power plug
- Neo CoolCam PIR Sensor
- Popp Smoke Detector
- Toon
- Kodi Media Server

Stimpy68
Posts: 4
Joined: Wednesday 09 May 2018 16:37
Target OS: Linux
Domoticz version:
Location: The Hague, The Netherlands
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Stimpy68 » Wednesday 09 May 2018 16:44

Hi, I've been running the lua script for some time now and it works great, but today I upgraded from the stable to the beta and now I have this error in the logs:

Code: Select all

Error: EventSystem: UpdateDevice IDX 0 not found!
When I disabled the Toon lua script, the error was gone. So what's the problem here?

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 "/domoticz/scripts/lua/JSON.lua")()  -- For Windows

    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

ArieKanarie
Posts: 44
Joined: Saturday 12 December 2015 14:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by ArieKanarie » Thursday 10 May 2018 0:08

When I try to access a url directly, I get a 403 - Forbidden page:
http://192.168.6.20/happ_thermstat?acti ... ureState=2

I have access to the Zwave webpage and ssh, so I assume the firewall is not the problem?

And additionally: wouldn't it be possible to replace the ugle pink TOON splash screen for something more fancy?

ArieKanarie
Posts: 44
Joined: Saturday 12 December 2015 14:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by ArieKanarie » Thursday 10 May 2018 12:12

THe 403 error is resolved.

Now The temperature won't get updated and i get this error in the log:

Code: Select all

2018-05-10 12:08:00.710 Error: dzVents: Error: ...moticz/scripts/dzVents/generated_scripts/ToonGetInfo.lua:52: attempt to index a nil value
2018-05-10 12:08:00.710 dzVents: Info: ------ Finished ToonGetInfo
2018-05-10 12:08:00.710 EventSystem: Fetching url...
2018-05-10 12:08:00.710 EventSystem: Script event triggered: /home/pi/domoticz/scripts/dzVents/runtime/dzVents.lua
2018-05-10 12:08:00.953 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=command¶m=setsetpoint&idx=583&setpoint=15

ArieKanarie
Posts: 44
Joined: Saturday 12 December 2015 14:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by ArieKanarie » Monday 14 May 2018 12:08

again answering myself:
Solved

Code: Select all

2018-05-10 12:08:00.953 Error: Error opening url: http://127.0.0.1:8080/json.htm?type=command¶m=setsetpoint&idx=583&setpoint=15
Problem was to add 127.0.0.* in the local networks (allow access without password)

The other error

Code: Select all

2018-05-10 12:08:00.710 Error: dzVents: Error: ...moticz/scripts/dzVents/generated_scripts/ToonGetInfo.lua:52: attempt to index a nil value
seems to resolved bu itself, it was still there but haven't seen it since the last 10 minutes.

Stimpy68
Posts: 4
Joined: Wednesday 09 May 2018 16:37
Target OS: Linux
Domoticz version:
Location: The Hague, The Netherlands
Contact:

Re: Controlling Toon [HACKED] from Domoticz

Post by Stimpy68 » Thursday 31 May 2018 12:25

Stimpy68 wrote:
Wednesday 09 May 2018 16:44
Hi, I've been running the lua script for some time now and it works great, but today I upgraded from the stable to the beta and now I have this error in the logs:

Code: Select all

Error: EventSystem: UpdateDevice IDX 0 not found!
When I disabled the Toon lua script, the error was gone. So what's the problem here?
Anybody a clue?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest