Hi!
First of all exuse my baad english.
Im trying to send a email o telegram message when my vaccum start to clean and when it goes back to the dock station. The problem is my script dont send 1 email when the text change the state the script sends many.
commandArray = {}
if (otherdevices_svalues['M-O - Status'] == 'Cleaning')
then
commandArray['SendEmail']='M-O IS cleaning...#M-O Cleaning...#[email protected]'
end
if (otherdevices_svalues['M-O - Status'] == 'Back to home')
then
commandArray['SendEmail']='M-O Going back home...#M-O Returning home...#[email protected]'
end
return commandArray
I have tried this without luck. Now nothing is send.
commandArray = {}
if (devicechanged['M-O - Status'] == 'Cleaning') then
commandArray['SendEmail']='M-O Cleaning...#M-O Cleaning...#[email protected]'
elseif (devicechanged['M-O - Status'] == 'Back to home') then
commandArray['SendEmail']='M-O Returning home...#M-O Returning home...#[email protected]'
end
return commandArray
Anyone knows how to send a telegram message instead a email?
Thanx in advance for your help and regards
Send message at text change Topic is solved
Moderator: leecollings
-
- Posts: 41
- Joined: Monday 19 October 2015 12:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Spain
- Contact:
- jvdz
- Posts: 2269
- Joined: Tuesday 30 December 2014 19:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.107
- Location: Netherlands
- Contact:
Re: Send message at text change
You really should also test for devicechanged['""] in stead of just otherdevices_svalues.
Maybe this works? I have added an print() line to show the actual values in the domoticz log to help with debugging :
Jos
Maybe this works? I have added an print() line to show the actual values in the domoticz log to help with debugging :
Code: Select all
commandArray = {}
if (devicechanged['M-O - Status'] ~= nil then
print("Changed:" .. devicechanged['M-O - Status'] .. " Status:" ..otherdevices_svalues['M-O - Status'])
if (otherdevices_svalues['M-O - Status'] == 'Cleaning')
then
commandArray['SendEmail']='M-O IS cleaning...#M-O Cleaning...#[email protected]'
end
if (otherdevices_svalues['M-O - Status'] == 'Back to home')
then
commandArray['SendEmail']='M-O Going back home...#M-O Returning home...#[email protected]'
end
end
return commandArray
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
-
- Posts: 41
- Joined: Monday 19 October 2015 12:15
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9700
- Location: Spain
- Contact:
Re: Send message at text change
Hello!jvdz wrote: ↑Sunday 01 April 2018 18:55 You really should also test for devicechanged['""] in stead of just otherdevices_svalues.
Maybe this works? I have added an print() line to show the actual values in the domoticz log to help with debugging :JosCode: Select all
commandArray = {} if (devicechanged['M-O - Status'] ~= nil then print("Changed:" .. devicechanged['M-O - Status'] .. " Status:" ..otherdevices_svalues['M-O - Status']) if (otherdevices_svalues['M-O - Status'] == 'Cleaning') then commandArray['SendEmail']='M-O IS cleaning...#M-O Cleaning...#[email protected]' end if (otherdevices_svalues['M-O - Status'] == 'Back to home') then commandArray['SendEmail']='M-O Going back home...#M-O Returning home...#[email protected]' end end return commandArray
Thanks for your help, now it works perfect and I like it.
Now I will try to understand your modification.
Note:
A parenthesis was missing before the first then.
Thanks again.
regards
Who is online
Users browsing this forum: Bing [Bot] and 1 guest