Searching for Solution SetSetpoint to Variabe or =virtualTermostat

Moderator: leecollings

Post Reply
stefanwo
Posts: 16
Joined: Sunday 05 November 2017 12:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Searching for Solution SetSetpoint to Variabe or =virtualTermostat

Post by stefanwo »

Hi all,
i hope anybody could help me with my problem. I alreday searched for my problem and understand thats not possible in Blockly to set a setpoint to a UserVariable or to the stored value in a virtual device. Now i search for solution and hope anybody coould help me with this. Currently i use the following Blockly to controll my Thermostats in the kitchen and the living room:
2020-05-12 20_48_36-Window.png
2020-05-12 20_48_36-Window.png (33.44 KiB) Viewed 330 times
I try to describe what it does.
First it looks for 2 Virtual Devices (Stefan Home; Simone Home), that are connectet with a geofence in the domoticz AndroidApp. If any from them is on it looks for annother 2 virtual devices (Zeitschaltung; Morgens) they are just time-controlled and so i can check if its day or night and if its in the morning or weekend aso.. The next check is, if the Thermostat is already set to the wanted temperatur and if the room temperature is below a specific temperatur.

If all is true it sets the setpoint of the kitchen to 19 degree and the setpoint of the living-room to 24 degrees.

And thats where my problem is. I would like to controll the above temperatures with for example the value i set in the virtual Termostat.

Why? Sometimes my fiance likes it warmer, and sometimes colder (iam sure you know what i mean ;) ) but i cant explain her if she likes to change the temperature she had to open the domoticz goe in to the events, and change the Value in Set Setpoint aso...
If i could tell her to just go in her domoticz app, and change the Value in "LivingRoom" (the virtual thermostat device) everything would be fine ;)

So please help me! Its possible in anyway to do that? Maybe with dzvent, Lua ore something like that? Currently i dont know both, but if you could give me a hint how to do that iam illing to learn ;)

Thanks a lot in advance!
Stefan
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Searching for Solution SetSetpoint to Variabe or =virtualTermostat

Post by waaren »

stefanwo wrote: Tuesday 12 May 2020 21:36 So please help me! Its possible in anyway to do that? Maybe with dzvent, Lua ore something like that? Currently i dont know both, but if you could give me a hint how to do that iam illing to learn ;)
A dzVents approach could look like below. Please note that on my system I could not use the ü So i changed this to u in the script. I included some extra log lines so you can see what states are considered by dzVents.

When not yet familiar with dzVents please start with reading Get started Before implementing (~ 5 minutes). Special attention please for "In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents enabled' is checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."

Code: Select all

return
{
    on =
    {
        devices =
        {
            'Morgens',
            'ZeitSchaltung',
            'SimoneHome',
            'StefanHome',
            'KuchenHeizungPreference', -- new virtual setpoint device
            'WohnzimmerHeizungPreference', -- new virtual setpoint device
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG, -- set to LOG_ERROR when tested and OK
    },

    execute = function(dz , item)

        dz.log( item.name .. ' triggered the script.', dz.LOG_DEBUG)

        local KuchenHeizung = dz.devices('KuchenHeizung')
        local WohnzimmerHeizung = dz.devices('WohnzimmerHeizung')

        local morgens       = dz.devices('Morgens').state == 'On'
        local zeitSchaltung = dz.devices('ZeitSchaltung').state == 'On'
        local SimoneHome    = dz.devices('SimoneHome').state == 'On'
        local StefanHome    = dz.devices('StefanHome').state == 'On'

        dz.log( 'morgens       : ' .. tostring(morgens), dz.LOG_DEBUG)
        dz.log( 'zeitSchaltung : ' .. tostring(zeitSchaltung), dz.LOG_DEBUG)
        dz.log( 'SimoneHome    : ' .. tostring(SimoneHome), dz.LOG_DEBUG)
        dz.log( 'StefanHome    : ' .. tostring(StefanHome), dz.LOG_DEBUG)

        local KuchenSetPoint = dz.devices('KuchenHeizungPreference').setPoint
        local WohnzimmerSetPoint = dz.devices('WohnzimmerHeizungPreference').setPoint

        dz.log( 'KüchenSetPoint     : ' .. KuchenSetPoint, dz.LOG_DEBUG)
        dz.log( 'WohnzimmerSetPoint : ' .. WohnzimmerSetPoint, dz.LOG_DEBUG)

        if ( SimoneHome or StefanHome ) and zeitSchaltung and morgens then
            KuchenHeizung.updateSetPoint(KuchenSetPoint)
            WohnzimmerHeizung.updateSetPoint(WohnzimmerSetPoint)
            dz.notify('Heizung', 'Heizung Wohnzimmer auf '  .. WohnzimmerSetPoint .. ' gesetzt', dz.PRIORITY_NORMAL, nil, nil, dz.NSS_FIREBASE)
        end

    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
stefanwo
Posts: 16
Joined: Sunday 05 November 2017 12:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Searching for Solution SetSetpoint to Variabe or =virtualTermostat

Post by stefanwo »

Thanks a lot!
I will try this after i found a solution for my next problem i cant open the #/setup/ Page. When i try to open the Setup Page it seams that the whole webservice stops and i cant open any domotic site anymore i only can get it to work with "sudo service domoticz.sh restart" until i restart all sites are available again.
But that the wrong board, i will open annother thread for this.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest