Need help to program Blocky

Moderator: leecollings

Post Reply
MartHale
Posts: 21
Joined: Monday 22 May 2017 15:50
Target OS: Windows
Domoticz version:
Contact:

Need help to program Blocky

Post by MartHale »

I have created a blocky program to send to my email each day at 11 AM an email if the battery is full. I have created a battery voltage sensor that works great.

Now, I want to change this code to do the following.

1) If the battery is above 24.0 V then I want it to turn on the water pump for 50 minutes. I then want it to send me an email if either the voltage is too high or too low with the voltage reading.

A. How do I pass the variable value of the voltage meter to the email?

B. How do I trigger a scene from blocky? ( Or do I have to do it via programming? )


Below is a pick of my program so far.

Thanks!!
Attachments
Domotics.png
Domotics.png (169.09 KiB) Viewed 1246 times
MartHale
Posts: 21
Joined: Monday 22 May 2017 15:50
Target OS: Windows
Domoticz version:
Contact:

Re: Need help to program Blocky

Post by MartHale »

Ok I figured out how to start a Scene with Blocky, I just want to know now how to send a value of my voltage monitor to my email with blockiy. I have "Send email with subject" but just need to send the value of my sensor.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Need help to program Blocky

Post by waaren »

MartHale wrote: Saturday 13 July 2019 21:22 Ok I figured out how to start a Scene with Blocky, I just want to know now how to send a value of my voltage monitor to my email with blockiy. I have "Send email with subject" but just need to send the value of my sensor.
I would not know how to do this using Blockly. You are probably better of using one of the other scripting solutions. In dzvents it would look like this

Code: Select all

return 
{
    on = { timer = { 'at 11:00' }}, 

    execute = function( dz )
        local sensor = dz.devices('Tesla Battery 24V')
        
        if sensor.voltage >= 24 then
            local subject = sensor.name .. ' voltage report'
            local message = 'voltage measured at ' .. dz.time.rawDate .. ' ' .. dz.time.rawTime .. ' is ' .. sensor.voltage .. ' volt.'
            local addressee = '[email protected]'
            
            dz.email(subject, message, addressee)
        end
    end
}

When not yet familiar with dzVents please start with reading Get started Before implementing. Special attention please for
"In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents disabled' is not 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."
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
MartHale
Posts: 21
Joined: Monday 22 May 2017 15:50
Target OS: Windows
Domoticz version:
Contact:

Re: Need help to program Blocky

Post by MartHale »

Thank you for your help that gives me a good direction to get the task completed. It is good to know the limitations of Blocky, and that another way of scripting this can get the job done.



Mart
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest