Page 11 of 18
Re: Sharing : Afval kalendar in text sensor
Posted: Thursday 02 May 2019 18:30
by Gravityz
Thanks Jos,
this is what i did(i seem to have a different script)
i thought they killed this functionality but it seems it still works with text devices (not in the logging)
Code: Select all
if txtcnt < ShowNextEvents then
stextformat = stextformat:gsub('ldesc',rdesc[web_afvaltype:upper().."_L"])
stextformat = stextformat:gsub('sdesc',web_afvaltype)
if txtcnt == 0 then
txt = txt..'<font color="red">'..stextformat..'</font>'.."\r\n"
txtcnt = txtcnt + 1
else
txt = txt..stextformat.."\r\n"
txtcnt = txtcnt + 1
end
Re: Sharing : Afval kalendar in text sensor
Posted: Thursday 02 May 2019 19:20
by jvdz
Correct, the html color stuff isn't working in the domoticz log since quite some time as that information is now logged raw to ensure you get all the data without HTML interfering (as far as I know. So it only works in the device on the normal theme.
Jos
Re: Sharing : Afval kalendar in text sensor
Posted: Friday 03 May 2019 9:21
by AllesVanZelf
Great work Zicht and JvdZ!
Afvalkalender.meerlanden.nl is using Opzet too. Good news.
Meerlanden Collects garbage in the regions: Aalsmeer, Bloemendaal, Diemen, Haarlemmerliede en Spaarnwoude, Haarlemmermeer, Heemstede, Hillegom, Lisse of Noordwijk.
I used the Opstal script and had to change: some items:
- ["Plastic, Blik en Drinkpakken"]
- ["Papier"]
And changed one dummy to Takken: ["Takken"]
On Github I see a file: alvalwijzerconfig.lua.example. This script contains the configuration part of the script. Can I use this aside script_time_huisvuil-opzet.lua? And how would this work then?
Re: Sharing : Afval kalendar in text sensor
Posted: Friday 03 May 2019 11:01
by jvdz
AllesVanZelf wrote: ↑Friday 03 May 2019 9:21
I used the Opstal script and had to change: some items:
- ["Plastic, Blik en Drinkpakken"]
- ["Papier"]
And changed one dummy to Takken: ["Takken"]
@AllesVanZelf,
It is to be expected that you need to modify the table as each gemeente can have their own definitions in there.
I wouldn't use the dummy records but simply add a new record to the table.
AllesVanZelf wrote: ↑Friday 03 May 2019 9:21
On Github I see a file: alvalwijzerconfig.lua.example. This script contains the configuration part of the script. Can I use this aside script_time_huisvuil-opzet.lua? And how would this work then?
Just put your config in that file and rename it to alvalwijzerconfig.lua. That will override the definitions in script_time_huisvuil-opzet.lua.
This makes upgrading simple as you can now simply replace the main script_time_huisvuil-opzet.lua, when there's an update, without loosing your configuration settings.
Jos
Re: Sharing : Afval kalendar in text sensor
Posted: Friday 03 May 2019 12:31
by AllesVanZelf
If I uncomment in Afvalwijzerconfig.lua (alvalwijzerconfig.lua is a type??) do I leave the ~ in front of the line?
Just remove the -- ?
The missing local is the override trick here?
Re: Sharing : Afval kalendar in text sensor
Posted: Friday 03 May 2019 13:44
by jvdz
My apologies, I have never put that bit of logic from script_time_afvalwijzer.lua in the script_time_huisvuil-opzet.lua script.
Could you try the current version in GitHub to see if that fies it and works for you?
Thanks,
Jos
Re: Sharing : Afval kalendar in text sensor
Posted: Monday 06 May 2019 9:30
by AllesVanZelf
He Jos, Thank you for this update.
At first, I saved both: afvalwijzerconfig.lua and script_time_huisvuil-opzet.lua in domoticz/scripts/lua.
Changed the values in afvalwijzerconfig.lua.
Is there no " hostname = " missing from afvalwijzerconfig.lua?
For some reason this does not work. No log at all. although debug level set to true.
Then I tried the afvalwijzerconfig in the internal script editor and first as type 'time' and then as 'user variable' and beside this afvalwijzerconfig script_time_huisvuil-opzet.lua as time lua script. But only the last one was executed. But with wrong values.
Now I put all the config in script_time_huisvuil-opzet.lua and copied the content to the internal script editor from domoticz. Then everything is working.
Is there a reason, putting scripts in domoticz/scripts/lua, will not work?
Re: Sharing : Afval kalendar in text sensor
Posted: Monday 06 May 2019 12:53
by jvdz
AllesVanZelf wrote: ↑Monday 06 May 2019 9:30
He Jos, Thank you for this update.
At first, I saved both: afvalwijzerconfig.lua and script_time_huisvuil-opzet.lua in domoticz/scripts/lua.
Changed the values in afvalwijzerconfig.lua.
Is there no " hostname = " missing from afvalwijzerconfig.lua?
Could be things missing as it is a generic one used for all the different master scripts. Just add that stuff to it that you need.
AllesVanZelf wrote: ↑Monday 06 May 2019 9:30
For some reason this does not work. No log at all. although debug level set to true.
Then I tried the afvalwijzerconfig in the internal script editor and first as type 'time' and then as 'user variable' and beside this afvalwijzerconfig script_time_huisvuil-opzet.lua as time lua script. But only the last one was executed. But with wrong values.
Now I put all the config in script_time_huisvuil-opzet.lua and copied the content to the internal script editor from domoticz. Then everything is working.
Just send the 2 files to my github email please so I can have a look for you what is happening, as it is not giving any issues for me.
(pm me when you can find the email address)
Jos
Re: Sharing : Afval kalendar in text sensor
Posted: Tuesday 07 May 2019 20:46
by dheuts
Good evening,
I just found this great idea:
https://www.domoticz.com/forum/viewtopi ... 40#p208747
This is made with another script, I use your RD4 script:
https://github.com/jvanderzande/mijnafv ... imburg-rd4
Thanks, it's great! Do you think it's possible to make something like stephanvdplas made is also possible with the dates from your RD4 script?
I hope someone of the scripters also think it's great and know how to make this?
Thanks, nice evening.
Re: Sharing : Afval kalendar in text sensor
Posted: Wednesday 08 May 2019 20:00
by hoeby
I had this script working, but made a mistake.
Put a backup on it, but don't know what i did wrong. When adding de backup, the script doesn't work.
But can't find why. It finds the date, but the text device isn't updatet
Tested the text device to write with json, that worked
The debug = true doesn't help me, what i am doing wrong. Somebody has an idea?
Code: Select all
2019-05-08 19:57:00.737 Status: dzVents: @AFEcht:SNOEIAFVAL 03-10-2019=148
2019-05-08 19:57:00.737 Status: dzVents: @AFEcht:REST 15-05-2019=7
2019-05-08 19:57:00.737 Status: dzVents: @AFEcht:PLASTIC 01-06-2019=24
2019-05-08 19:57:00.737 Status: dzVents: @AFEcht:GFT 08-05-2019=0
2019-05-08 19:57:00.737 Status: dzVents: @AFEcht:- Sorting records in the right sequence.
2019-05-08 19:57:00.737 Status: dzVents: @AFEcht:-End --------------------------------------------------------------------------------------------
2019-05-08 19:57:00.737 Status: dzVents: @AFEcht Found: GFT-08-05-2019 ; REST-15-05-2019 ; GFT-22-05-2019 ; REST-29-05-2019 ;
2019-05-08 19:57:00.738 Error: dzVents: @AFEcht Error: Couldn't get the current data from Domoticz text device AfvalAlgemeen
Re: Sharing : Afval kalendar in text sensor
Posted: Wednesday 08 May 2019 20:49
by jvdz
hoeby wrote: ↑Wednesday 08 May 2019 20:00
I had this script working, but made a mistake.
Code: Select all
-snip-
2019-05-08 19:57:00.738 Error: dzVents: @AFEcht Error: Couldn't get the current data from Domoticz text device AfvalAlgemeen
The error is on the last line.
So what is the exact name of your Domoticz Text device that should contain this information?
Jos
Re: Sharing : Afval kalendar in text sensor
Posted: Wednesday 08 May 2019 20:57
by hoeby
The name of the device is "AfvalAlgemeen"
To be sure, i copied it and paste it in the script, to avoid typo's
I saw that the error was on the last line.
Therefor i did the json test, if the device will change its information, that works.
But the scripts doesn't change the text information
Re: Sharing : Afval kalendar in text sensor
Posted: Wednesday 08 May 2019 21:28
by hoeby
Sorry, fixed it
I normally only work with dzvents.
Therefor i automatically made a dzvents scripts and pasted the backup in it.
But is is not dzvents, is it lua
Changed it and tested it, works again.

Re: Sharing : Afval kalendar in text sensor
Posted: Thursday 09 May 2019 11:13
by trunks403
jvdz wrote: ↑Thursday 11 April 2019 10:25
It seems you aren't using the latest version of the script. PMed you the latest version with your information which seems to work fine when I tried.
Does that work for you too?
Jos
I did install the lastest version but also got the same error (a nill value)
I have installed nieuwst version of domoticz (beta) Version: 4.10698 and it works again.
Thanks for youre help. And happy it works again

Re: Sharing : Afval kalendar in text sensor
Posted: Thursday 09 May 2019 19:57
by BarryT
Hi all,
i get a error since last 2 updates:
Code: Select all
EventSystem: in Container: [string "-- afvalWijzer module, curl in os required!!
..."]:95: attempt to index field '?' (a nil value)
I don't know where this comes from...
EDIT*:
Sorry, had to change the cfg with the correct values from the afvalwijzer.
Works again

Re: Sharing : Afval kalendar in text sensor
Posted: Saturday 11 May 2019 9:20
by Pantagruel
AllesVanZelf wrote: ↑Friday 03 May 2019 9:21
Great work Zicht and JvdZ!
Afvalkalender.meerlanden.nl is using Opzet too. Good news.
Meerlanden Collects garbage in the regions: Aalsmeer, Bloemendaal, Diemen, Haarlemmerliede en Spaarnwoude, Haarlemmermeer, Heemstede, Hillegom, Lisse of Noordwijk.
...
Indeed a big down to Zicht and JvdZ!
As AllesVanZelf mentions, Afvalkalender.meerlanden.nl is indeed using Opzet too.
Meerlanden Collects garbage in the regions: Aalsmeer, Bloemendaal, Diemen, Haarlemmerliede en Spaarnwoude, Haarlemmermeer, Heemstede, Hillegom, Lisse, Noordwijk and Nieuw Vennep as well

.
No script changes needed, just add the needed data in the alvalwijzerconfig.lua and be patient for the 'Hello World" in the text device to change over to the actual pick-up dates.
Thanks Gents!
Re: Sharing : Afval kalendar in text sensor
Posted: Saturday 11 May 2019 9:29
by jvdz
You are welcome.
Pantagruel wrote: ↑Saturday 11 May 2019 9:20
No script changes needed, just add the needed data in the alvalwijzerconfig.lua and be patient for the 'Hello World" in the text device to change over to the actual pick-up dates.
Just an FYI: You could briefly set debug=true, which will trigger an update each minute, to see if all is working and then set debug back to false.
Jos
Re: Sharing : Afval kalendar in text sensor
Posted: Wednesday 05 June 2019 18:05
by cobra045
Derik wrote: ↑Monday 29 April 2019 21:22
Is there perhaps a option to send the message to more email accounts???
First, great work your script!!!
Hi, I have found and tested the following solution for this.
How to create a second (or more) email address?
First make a backup of the working script for safety.
Search for line
Code: Select all
local NotificationEmailAdress = "xxxxxxxx.yyyy" -- Set to the Notification EmailAddress
Put the following line below, increase the numbers for more addresses
Code: Select all
local NotificationEmailAdress2 = "xxxxxxxxx.yyyy" -- Set to the Notification EmailAddress2
Search for line
Code: Select all
commandArray['SendEmail'] = notificationtitle .. '#' .. notificationtext .. '#' .. NotificationEmailAdress
Adjust the line with --- for it (disable) Keep the original rule.
Create the rules below for each email address, increase the numbers for more addresses
Code: Select all
commandArray[1]={['SendEmail'] = notificationtitle .. '#' .. notificationtext .. '#' .. NotificationEmailAdress }
dprint ('AF-Hee Notification send for ' .. s_afvaltype.. " title:|"..notificationtitle.. "| body:|"..notificationtext.."|")
commandArray[2]={['SendEmail'] = notificationtitle .. '#' .. notificationtext .. '#' .. NotificationEmailAdress2 }
dprint ('AF-Hee Notification send for ' .. s_afvaltype.. " title:|"..notificationtitle.. "| body:|"..notificationtext.."|")
Save and test
My wife is very satisfied with this solution
Best regards,
Cobra045
Re: Sharing : Afval kalendar in text sensor
Posted: Wednesday 05 June 2019 18:40
by jvdz
cobra045 wrote: ↑Wednesday 05 June 2019 18:05
First, great work your script!!!
Your welcome.
Your solution for a second Email address looks easy enough. Disadvantage is that you need to remember what you did in case you need to load a new version of the script. If the interest is large enough we could also modify the script or somebody could make a PR on GitHub.
Jos
Re: Sharing : Afval kalendar in text sensor
Posted: Wednesday 05 June 2019 19:54
by jvdz
I have committed an update for
script_time_huisvuil-opzet.lua,
script_time_afvalwijzer.lua and
script_time_huisvuil-deafvalapp.lua to allow for multiple target email addresses:
Code: Select all
NotificationEmailAdress = "" -- Specify your Email Address for the notifications. Leave empty to skip email notification
--NotificationEmailAdress = {"",""} -- Specify multiple Email Addresses for the notifications. Leave empty to skip email notification
You can now specify as many as you want when using the second format. current old format will also still work for a single email address.
Jos