Question about notifications in dzVents
Moderator: leecollings
-
schulpr
- Posts: 137
- Joined: Thursday 01 January 2015 9:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Question about notifications in dzVents
Hi,
I'm rebuilding some of my LUA scripts to dzVents scripts. I have a question about the notifications.
In LUA I can send a notification to a specific device like this:
notificatie = "Mieke aanwezig#Mieke is het huis binnengekomen. Om "..(tijd).." is de telefoon geactiveerd.#0#Magic#iPhoneRob"
commandArray['SendNotification'] = (notificatie)
In dzVents I'm doing this for now:
domoticz.notify('Mieke aanwezig!','Mieke is het huis binnengekomen. Om '..(tijdstip)..' is de telefoon geactiveerd.',SOUND_MAGIC,domoticz.PRIORITY_LOW,domoticz.NSS_PUSHOVER)
How can I send a notification to a specific device in dzVents?
What is the purpose of the parameter "extra" in the string "notify(subject, message, priority, sound, extra, subsystem)"?
I use Pushover as notification system.
Thanks for the help.
Kind regards, Rob
I'm rebuilding some of my LUA scripts to dzVents scripts. I have a question about the notifications.
In LUA I can send a notification to a specific device like this:
notificatie = "Mieke aanwezig#Mieke is het huis binnengekomen. Om "..(tijd).." is de telefoon geactiveerd.#0#Magic#iPhoneRob"
commandArray['SendNotification'] = (notificatie)
In dzVents I'm doing this for now:
domoticz.notify('Mieke aanwezig!','Mieke is het huis binnengekomen. Om '..(tijdstip)..' is de telefoon geactiveerd.',SOUND_MAGIC,domoticz.PRIORITY_LOW,domoticz.NSS_PUSHOVER)
How can I send a notification to a specific device in dzVents?
What is the purpose of the parameter "extra" in the string "notify(subject, message, priority, sound, extra, subsystem)"?
I use Pushover as notification system.
Thanks for the help.
Kind regards, Rob
-
dannybloe
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: Question about notifications in dzVents
Hi Rob,
That's a very good question. The api for sending notifications is very badly documented. I believe, from reading the C++ code that extraData is indeed the device. That's the 5th part in your traditional notifcation string. In dzVents that's the extra argument.
The thing is that what this extra does is dependent on the notification subsystem you use. It's up to them to deal with this extra data.
Let me know if that works for you. I'll update the dzVents docs for this information.
That's a very good question. The api for sending notifications is very badly documented. I believe, from reading the C++ code that extraData is indeed the device. That's the 5th part in your traditional notifcation string. In dzVents that's the extra argument.
The thing is that what this extra does is dependent on the notification subsystem you use. It's up to them to deal with this extra data.
Let me know if that works for you. I'll update the dzVents docs for this information.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
schulpr
- Posts: 137
- Joined: Thursday 01 January 2015 9:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: Question about notifications in dzVents
Hi,
I tried putting the name of my iPhone in the "extra" field without success so far. With and without quotes, as variable, etc. messages are send to all devices still. If you have a suggestion, please let me know.
Thanks for all the good work you are doing with dzVents!
Rob
I tried putting the name of my iPhone in the "extra" field without success so far. With and without quotes, as variable, etc. messages are send to all devices still. If you have a suggestion, please let me know.
Thanks for all the good work you are doing with dzVents!
Rob
-
dannybloe
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: Question about notifications in dzVents
Can you activate the debug logging mode in the settings and see in the logs what kind of commandArray it builds up that is sent back to Domoticz? (don't forget to disable debugging afterwards).
It should build the same command as when you did this before without dzVents.
It should build the same command as when you did this before without dzVents.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
schulpr
- Posts: 137
- Joined: Thursday 01 January 2015 9:10
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Contact:
Re: Question about notifications in dzVents
Do you mean the setting for logging in dzVents or the general logging of Domoticz? I see a lot of log files in /var/log. Is this the correct place were I have to look?
Rob
Rob
-
dannybloe
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: Question about notifications in dzVents
No, the dzvents debug logging mode (see settings > other), dropdown. That will log the commandArray as it is being sent back to domoticz.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
dannybloe
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: Question about notifications in dzVents
Have you figured it out?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
Quax1507
- Posts: 101
- Joined: Tuesday 07 April 2015 21:29
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Question about notifications in dzVents
Did this ever get resolved?
I am moving to to dzvents at the moment and cannot send selective notifications.
I thied this in dzvents:
Debug in dzvents says:
Notifications are also sent by email...
I am moving to to dzvents at the moment and cannot send selective notifications.
I thied this in dzvents:
Code: Select all
domoticz.notify('ALARM STATUS','Alarmanlage aktiviert!',SOUND_MAGIC,domoticz.PRIORITY_LOW,domoticz.NSS_PROWL)Code: Select all
SendNotification: ALARM STATUS#Alarmanlage aktiviert!#0#-2#prowl# -
acaonweb
- Posts: 92
- Joined: Thursday 23 March 2017 14:18
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Question about notifications in dzVents
extra is the device
i'm using pushover, and i've registred many devices, one of them is called iPhone6S
the notification is sent only to that device called 'iPhone6S
i'm using pushover, and i've registred many devices, one of them is called iPhone6S
Code: Select all
domoticz.notify('Notifica Aerazione','Chiudere le finestre',PRIORITY_NORMAL,'siren','iPhone6S',domoticz.NSS_PUSHOVER)
-
DAVIZINHO
- Posts: 234
- Joined: Sunday 27 August 2017 18:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Spain
- Contact:
Re: Question about notifications in dzVents
Hello,
Im looking for information about the domoticz.notify() and i find it for some cases
Now I have 3 notification subsystem:
- GCM
- KODI
- TELEGRAM
And im trying to send notifications from dzvents selecting the subsystem, but for telegram the notification send to all subsystem
I can send only to kodi with this syntaxis:
AND if i want to send a notification only to GCM I use this syntaxis:
anyone knows how can i send notification only throw TELEGRAM?
thanks a lot
-David-
Im looking for information about the domoticz.notify() and i find it for some cases
Now I have 3 notification subsystem:
- GCM
- KODI
- TELEGRAM
And im trying to send notifications from dzvents selecting the subsystem, but for telegram the notification send to all subsystem
I can send only to kodi with this syntaxis:
Code: Select all
domoticz.notify('CUSTOM_TITLE', 'CUSTOM_TEXT', domoticz.PRIORITY_NORMAL, domoticz.SOUND_NONE,'', domoticz.NSS_KODI)Code: Select all
domoticz.notify('CUSTOM_TITLE', 'CUSTOM_TEXT', domoticz.PRIORITY_NORMAL, domoticz.SOUND_NONE,'', domoticz.NSS_GOOGLE_CLOUD_MESSAGING)thanks a lot
-David-
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Question about notifications in dzVents
I don't think it is implemented as a standard in dzVents but @papoo did put a small helper function on GIT earlier this year.
Code: Select all
local function telegram(msg)
domoticz.openURL('https://api.telegram.org/bot"your BOT API key"/sendMessage?chat_id="Your chat-ID"&text=' .. msg)
endDebian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
DAVIZINHO
- Posts: 234
- Joined: Sunday 27 August 2017 18:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Spain
- Contact:
Re: Question about notifications in dzVents
yes, now i use the https command to send telegram and works like a charm.
But I the subsystem is configure, why dont use it?
But I the subsystem is configure, why dont use it?
-
Xavier82
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: Question about notifications in dzVents
Picking up an old thread...sorry for that...
I would like to achive the next thing.
I want Domoticz to send a message to Telegram to a specific both Called "Notification".
The message which I would like to send is data based on a lua script which can be found here https://www.huizebruin.nl/domoticz/hand ... n-per-dag/, its in dutch.
This LUA script is written to sent power consumption in kWh and Euro and power production/delivery (solarpanels) in a clear format.
This has to be done 1 time a day.
The issue I encounter is that I don't know how to send this to a specific bot.
I found this code but don't know how to implement...
So after text= the textmessage should the message/output in the lua script.
I hope somebody can help me with this
I would like to achive the next thing.
I want Domoticz to send a message to Telegram to a specific both Called "Notification".
The message which I would like to send is data based on a lua script which can be found here https://www.huizebruin.nl/domoticz/hand ... n-per-dag/, its in dutch.
This LUA script is written to sent power consumption in kWh and Euro and power production/delivery (solarpanels) in a clear format.
This has to be done 1 time a day.
The issue I encounter is that I don't know how to send this to a specific bot.
I found this code but don't know how to implement...
Code: Select all
local function telegram(msg)
domoticz.openURL('https://api.telegram.org/bot"your BOT API key"/sendMessage?chat_id="Your chat-ID"&text=' .. msg)
endI hope somebody can help me with this
- waltervl
- Posts: 6691
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Question about notifications in dzVents
For Lua see the command array here viewtopic.php?t=14884#p116009
For that you have to have the telegram subsystem active in Domoticz: https://www.domoticz.com/wiki/Telegram_notification
For that you have to have the telegram subsystem active in Domoticz: https://www.domoticz.com/wiki/Telegram_notification
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- waltervl
- Posts: 6691
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Question about notifications in dzVents
And the Lua alternative of DzVents openURL is (it is the other way around....
)
Code: Select all
commandArray['OpenURL']='https://api.telegram.org/bot"your BOT API key"/sendMessage?chat_id="Your chat-ID"&text=' .. msg'Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
Xavier82
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: Question about notifications in dzVents
Thanks for the replies Walter, I have the notification subsystems active for Telegram, thats not the issue.
The issue is that I don't know how/don't understand how I can integrate the commandArray in the LUA OpenURL so the messege is being sent.
This is the code I have now:
As seen I have blocked the last part of the code.
The thing I'm missing is the last part to sent the message:
to the newbot named "Notification"
The issue is that I don't know how/don't understand how I can integrate the commandArray in the LUA OpenURL so the messege is being sent.
This is the code I have now:
Code: Select all
local ScriptVersion = '03/01/2023-/-v1.13' -- domoticz > V2022.2 / dzVents >= 3.1.7
return {
on = {
timer = { 'at 23:59' },
},
logging = {
level = domoticz.LOG_DEBUG, -- set to error when all OK
marker = "Dag verbruik in euros " .. ScriptVersion },
execute = function(dz)
print('Dag verbruik in euros')
local subject = (dz.moduleLabel or 'Mijn Energie Overzicht'):gsub('#','')
--Devices
local vandaagKwh = dz.devices('Power').counterToday -- Stroommeter P1 device verbruik
local vandaagKwhzon = dz.devices('Teruglevering').counterToday -- Stroommeter p1 -Teruglevering
local vandaagKwhth = dz.devices('Teruglevering Hoog').counterToday -- Stroommeter p1 -Teruglevering Hoog
local vandaagKwhtl = dz.devices('Teruglevering Laag').counterToday -- Stroommeter p1 -Teruglevering Laag
local vandaagKwhvh = dz.devices('Verbruik Hoog').counterToday -- Stroommeter p1 -Verbruik Hoog
local vandaagKwhvl = dz.devices('Verbruik Laag').counterToday -- Stroommeter p1 -Verbruik Laag
local vandaagM3Gas = dz.devices('Gas').counterToday -- Gasmeter P1 device
-- local vandaagM3Water = dz.devices('Water').counterToday -- Watermeter pulsmeter device
-- Vaste kosten in Euro's per dag (zoals vastrecht)
local gasM3PrijsVast = 0.72433
local gasM3Prijs = 1.45
-- local waterM3PrijsVast = 0.1266
-- local waterM3Prijs = 0.00057
local kwhPrijsVast = 0.94661
--Hierboven is geen Daltarief en normaal tarief geld niet vooor gas en water
if (dz.time == 'Between 21:00 and 07:00') or (dz.day == 'Saturday') or (dz.day == 'Sunday') then
kwhPrijs = 0.40 -- Daltarief
else kwhPrijs = 0.40 -- Normaal tarief
end
--Verzend informatie. Dit is 1 bericht, met alle informatie. regels uit -- ervoor anders ze ervoor weg halen om te krijgen
local subject = 'Mijn Energie overzicht : '
local message = 'Mijn Energie Overzicht : ' .. os.date("%d-%m-%Y")..'\n' ..
'--------------P1 Elektriciteitmeter-----------' .. '\n' ..
'Stroomkosten Totaal : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwh) + kwhPrijsVast,2)).. '\n' ..
'Stroomkosten Hoog : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhvh) ,2)).. '\n' ..
'Stroomkosten Laag : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhvl) ,2)).. '\n' ..
'Teruglevering Hoog : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhth) ,2)).. '\n' ..
'Teruglevering Laag : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhtl) ,2)).. '\n' ..
'---------------------------------------------------' .. '\n' ..
'Verbruik Hoog : ' ..vandaagKwhvh.. ' kWh'.. '\n' ..
'Verbruik Laag : ' ..vandaagKwhvl.. ' kWh'.. '\n' ..
'Teruglevering Hoog : ' ..vandaagKwhth.. ' kWh' .. '\n' ..
'Teruglevering Laag : ' ..vandaagKwhtl.. ' kWh' .. '\n' ..
'Totaal Verbruik Elektra vandaag : ' ..vandaagKwh.. ' kWh'.. '\n' ..
'--------------P1 Gasmeter---------------------' .. '\n' ..
'Gas M3 : € ' .. tonumber(dz.utils.round( (gasM3Prijs * vandaagM3Gas) + gasM3PrijsVast,2))..'\n' ..
'Totaal Verbruik Gas vandaag : ' ..vandaagM3Gas.. ' M3'.. '\n' ..
-- '--------------Watermeter----------------------' .. '\n' ..
-- 'Water : € ' .. tonumber(dz.utils.round( (waterM3Prijs * vandaagM3Water)/1000 + waterM3PrijsVast,2))..'\n' ..
-- 'Totaal Verbruik Water vandaag : ' ..vandaagM3Water.. ' M3'.. '\n' ..
'--------------Zonnepanelen--------------------' .. '\n' ..
'Totaal Opbrengst Zonnepanelen : ' ..vandaagKwhzon.. ' kWh'.. '\n' ..
'Zonopbrengst Totaal € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhzon) + kwhPrijsVast,2))..'\n' ..
'-------------- Einde Dag Overzicht -------------'
-- Notificatie voor verschillende aanbieders
-- dz.notify(subject, message, dz.PRIORITY_MEDIUM, dz.SOUND_PERSISTENT, nil, dz.NSS_TELEGRAM)
--local function telegram(msg)
-- commandArray['OpenURL'] 'https://api.telegram.org/botnewnumber:newAPI/sendMessage?chat_id=chatID "same as subsystem"&text=' .. msg
--end
end
}The thing I'm missing is the last part to sent the message:
Code: Select all
-Verzend informatie. Dit is 1 bericht, met alle informatie. regels uit -- ervoor anders ze ervoor weg halen om te krijgen
local subject = 'Mijn Energie overzicht : '
local message = 'Mijn Energie Overzicht : ' .. os.date("%d-%m-%Y")..'\n' ..
'--------------P1 Elektriciteitmeter-----------' .. '\n' ..
'Stroomkosten Totaal : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwh) + kwhPrijsVast,2)).. '\n' ..
'Stroomkosten Hoog : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhvh) ,2)).. '\n' ..
'Stroomkosten Laag : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhvl) ,2)).. '\n' ..
'Teruglevering Hoog : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhth) ,2)).. '\n' ..
'Teruglevering Laag : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhtl) ,2)).. '\n' ..
'---------------------------------------------------' .. '\n' ..
'Verbruik Hoog : ' ..vandaagKwhvh.. ' kWh'.. '\n' ..
'Verbruik Laag : ' ..vandaagKwhvl.. ' kWh'.. '\n' ..
'Teruglevering Hoog : ' ..vandaagKwhth.. ' kWh' .. '\n' ..
'Teruglevering Laag : ' ..vandaagKwhtl.. ' kWh' .. '\n' ..
'Totaal Verbruik Elektra vandaag : ' ..vandaagKwh.. ' kWh'.. '\n' ..
'--------------P1 Gasmeter---------------------' .. '\n' ..
'Gas M3 : € ' .. tonumber(dz.utils.round( (gasM3Prijs * vandaagM3Gas) + gasM3PrijsVast,2))..'\n' ..
'Totaal Verbruik Gas vandaag : ' ..vandaagM3Gas.. ' M3'.. '\n' ..
-- '--------------Watermeter----------------------' .. '\n' ..
-- 'Water : € ' .. tonumber(dz.utils.round( (waterM3Prijs * vandaagM3Water)/1000 + waterM3PrijsVast,2))..'\n' ..
-- 'Totaal Verbruik Water vandaag : ' ..vandaagM3Water.. ' M3'.. '\n' ..
'--------------Zonnepanelen--------------------' .. '\n' ..
'Totaal Opbrengst Zonnepanelen : ' ..vandaagKwhzon.. ' kWh'.. '\n' ..
'Zonopbrengst Totaal € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhzon) + kwhPrijsVast,2))..'\n' ..
'-------------- Einde Dag Overzicht -------------'- waltervl
- Posts: 6691
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Question about notifications in dzVents
OK, you got me completely confused here....
So you have the Lua script converted to DzVents and now you want to send a message to telegram from that script.
If you want to send it to the telegram Bot as defined in your Domoticz Setup - Settings - Notification you use the dzVents function:
Variables subject and message are available in the script so this should work.
If you want to send it to another telegram Bot, different from the one set in DomoticzSetup - Settings - Notification, you use the the open url one
change "your BOT API key" and "Your chat-ID" to real values.
So you have the Lua script converted to DzVents and now you want to send a message to telegram from that script.
If you want to send it to the telegram Bot as defined in your Domoticz Setup - Settings - Notification you use the dzVents function:
Code: Select all
dz.notify(subject, message, dz.PRIORITY_MEDIUM, dz.SOUND_PERSISTENT, nil, dz.NSS_TELEGRAM)If you want to send it to another telegram Bot, different from the one set in DomoticzSetup - Settings - Notification, you use the the open url one
Code: Select all
dz.openURL('https://api.telegram.org/bot"your BOT API key"/sendMessage?chat_id="Your chat-ID"&text=' .. message) Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
Xavier82
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: Question about notifications in dzVents
Sorry for the confusion....
So I used the manual from https://www.huizebruin.nl/domoticz/hand ... n-per-dag/ to get this job done.
I created an event of type DzVents Timer, so forget the LUA (there is no LUA) my mistake.
I indeed want to use a another telegram Bot, different from the one set in DomoticzSetup.
This is the code I now have:
Nothing happens, nothing is being sent to Telegram, no errors in the error log of Domoticz.
I'm missing out on the part where ".. msg)" is.
So I used the manual from https://www.huizebruin.nl/domoticz/hand ... n-per-dag/ to get this job done.
I created an event of type DzVents Timer, so forget the LUA (there is no LUA) my mistake.
I indeed want to use a another telegram Bot, different from the one set in DomoticzSetup.
This is the code I now have:
Code: Select all
local ScriptVersion = '03/01/2023-/-v1.13' -- domoticz > V2022.2 / dzVents >= 3.1.7
return {
on = {
timer = { 'at 11:50' },
},
logging = {
level = domoticz.LOG_DEBUG, -- set to error when all OK
marker = "Dag verbruik in euros " .. ScriptVersion },
execute = function(dz)
print('Dag verbruik in euros')
local subject = (dz.moduleLabel or 'Mijn Energie Overzicht'):gsub('#','')
--Devices
local vandaagKwh = dz.devices('Power').counterToday -- Stroommeter P1 device verbruik
local vandaagKwhzon = dz.devices('Teruglevering').counterToday -- Stroommeter p1 -Teruglevering
local vandaagKwhth = dz.devices('Teruglevering Hoog').counterToday -- Stroommeter p1 -Teruglevering Hoog
local vandaagKwhtl = dz.devices('Teruglevering Laag').counterToday -- Stroommeter p1 -Teruglevering Laag
local vandaagKwhvh = dz.devices('Verbruik Hoog').counterToday -- Stroommeter p1 -Verbruik Hoog
local vandaagKwhvl = dz.devices('Verbruik Laag').counterToday -- Stroommeter p1 -Verbruik Laag
local vandaagM3Gas = dz.devices('Gas').counterToday -- Gasmeter P1 device
-- local vandaagM3Water = dz.devices('Water').counterToday -- Watermeter pulsmeter device
-- Vaste kosten in Euro's per dag (zoals vastrecht)
local gasM3PrijsVast = 0.72433
local gasM3Prijs = 1.45
-- local waterM3PrijsVast = 0.1266
-- local waterM3Prijs = 0.00057
local kwhPrijsVast = 0.94661
--Hierboven is geen Daltarief en normaal tarief geld niet vooor gas en water
if (dz.time == 'Between 21:00 and 07:00') or (dz.day == 'Saturday') or (dz.day == 'Sunday') then
kwhPrijs = 0.40 -- Daltarief
else kwhPrijs = 0.40 -- Normaal tarief
end
--Verzend informatie. Dit is 1 bericht, met alle informatie. regels uit -- ervoor anders ze ervoor weg halen om te krijgen
local subject = 'Mijn Energie overzicht : '
local message = 'Mijn Energie Overzicht : ' .. os.date("%d-%m-%Y")..'\n' ..
'--------------P1 Elektriciteitmeter-----------' .. '\n' ..
'Stroomkosten Totaal : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwh) + kwhPrijsVast,2)).. '\n' ..
'Stroomkosten Hoog : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhvh) ,2)).. '\n' ..
'Stroomkosten Laag : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhvl) ,2)).. '\n' ..
'Teruglevering Hoog : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhth) ,2)).. '\n' ..
'Teruglevering Laag : € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhtl) ,2)).. '\n' ..
'---------------------------------------------------' .. '\n' ..
'Verbruik Hoog : ' ..vandaagKwhvh.. ' kWh'.. '\n' ..
'Verbruik Laag : ' ..vandaagKwhvl.. ' kWh'.. '\n' ..
'Teruglevering Hoog : ' ..vandaagKwhth.. ' kWh' .. '\n' ..
'Teruglevering Laag : ' ..vandaagKwhtl.. ' kWh' .. '\n' ..
'Totaal Verbruik Elektra vandaag : ' ..vandaagKwh.. ' kWh'.. '\n' ..
'--------------P1 Gasmeter---------------------' .. '\n' ..
'Gas M3 : € ' .. tonumber(dz.utils.round( (gasM3Prijs * vandaagM3Gas) + gasM3PrijsVast,2))..'\n' ..
'Totaal Verbruik Gas vandaag : ' ..vandaagM3Gas.. ' M3'.. '\n' ..
-- '--------------Watermeter----------------------' .. '\n' ..
-- 'Water : € ' .. tonumber(dz.utils.round( (waterM3Prijs * vandaagM3Water)/1000 + waterM3PrijsVast,2))..'\n' ..
-- 'Totaal Verbruik Water vandaag : ' ..vandaagM3Water.. ' M3'.. '\n' ..
'--------------Zonnepanelen--------------------' .. '\n' ..
'Totaal Opbrengst Zonnepanelen : ' ..vandaagKwhzon.. ' kWh'.. '\n' ..
'Zonopbrengst Totaal € ' .. tonumber(dz.utils.round( (kwhPrijs * vandaagKwhzon) + kwhPrijsVast,2))..'\n' ..
'-------------- Einde Dag Overzicht -------------'
-- Notificatie voor verschillende aanbieders
-- dz.notify(subject, message, dz.PRIORITY_MEDIUM, dz.SOUND_PERSISTENT, nil, dz.NSS_TELEGRAM)
local function telegram(msg)
dz.openURL('https://api.telegram.org/botXXX:XXXX/sendMessage?chat_id=XXXXX&text=' .. msg)
end
end
}I'm missing out on the part where ".. msg)" is.
- waltervl
- Posts: 6691
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Question about notifications in dzVents
As I showed in my example replace msg in message and it should work.
Also you can check in a browser the url to see if it works
Also you can check in a browser the url to see if it works
Code: Select all
https://api.telegram.org/botXXX:XXXX/sendMessage?chat_id=XXXXX&text=' Test message'Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
Xavier82
- Posts: 178
- Joined: Tuesday 07 June 2016 22:09
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Netherlands
- Contact:
Re: Question about notifications in dzVents
When using
I do get the message "test" in Telegram, but in that case it only contains the word "Test" instead of:
Mijn Energie Overzicht : 05-01-2023
--------------P1 Elektriciteitsmeter-----------
Stroomkosten Totaal : € 1.00
Stroomkosten Hoog : €0.80
Stroomkosten Laag : € 0.20
Teruglevering Hoog : €0.80
Teruglevering Laag : € 0
---------------------------------------------------
Verbruik Hoog : 16 kWh
Verbruik Laag : 3 kWh
Teruglevering Hoog : 1 kWh
Teruglevering Laag : 0 kWh
Totaal Verbruik Elektra vandaag : 19 kWh
--------------P1 Gasmeter---------------------
Gas M3 : € 1.33
Totaal Verbruik Gas vandaag : 0.9
--------------Zonnepanelen--------------------
Totaal Opbrengst Zonnepanelen : 1 kWh
Zonopbrengst Totaal € 0.80
-------------- Einde Dag Overzicht -------------
Code: Select all
dz.openURL('https://api.telegram.org/botXXX:XXXX/sendMessage?chat_id=XXXXX&text=test')Mijn Energie Overzicht : 05-01-2023
--------------P1 Elektriciteitsmeter-----------
Stroomkosten Totaal : € 1.00
Stroomkosten Hoog : €0.80
Stroomkosten Laag : € 0.20
Teruglevering Hoog : €0.80
Teruglevering Laag : € 0
---------------------------------------------------
Verbruik Hoog : 16 kWh
Verbruik Laag : 3 kWh
Teruglevering Hoog : 1 kWh
Teruglevering Laag : 0 kWh
Totaal Verbruik Elektra vandaag : 19 kWh
--------------P1 Gasmeter---------------------
Gas M3 : € 1.33
Totaal Verbruik Gas vandaag : 0.9
--------------Zonnepanelen--------------------
Totaal Opbrengst Zonnepanelen : 1 kWh
Zonopbrengst Totaal € 0.80
-------------- Einde Dag Overzicht -------------
Who is online
Users browsing this forum: No registered users and 1 guest