Sharing : Afval kalendar in text sensor

Moderator: leecollings

Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by Derik »

jvdz wrote: Wednesday 05 June 2019 19:54 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
Just this no more change to make?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
jvdz
Posts: 2267
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

Derik wrote: Wednesday 05 June 2019 20:35 Just this no more change to make?
No sure what you are asking?
Just uncomment that second line and fill in the Emailaddresses in the table so it looks like this:

Code: Select all

--NotificationEmailAdress = ""        -- Specify your Email Address for the notifications. Leave empty to skip email notification
NotificationEmailAdress = {"[email protected]","[email protected]"} -- Specify multiple Email Addresses for the notifications. Leave empty to skip email notification
... or even more when you want. 8-)
Give it a try and let me know if that works for you too.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by Derik »

jvdz wrote: Wednesday 05 June 2019 21:19
Derik wrote: Wednesday 05 June 2019 20:35 Just this no more change to make?
No sure what you are asking?
Just uncomment that second line and fill in the Emailaddresses in the table so it looks like this:

Code: Select all

--NotificationEmailAdress = ""        -- Specify your Email Address for the notifications. Leave empty to skip email notification
NotificationEmailAdress = {"[email protected]","[email protected]"} -- Specify multiple Email Addresses for the notifications. Leave empty to skip email notification
... or even more when you want. 8-)
Give it a try and let me know if that works for you too.

Jos

Yes this part i understand..
Only is this working with "all" the git versions???
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
jvdz
Posts: 2267
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

Derik wrote: Wednesday 05 June 2019 21:22 Yes this part i understand..
Only is this working with "all" the git versions???
Ok, then I still don't understand why you ask as I stated which scripts have this implemented.
So the 3 i mentioned have this line in there and should work. Just try it and let me know whether it works or not.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
cobra045
Posts: 46
Joined: Friday 12 February 2016 20:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by cobra045 »

Hallo Jos,
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
Thanks for your comment.

I am not a programmer, and made this solution with the very very small knowledge of the Lua language.
I found the solution on this site https://www.domoticz.com/forum/viewtopic.php?t=11906
From experience I know that a step by step instruction works best, especially for people who want to try this.
If you have a step by step instruction then you can easily apply it if there is an update to the script.
The script I used is script_time_huisvuil-zuidlimburg.lua
More adjustments have to be made for Maastricht because we do not have a gray box but a "restafvalzak"
So I think, as long as the script works, I won't change it.
Of course it is great if the multi mail solution for everyone is in it.

Given my age, Google Translate is my best friend :D :D .

p.s A tip, place more your GitHub address in your messages so that it is found more easily.

https://github.com/jvanderzande/mijnafvalwijzer

With kind regards,

Cobra045
User avatar
jvdz
Posts: 2267
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

@cobra045,
Could you email me your modifications, then I will update the limburg script with your changes and the multi email option. ;)
I will mail the update back so you could test it and let me know whether it all works before commiting to Github.

Thanks,
Jos
cobra045 wrote: Thursday 06 June 2019 16:43 Given my age, Google Translate is my best friend :D :D .
Probably more to do with having to do it (or not). 8-)
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
jaaap
Posts: 59
Joined: Sunday 28 July 2019 22:59
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jaaap »

Hi all,

First of all: most briliant piece of automation :D

Second: I get stuck with this error code:

Code: Select all

dzVents: @AFOpzet module start check for (my postcode and address)
dzVents: @AFOpzet Found: do 2 aug=Gft-afval ; di 5 aug=Papier (overdag) ; vr 9 aug=Plastic+ ;
Error: dzVents: @AFOpzet Error: Couldn't get the current data from Domoticz text device Afvalkalender
I think it has something to do with the way I've set up my dummy text sensor. There is some confusion about where to name what. I have the following setup:

In the script: myAfvalDevice = 'Afvalkalender'

In domoticz under Hardware:
Name: Afvalkalender
Type: Dummy

In domoticz under Devices:
Hardware: Afvalkalender
Name: Afval Nijmegen
Type: General
Subtype: Text

The script itself is called 'Afvalwijzer dzVents', but I don't think that it makes any difference.

Third: maybe in the comment section of the script, it would be good to note the format of the postcode, '0000AA', and not '0000 AA' for instance?
User avatar
jvdz
Posts: 2267
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

Looks like you it can't find the IDX for the dummy text sensor hence the warning.
I don't use DZvents so am not sure what you have done as I run the scripts I made from domoticz/scripts/lua with a time script.
So the thing to check is whether DZvents supports table otherdevices_idx[] to get the appropriate IDX for a device and check the devicename as this statement fails:

Code: Select all

   if otherdevices_idx == nil or otherdevices_idx[myAfvalDevice] == nil then
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by Derik »

dear...
Is there perhaps some that have a multiple mail working?
Try some things here only not working..
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
jvdz
Posts: 2267
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

@Derik, Did you see the latest fix on github as there was an issue with the initial release of this function: https://github.com/jvanderzande/mijnafvalwijzer

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by Derik »

jvdz wrote: Tuesday 30 July 2019 18:13 @Derik, Did you see the latest fix on github as there was an issue with the initial release of this function: https://github.com/jvanderzande/mijnafvalwijzer

Jos

jos bricklayer here.... i cannot script or something like that..
Please tell me what to do...
Is this working?
And what do i need to do?
I run: ver="20190112-1653"

thanks
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
jvdz
Posts: 2267
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

That version will not work and you will need the latest version available on GitHub.
You could always email me your current script with needed info for me to test and fix where needed, which I will mail back.

Groet
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by Derik »

jvdz wrote: Tuesday 30 July 2019 19:06 That version will not work and you will need the latest version available on GitHub.
You could always email me your current script with needed info for me to test and fix where needed, which I will mail back.

Groet
Jos
will give it a try by my self.[ because i think i need to earn something...

Just replace the latest beta? and change my settings...?
And then a example whre and how i must use the multiple mail options please...

[ looks better to me then every thing on your pm..? :-) ]
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
jvdz
Posts: 2267
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

Just copy the top part of your current script to this new version and change the NotificationEmailAdress line as shown below:

Code: Select all

ver="20190605-1340"
-- curl in os required!!
-- create dummy text device from dummy hardware with the name defined for: myAfvalDevice
-- Check the timing when to get a notification for each Afvaltype in the afvaltype_cfg table
-- Check forumtopic:       https://www.domoticz.com/forum/viewtopic.php?f=61&t=17963
-- Check source updates:   https://github.com/jvanderzande/mijnafvalwijzer
-- Link to WebSite:        http://json.mijnafvalwijzer.nl/?method=postcodecheck&postcode=6137LP&street=&huisnummer=15&toevoeging
--
myAfvalDevice = 'Container'         -- The Text devicename in Domoticz
ShowNextEvents = 3                  -- indicate the next x events to show in the TEXT Sensor in Domoticz
Postcode = 'your-zip-here'          -- Your postalcode
Huisnummer = 'your-housenr-here'    -- Your housnr
---  ### De volgende is waar je de meerdere Emailadressen definieer. ####
NotificationEmailAdress = {"[email protected]","[email protected]"} -- Specify multiple Email Addresses for the notifications. Leave empty to skip email notification
Notificationsystem = ""             -- Specify notification system eg "telegram/pushover/gcm/http/kodi/lms/nma/prowl/pushalot/pushbullet/pushsafer" leave empty to skip
In case of issues I do prefer an Email with your scriptfile attached, which is not possible in PM. That way I am sure things are correct and can test easier. You can use PM in case you can'find my email address on github.
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
GerKo
Posts: 3
Joined: Monday 18 December 2017 16:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by GerKo »

Hello all,

Maybe a stupid question ;)

I'm new with LUA and the implementation of it in Domoticz.

I've got Domoticz running in combination with Dashticz.
Everything works fine (switches, rf frequentie which is build with LUA so I know were to make a script, buienradar, smart sensors etc) but this is total new for me :D

Is there someone who could tell me, step by step, how to start?
I hope that someone of you can / wants to help.

Regards,
Gerwin
User avatar
jvdz
Posts: 2267
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

GerKo wrote: Monday 19 August 2019 9:57 Is there someone who could tell me, step by step, how to start?
It is pretty straightforward to implement:
  • copy the appropriate script version to the directory /home/pi/domoticz/scripts/lua with the exact same name so it will function as a time script.
  • edit the top of the file to reflex the correct information for your situation.
  • For testing:set debug to true to have it update each minute and generate debug logging information to check when things go wrong.
  • When all is well your text sensor with the defined IDX will be updated with the found information.
  • Set debug back to false so the log will only contain the necessary info and the update is only done a scheduled times.
Let me know when you have questions.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
GerKo
Posts: 3
Joined: Monday 18 December 2017 16:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by GerKo »

Hello Jos,

Thanks for the quick response and explanation :D
Sounds easy ;)
I'm going try it today or tomorrow.

Let you know!
GerKo
Posts: 3
Joined: Monday 18 December 2017 16:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by GerKo »

jvdz wrote: Monday 19 August 2019 12:19
GerKo wrote: Monday 19 August 2019 9:57 Is there someone who could tell me, step by step, how to start?
It is pretty straightforward to implement:
  • copy the appropriate script version to the directory /home/pi/domoticz/scripts/lua with the exact same name so it will function as a time script.
  • edit the top of the file to reflex the correct information for your situation.
  • For testing:set debug to true to have it update each minute and generate debug logging information to check when things go wrong.
  • When all is well your text sensor with the defined IDX will be updated with the found information.
  • Set debug back to false so the log will only contain the necessary info and the update is only done a scheduled times.
Let me know when you have questions.

Jos
It works :D
Thanks for the script Jos!!

If there is anyone who could tell me to get beautiful graphics, with the information of mijnafvalwijzer, on my Dashticz then I keep myself recommended :lol: :lol:
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by Derik »

Dear @jvdz

Use the : LUA: AfvalWijzer module start update (v20190605-1340) version:


Get an error, and i did copy and paste the code from a other working system to a new system:

Code: Select all

2019-12-18 19:01:59.174 Error: EventSystem: in Lua: Afval: [string "---------------------------------------------..."]:202: attempt to concatenate a nil value (local 'jresponse')

Perhaps?
Curl is installed
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
jvdz
Posts: 2267
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by jvdz »

Pretty sure it can't find/run curl.exe which causes this error.
Try running curl from a putty session to see if that really works:

Code: Select all

pi@PI2BT ~/domoticz/scripts/lua $ curl "https://json.mijnafvalwijzer.nl/?method=postcodecheck&postcode=fout"
NOK
pi@PI2BT ~/domoticz/scripts/lua $
Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest