Sharing : Afval kalendar in text sensor

Moderator: leecollings

Gravityz
Posts: 583
Joined: Wednesday 16 December 2015 19:13
Target OS: NAS (Synology & others)
Domoticz version: 2022.2
Location: Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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
User avatar
jvdz
Posts: 2189
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 »

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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
AllesVanZelf
Posts: 265
Joined: Monday 05 February 2018 8:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 12467
Location: Netherlands, near Haarlem
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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?
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
User avatar
jvdz
Posts: 2189
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 »

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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
AllesVanZelf
Posts: 265
Joined: Monday 05 February 2018 8:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 12467
Location: Netherlands, near Haarlem
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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?
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
User avatar
jvdz
Posts: 2189
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 »

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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
AllesVanZelf
Posts: 265
Joined: Monday 05 February 2018 8:42
Target OS: Raspberry Pi / ODroid
Domoticz version: 12467
Location: Netherlands, near Haarlem
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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?
Domoticz 2020.1 (12230) on Raspberry Pi 3B with Raspian Buster. Besides Domoticz, Rpi is running Pi-Hole.
User avatar
jvdz
Posts: 2189
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 »

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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
dheuts
Posts: 65
Joined: Monday 25 March 2019 15:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Brunssum, Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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.
Raspberry Pi 4 With Domoticz - RFXCom - Tuya Wifi LED lights - Chuango Alarm - Zwave+ - Zigbee2MQTT - Anna Thermostat - Broadlink IR, P1 - Eufy Robo Vacuum - Worx Robo Mower
hoeby
Posts: 528
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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 
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
User avatar
jvdz
Posts: 2189
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 »

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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
hoeby
Posts: 528
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
hoeby
Posts: 528
Joined: Saturday 02 June 2018 11:05
Target OS: Raspberry Pi / ODroid
Domoticz version: V2022.1
Location: Echt, Netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post by hoeby »

Sorry, fixed it :oops:

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 :oops:

Changed it and tested it, works again. :mrgreen:
Thin-client --> Docker Domoticz main environment
Pi3A+ --> Google home (GAssistPi)
Pi3B+ --> Docker (P1monitor, Domoticz test environment, Ubiquity controller)
trunks403
Posts: 6
Joined: Wednesday 13 March 2019 15:32
Target OS: Windows
Domoticz version:
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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 :)
BarryT
Posts: 358
Joined: Tuesday 31 March 2015 22:06
Target OS: Linux
Domoticz version: 2024.3
Location: east netherlands
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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 :)
Raspberry / ESP Boards / Relais / Milight / Hue / OTGW / P1 / Xiaomi / RFXCom / RFLink / ZWave / Conbee II / Z2M / MQTT / A lot of scripts and many more..
Software: Linux, Android and Windows
Pantagruel
Posts: 7
Joined: Wednesday 24 April 2019 20:15
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10659
Location: Nieuw Vennep
Contact:

Re: Sharing : Afval kalendar in text sensor

Post 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!
User avatar
jvdz
Posts: 2189
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 »

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
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 »

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 :D :D

Best regards,
Cobra045
User avatar
jvdz
Posts: 2189
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 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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
User avatar
jvdz
Posts: 2189
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 »

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
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest