dzVents get garbage collection dates (various)  [SOLVED]

Moderator: leecollings

Post Reply
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

dzVents get garbage collection dates (various)

Post by waaren »

@Rembo found the inzamelkalender.hvcgroep.nl/push/calendar?postcode="nnnnAA"&huisnummer="nn""

I created a dzVents script that make use of this site and store the information in a textdevice and an alertdevice. The script makes use of dzVents persistent data to store a copy the json result So if the site is not available for a couple of hours it will use the saved data.

Look at the 10 lines Using dzVents with Domoticz for a short intro to dzVents and howto get this script active in domoticz.

Further description and howto config are in the script.

have Fun !

Code: Select all

--[[ getGarbageDates.lua for [ dzVents >= 2.4 ]

this script is only useful in those  areas of the Netherlands where the HVC group collects household garbage

Enter your zipcode and housenumber in the appropriate place between the lines starting with --++++
Next is to set your virtual text and or virtual alert device.

the text device will contain the most nearby collectdates for the four types of household garbage
the alert device will contain the date and type for the garbagecollecion that will arrive first

]]--

return {
    on      =   {   timer           =   { "at 00:05","at 08:00" },   -- daily run twice
                    httpResponses   =   { "getGarbage_Response" }    -- Trigger the handle Json part
                },

--  logging =   {   level     =   domoticz.LOG_DEBUG,              -- Remove the "-- at the beginning of this and next line for debugging the script
--                  marker    =   "collectGarbage"      },

    data    =   {   garbage     = {initial = {} },             -- Keep a copy of last json just in case
                },

    execute = function(dz, triggerObject)

    --++++--------------------- Mandatory: Set your values and device names below this Line --------------------------------------
    local myZipcode     = "3318JZ"
    local myHousenumber = 85
    local myTextDevice  = "GarbageText"       -- Name with quotes or idx without when created as virtual text device
    local myAlertDevice = "GarbageAlert"      -- Name with quotes or idx without when created as virtual alert device
    --++++---------------------------- Set your values and device names above this Line --------------------------------------------

        -- Compose URL and send
        local function collectGarbageDates(secondsFromNow)
            local getGarbage_url  = "http://inzamelkalender.hvcgroep.nl/push/calendar?postcode=" ..
                                    myZipcode .."&huisnummer=" .. myHousenumber
            dz.openURL  ({  url = getGarbage_url ,
                            method = "GET",
                            callback = "getGarbage_Response" }).afterSec(secondsFromNow)
        end

        -- Add entry to log and notify to all subsystems
        local function errorMessage(message)
            dz.log(message,dz.LOG_ERROR)
            dz.notify(message)
        end

        local function string2Epoch(dateString) -- seconds from epoch based on stringdate (used by string2Date)
            -- Assuming a date pattern like: yyyy-mm-dd hh:mm:ss
            local pattern = "(%d+)-(%d+)-(%d+) (%d+):(%d+):(%d+)"
            local runyear, runmonth, runday, runhour, runminute, runseconds = dateString:match(pattern)
            local convertedTimestamp = os.time({year = runyear, month = runmonth, day = runday, hour = runhour, min = runminute, sec = runseconds})
            return convertedTimestamp
        end

        local function string2Date(str,fmt)             -- convert string from json into datevalue
            if fmt then return os.date(fmt,string2Epoch(str)) end
            return os.date(" %A %d %B, %Y",string2Epoch(str)):gsub(" 0"," ")
        end

        local function alertLevel(delta)
            if delta < 2 then return dz.ALERTLEVEL_RED end
            if delta < 3 then return dz.ALERTLEVEL_YELLOW end
            if delta < 4 then return dz.ALERTLEVEL_ORANGE end
            return dz.ALERTLEVEL_GREEN
        end

        local function setGarbageAlertDevice(alertDevice,alertText,alertDate)
            local delta = tonumber(string2Date(alertDate,"%d")) - tonumber(os.date("%d"))  -- delta in days between today and first garbage collection date
            dz.devices(alertDevice).updateAlertSensor(alertLevel(delta),alertText)
            return (delta == 0)
        end

        local function longGarbageName(str)                                        -- Use descriptive strings
            str = str:gsub("PMD","Plastic verpakkingen, blik en drinkpakken ")
            str = str:gsub("GFT","Groente-, fruit- en tuin afval            ")
            str = str:gsub("PAPIER","Papier en kartonnen verpakkingen          ")
            str = str:gsub("REST","Restafval                                ")
            return str
        end

       local function handleResponse()
            if #triggerObject.json > 0 then
                dz.data.garbage    = triggerObject.json
                rt = triggerObject.json
            else
                errorMessage("Problem with response from hvcgroep (no data) using data from earlier run")
                rt  = dz.data.garbage                       -- json empty. Get last valid from dz.data
                if #rt < 1 then                              -- No valid data in dz.data either
                    errorMessage("No previous data. are zipcode and housenumber ok and in HVC group area ?")
                    return false
                end
            end
            local garbageLines = ""
            local typeEarliestDate
            local overallEarliestDate   = "2999-12-31"       -- Hopefully we will have a different garbage collection system by then
            local garbageToday = false

            for i = 1,#rt do                                 -- walk the resulttable
                typeEarliestDate      = "2999-12-31"
                for j = 1,#rt[i].dateTime do                 -- walk the dates subtable

                    if rt[i].dateTime[j].date < typeEarliestDate then -- Keep date closest to today per type
                        typeEarliestDate =  rt[i].dateTime[j].date
                        if  typeEarliestDate < overallEarliestDate then  -- date closest to today overall ?
                            overallEarliestDate = typeEarliestDate      -- keep date
                            overallEarliestType =  rt[i].naam            -- keep date
                        end
                        garbageLines = garbageLines .. string2Date(typeEarliestDate,"%a %e %b:  " ) .. longGarbageName(rt[i].naam) .. " " .. "\n"
                        dz.log(garbageLines,dz.LOG_DEBUG)
                        typeEarliestDate = rt[i].dateTime[j].date -- Keep date closest to today

                    end
                end
            end

            if myAlertDevice then   -- Update AlertDevice with nearby date / type
                garbageToday = setGarbageAlertDevice(  myAlertDevice,
                                                        longGarbageName(overallEarliestType) .. "\n" ..
                                                        string2Date(overallEarliestDate),
                                                        overallEarliestDate)
            end

            if myTextDevice then       -- Update defined virtual text device with dates / types
                dz.devices(myTextDevice).updateText(garbageLines)
            end

            if dz.time.matchesRule("at 08:00-17:00") and garbageToday then
                dz.notify(longGarbageName(overallEarliestType) .. "will be collected today")
            end
        end

        -- Main
        if triggerObject.isHTTPResponse then
            if triggerObject.ok then
                handleResponse()
            else
                errorMessage("Problem with response from hvcgroep (not ok)")
                collectGarbageDates(600)                            -- response not OK, try again after 10 minutes
            end
        else
            collectGarbageDates(1)
        end
    end
}
Last edited by waaren on Tuesday 18 September 2018 8:16, edited 1 time in total.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by remb0 »

really great, I only got:

2018-07-26 18:04:45.942 Status: dzVents: Error (2.4.7): error loading module 'Garbage' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/Garbage.lua':
2018-07-26 18:04:45.942 ...i/domoticz/scripts/dzVents/generated_scripts/Garbage.lua:96: unexpected symbol near ':'

is there a prerequisite that i don't have?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by waaren »

remb0 wrote: Thursday 26 July 2018 18:05 really great, I only got:

2018-07-26 18:04:45.942 Status: dzVents: Error (2.4.7): error loading module 'Garbage' from file '/home/pi/domoticz/scripts/dzVents/generated_scripts/Garbage.lua':
2018-07-26 18:04:45.942 ...i/domoticz/scripts/dzVents/generated_scripts/Garbage.lua:96: unexpected symbol near ':'

is there a prerequisite that i don't have?
Tested both on dzVents/generated_scripts/ and from ..dzVents/scripts/ on debian stretch with last beta and dzVents 2.4.7 but should also work on other OS / platforms
My line 96 : local overallEarliestDate = "2999-12-31" -- Hopefully we will have a different garbage collection system by then
I don't see a : there. What is your line 96 ?
Can you show your modifications (times / devices / messages ?)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by remb0 »

when copying this line is placed (don't know why!
local typeEarliestDatejavascript: save_block()

but the script works now! wow really nice! thank you very much!
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by remb0 »

I made a little article about it. and thanks again!!!
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by thecosmicgate »

I recently found this article on the domoticz FB site. And started to implement this to my own domoticz . But at the start i'am stuck :) : we use "Saver" as garbage collector and they didn't show up on the script guide. When I installed the "afval Nederland" application it works on this app.
So how / where can I found the correct input for the dzVents script ?

Sent from my ONEPLUS A6003 using Tapatalk

It's nice to be important, but it's more important to be nice
Scooter ;)
ArieKanarie
Posts: 41
Joined: Saturday 12 December 2015 13:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by ArieKanarie »

Tried the script too when I saw the FB article, but got problems too :-(

I'm trying to get it work with AlphenaandenRijn, but keep getting this error:

Code: Select all

2018-08-09 10:50:02.762 Status: dzVents: Info: collectGarbage: ------ Start internal script: getGarbageDates: HTTPResponse: "getGarbage_Response"
2018-08-09 10:50:02.800 Status: dzVents: Error (2.4.6): collectGarbage: Problem with response from hvcgroep (no data) using data from earlier run
2018-08-09 10:50:02.800 Status: dzVents: Error (2.4.6): collectGarbage: No previous data. are zipcode and housenumber ok and in HVC group area ?
Edited the script like this:

Code: Select all

--++++--------------------- Mandatory: Set your values and device names below this Line --------------------------------------
local myTextDevice = "<strong>Garbage</strong>" -- Name with quotes or idx without when created as virtual text device
local myAlertDevice = "<strong>GarbageAlert</strong>" -- Name with quotes or idx without when created as virtual alert device
local myBagId = "0499200002034591"
local myYear = os.date("%Y")

-- it can happen that other examples then HVC uses other numbers, change them at line
garbageTypes = {87,112,113}

--++++---------------------------- Set your values and device names above this Line --------------------------------------------

local function collectGarbageDates(secondsFromNow)
local getGarbage_url = "https://afvalkalender.alphenaandenrijn.nl/rest/adressen/" ..myBagId .. "/kalender/" .. myYear
dz.openURL ({ url = getGarbage_url ,
method = "GET",
call
The url: https://afvalkalender.alphenaandenrijn. ... ender/2018 is working correct.

Any idea what the problem could be?


BTW:
In de example script the variable BagID is defined with tags <code></code>, why is that?
If those tags are kept in the code the response is:

Code: Select all

2018-08-09 11:02:04.605 Error: Error opening url: https://afvalkalender.alphenaandenrijn.nl/rest/adressen/<code>0499200002034591</code>/kalender/2018
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by remb0 »

i see that your devices contains html code: <strong>Garbage</strong> so strong must be deleted. maybe somewhere else in the script there is also wrong scripting because of the copy-pasting? I see it was wordpress that changed the code, sorry for that.
also the the bagid: code>
also if i try your url I see dates like: 2018-01-121 121?
User avatar
remb0
Posts: 499
Joined: Thursday 11 July 2013 22:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: The Netherlands
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by remb0 »

i see that your devices contains html code: <strong>Garbage</strong> so strong must be deleted. maybe somewhere else in the script there is also wrong scripting because of the copy-pasting? I see it was wordpress that changed the code, sorry for that.
also the the bagid: code>
also if i try your url I see dates like: 2018-01-121 121?
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by thecosmicgate »

Could somebody help me with the correct items but from the Saver website ?
The guys from saver told me that someway it's working within Dashticz , but I don't use that skin

Sent from my ONEPLUS A6003 using Tapatalk

It's nice to be important, but it's more important to be nice
Scooter ;)
ArieKanarie
Posts: 41
Joined: Saturday 12 December 2015 13:25
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by ArieKanarie »

remb0 wrote: Thursday 09 August 2018 17:42 i see that your devices contains html code:
....
I see it was wordpress that changed the code, sorry for that.
Already thought it was strange, but it was in the instructions so.... :-)
remb0 wrote: Thursday 09 August 2018 17:42 also if i try your url I see dates like: 2018-01-121 121?
Yeah, no idea what the use of that is.
Maybe I could solve that by parsing only first 10 characters or something..
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by thecosmicgate »

thecosmicgate wrote:Could somebody help me with the correct items but from the Saver website ?
The guys from saver told me that someway it's working within Dashticz , but I don't use that skin

Sent from my ONEPLUS A6003 using Tapatalk
Anybody please ? ;)

Sent from my ONEPLUS A6003 using Tapatalk

It's nice to be important, but it's more important to be nice
Scooter ;)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by waaren »

thecosmicgate wrote: Thursday 09 August 2018 18:12 Could somebody help me with the correct items but from the Saver website ?
The guys from saver told me that someway it's working within Dashticz , but I don't use that skin

Sent from my ONEPLUS A6003 using Tapatalk
If you send me a PM with zipcode / housenumber, I will have a look
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by waaren »

thecosmicgate wrote: Thursday 09 August 2018 18:12 Could somebody help me with the correct items but from the Saver website ?
The guys from saver told me that someway it's working within Dashticz , but I don't use that skin

Sent from my ONEPLUS A6003 using Tapatalk
Saver is using quite a different interface to the garbage collection data for the locations they serve. I modified the script in such a way that it works for some garbage collector companies / locations that are using afvalwijzer.nl
Could you try the script below and report back your findings ?

Code: Select all

--[[ getGarbageDates.lua for [ dzVents >= 2.4 ]

this script is only useful in those  areas of the Netherlands where the household garbage collector is connected to afvalwijzer.nl

Enter your zipcode and housenumber in the appropriate place between the lines starting with --++++
Next is to set your virtual text and or virtual alert device.

the text device will contain the most nearby collectdates for the four types of household garbage
the alert device will contain the date and type for the garbagecollecion that will arrive first

]]--

return {
        on      =  { timer           =  { "at 00:05","at 08:00" },   -- daily run twice
    --  on      =  { timer           =  {"every 1 minutes"},         -- During test / debug (only one "on =" line can be active ) 
    --  on      =  { timer           =  {"never"},                   -- To deactivate 
                     httpResponses   =  { "getGarbage_Response" }    -- Trigger the handle Json part
                },

--  logging =   {   level     =   domoticz.LOG_DEBUG,              -- Remove the "-- at the beginning of this and next line for debugging the script
--                  marker    =   "collectGarbage"      },

    data    =   {   garbage     = {initial = {} },             -- Keep a copy of last json just in case
                },

    execute = function(dz, triggerObject)

        --++++--------------------- Mandatory: Set your values and device names below this Line --------------------------------------
        local myZipcode     = "nnnntt"            -- Your zipcode like "3085RA"
        local myHousenumber =  nn                 -- Your housenumber like 38
        local myTextDevice  = "GarbageText"       -- Name with quotes or idx without when created as virtual text device
        local myAlertDevice = "GarbageAlert"      -- Name with quotes or idx without when created as virtual alert device
        --++++---------------------------- Set your values and device names above this Line --------------------------------------------

        local myYear = os.date("%Y")
        garbageTypes  = {"restafval","gft","papier","plastic"}

        local function collectGarbageDates(secondsFromNow)
            local getGarbage_url  = "http://json.mijnafvalwijzer.nl/?method=postcodecheck&postcode="  .. 
                                    myZipcode .. "&street=&huisnummer=" .. 
                                    myHousenumber .. "&toevoeging" 
            dz.openURL  ({  url = getGarbage_url ,
                            method = "GET",
                            callback = "getGarbage_Response" }).afterSec(secondsFromNow)
        end

        -- Add entry to log and notify to all subsystems
        local function errorMessage(message)
            dz.log(message,dz.LOG_ERROR)
            dz.notify(message)
        end

        local function string2Epoch(dateString) -- seconds from epoch based on stringdate (used by string2Date)
            -- Assuming a date pattern like: yyyy-mm-dd
            local pattern = "(%d+)-(%d+)-(%d+)"
            local runyear, runmonth, runday= dateString:match(pattern)
            local convertedTimestamp = os.time({year = runyear, month = runmonth, day = runday})
            return convertedTimestamp
        end

        local function string2Date(str,fmt)             -- convert string from json into datevalue
            if fmt then return os.date(fmt,string2Epoch(str)) end
            return os.date(" %A %d %B, %Y",string2Epoch(str))
        end

        local function alertLevel(delta)
            if delta < 2 then return dz.ALERTLEVEL_RED end
            if delta < 3 then return dz.ALERTLEVEL_YELLOW end
            if delta < 4 then return dz.ALERTLEVEL_ORANGE end
            return dz.ALERTLEVEL_GREEN
        end

        local function setGarbageAlertDevice(alertDevice,alertText,alertDate)
            local delta = tonumber(string2Date(alertDate,"%d")) - tonumber(os.date("%d"))  -- delta in days between today and first garbage collection date
            dz.devices(alertDevice).updateAlertSensor(alertLevel(delta),alertText)
            dz.log("\nalertLevel: " .. alertLevel(delta) .. ", alertText: " .. alertText,dz.LOG_DEBUG)
            return (delta == 0)
        end

        local function longGarbageName(str)                                        -- Use descriptive strings
            str = tostring(str)
            str = str:gsub("plastic","  Plastic verpakkingen, blik en drinkpakken ")
            str = str:gsub("gft","  Groente-, fruit- en tuin afval            ")
            str = str:gsub("papier","  Papier en kartonnen verpakkingen          ")
            str = str:gsub("restafval" ,"  Restafval                                ")
            return str
        end

       local function handleResponse()
            triggerObject.json = dz.utils.fromJSON(triggerObject.data)         -- dzVents does nor recognize the response as pure JSON so conversion is required
            if #triggerObject.json < 1 then
                dz.data.garbage    = triggerObject.json.data.ophaaldagen.data      -- Store this part in dz.data 
                rt = triggerObject.json.data.ophaaldagen.data                      -- and in table
            else
               errorMessage("Problem with response (no data) using data from earlier run")
               rt  = dz.data.garbage                       -- json empty. Get last valid from dz.data
               if #rt < 1 then                              -- No valid data in dz.data either
                  errorMessage("No previous data. are zipcode and housenumber ok and in afvalkalender ?")
                  return false
               end
            end
            
            local garbageLines = ""
            local typeEarliestDate
            local overallEarliestDate   = "2999-12-31"       -- Hopefully we will have a different garbage collection system by then
            local garbageToday = false
            local today = os.date("%Y-%m-%d")
            
            for i = 1,#garbageTypes do --walk the the type Table
                typeEarliestDate      = "2999-12-31"
                for j = 1,#rt do                                 -- walk the response table
                    dz.log(rt[j].date .. ": " .. rt[j].type,dz.LOG_DEBUG)        
                    if  rt[j].date >= today and rt[j].date < typeEarliestDate and 
                        rt[j].type == garbageTypes[i] then              -- Keep date closest to today per type
                        typeEarliestDate =  rt[j].date
                        if  typeEarliestDate < overallEarliestDate then  -- date closest to today overall ?
                            overallEarliestDate = typeEarliestDate      -- keep date
                            overallEarliestType =  garbageTypes[i]            -- keep type
                        end
                        garbageLines = garbageLines .. string2Date(typeEarliestDate,"%a %e %b" ) .. longGarbageName(rt[j].type) .. " " .. "\n"
                        typeEarliestDate = rt[j].date  -- Keep date closest to today

                    end
                end
            end

            if myAlertDevice then   -- Update AlertDevice with nearby date / type
                garbageToday = setGarbageAlertDevice(  myAlertDevice,
                                                        longGarbageName(overallEarliestType) .. "\n" ..
                                                        string2Date(overallEarliestDate),
                                                        overallEarliestDate)
            end

            if myTextDevice then       -- Update defined virtual text device with dates / types
                dz.devices(myTextDevice).updateText(garbageLines)
                dz.log("\n" .. garbageLines,dz.LOG_DEBUG)
            end

            if dz.time.matchesRule("at 08:00-17:00") and garbageToday then
                dz.notify(longGarbageName(overallEarliestType) .. "will be collected today")
            end
        end

        -- Main
        if triggerObject.isHTTPResponse then
            if triggerObject.ok then
                handleResponse()
            else
                errorMessage("Problem with response (not ok)")
                collectGarbageDates(600)                            -- response not OK, try again after 10 minutes
            end
        else
            collectGarbageDates(1)
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Superpjeter
Posts: 11
Joined: Wednesday 29 August 2018 14:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by Superpjeter »

Nice script, but it does not work for my garage collector, I am getting: "Problem with response from hvcgroep …."
My garbage collector is Circulus-Berkel and I am using url
https://afvalkalender.circulus-berkel.nl.
The response I get when I am put it in a browser with my address is is a little different then from the hvcgroep url
I am not familiar with json and don’t know how to solve this.

Code: Select all

{"0":{"afvalstroom_id":13,"ophaaldatum":"2018-04-10"},"1":{"afvalstroom_id":13,"ophaaldatum":"2018-08-14"},"2":{"afvalstroom_id":13,"ophaaldatum":"2018-12-11"},"3":{"afvalstroom_id":7,"ophaaldatum":"2018-01-08"},"4":{"afvalstroom_id":7,"ophaaldatum":"2018-01-22"},"5":{"afvalstroom_id":7,"ophaaldatum":"2018-02-05"},"6":{"afvalstroom_id":7,"ophaaldatum":"2018-02-19"},"7":{"afvalstroom_id":7,"ophaaldatum":"2018-03-05"},"8":{"afvalstroom_id":7,"ophaaldatum":"2018-03-19"},"9":{"afvalstroom_id":7,"ophaaldatum":"2018-03-31"},"10":{"afvalstroom_id":7,"ophaaldatum":"2018-04-16"},"11":{"afvalstroom_id":7,"ophaaldatum":"2018-04-30"},"12":{"afvalstroom_id":7,"ophaaldatum":"2018-05-14"},"13":{"afvalstroom_id":7,"ophaaldatum":"2018-05-28"},"14":{"afvalstroom_id":7,"ophaaldatum":"2018-06-11"},"15":{"afvalstroom_id":7,"ophaaldatum":"2018-06-25"},"16":{"afvalstroom_id":7,"ophaaldatum":"2018-07-09"},"17":{"afvalstroom_id":7,"ophaaldatum":"2018-07-23"},"18":{"afvalstroom_id":7,"ophaaldatum":"2018-08-06"},"19":{"afvalstroom_id":7,"ophaaldatum":"2018-08-20"},"20":{"afvalstroom_id":7,"ophaaldatum":"2018-09-03"},"21":{"afvalstroom_id":7,"ophaaldatum":"2018-09-17"},"22":{"afvalstroom_id":7,"ophaaldatum":"2018-10-01"},"23":{"afvalstroom_id":7,"ophaaldatum":"2018-10-15"},"24":{"afvalstroom_id":7,"ophaaldatum":"2018-10-29"},"25":{"afvalstroom_id":7,"ophaaldatum":"2018-11-12"},"26":{"afvalstroom_id":7,"ophaaldatum":"2018-11-26"},"27":{"afvalstroom_id":7,"ophaaldatum":"2018-12-10"},"28":{"afvalstroom_id":7,"ophaaldatum":"2018-12-24"},"31":{"afvalstroom_id":10,"ophaaldatum":"2018-01-25"},"32":{"afvalstroom_id":10,"ophaaldatum":"2018-02-22"},"33":{"afvalstroom_id":10,"ophaaldatum":"2018-03-22"},"34":{"afvalstroom_id":10,"ophaaldatum":"2018-04-26"},"35":{"afvalstroom_id":10,"ophaaldatum":"2018-05-24"},"36":{"afvalstroom_id":10,"ophaaldatum":"2018-06-28"},"37":{"afvalstroom_id":10,"ophaaldatum":"2018-07-26"},"38":{"afvalstroom_id":10,"ophaaldatum":"2018-08-23"},"39":{"afvalstroom_id":10,"ophaaldatum":"2018-09-27"},"40":{"afvalstroom_id":10,"ophaaldatum":"2018-10-25"},"41":{"afvalstroom_id":10,"ophaaldatum":"2018-11-22"},"42":{"afvalstroom_id":10,"ophaaldatum":"2018-12-27"},"44":{"afvalstroom_id":19,"ophaaldatum":"2018-01-11"},"45":{"afvalstroom_id":19,"ophaaldatum":"2018-02-08"},"46":{"afvalstroom_id":19,"ophaaldatum":"2018-03-08"},"47":{"afvalstroom_id":19,"ophaaldatum":"2018-04-12"},"48":{"afvalstroom_id":19,"ophaaldatum":"2018-05-12"},"49":{"afvalstroom_id":19,"ophaaldatum":"2018-06-14"},"50":{"afvalstroom_id":19,"ophaaldatum":"2018-07-12"},"51":{"afvalstroom_id":19,"ophaaldatum":"2018-08-09"},"52":{"afvalstroom_id":19,"ophaaldatum":"2018-09-13"},"53":{"afvalstroom_id":19,"ophaaldatum":"2018-10-11"},"54":{"afvalstroom_id":19,"ophaaldatum":"2018-11-08"},"55":{"afvalstroom_id":19,"ophaaldatum":"2018-12-13"},"57":{"afvalstroom_id":8,"ophaaldatum":"2018-01-06"},"58":{"afvalstroom_id":8,"ophaaldatum":"2018-01-15"},"59":{"afvalstroom_id":8,"ophaaldatum":"2018-01-29"},"60":{"afvalstroom_id":8,"ophaaldatum":"2018-02-12"},"61":{"afvalstroom_id":8,"ophaaldatum":"2018-02-26"},"62":{"afvalstroom_id":8,"ophaaldatum":"2018-03-12"},"63":{"afvalstroom_id":8,"ophaaldatum":"2018-03-26"},"64":{"afvalstroom_id":8,"ophaaldatum":"2018-04-09"},"65":{"afvalstroom_id":8,"ophaaldatum":"2018-04-23"},"66":{"afvalstroom_id":8,"ophaaldatum":"2018-05-07"},"67":{"afvalstroom_id":8,"ophaaldatum":"2018-05-19"},"68":{"afvalstroom_id":8,"ophaaldatum":"2018-06-04"},"69":{"afvalstroom_id":8,"ophaaldatum":"2018-06-18"},"70":{"afvalstroom_id":8,"ophaaldatum":"2018-07-02"},"71":{"afvalstroom_id":8,"ophaaldatum":"2018-07-16"},"72":{"afvalstroom_id":8,"ophaaldatum":"2018-07-30"},"73":{"afvalstroom_id":8,"ophaaldatum":"2018-08-13"},"74":{"afvalstroom_id":8,"ophaaldatum":"2018-08-27"},"75":{"afvalstroom_id":8,"ophaaldatum":"2018-09-10"},"76":{"afvalstroom_id":8,"ophaaldatum":"2018-09-24"},"77":{"afvalstroom_id":8,"ophaaldatum":"2018-10-08"},"78":{"afvalstroom_id":8,"ophaaldatum":"2018-10-22"},"79":{"afvalstroom_id":8,"ophaaldatum":"2018-11-05"},"80":{"afvalstroom_id":8,"ophaaldatum":"2018-11-19"},"81":{"afvalstroom_id":8,"ophaaldatum":"2018-12-03"},"82":{"afvalstroom_id":8,"ophaaldatum":"2018-12-17"},"83":{"afvalstroom_id":8,"ophaaldatum":"2018-12-31"}}
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by waaren »

Superpjeter wrote: Wednesday 29 August 2018 14:40 Nice script, but it does not work for my garage collector, I am getting: "Problem with response from hvcgroep …."
My garbage collector is Circulus-Berkel and I am using url
https://afvalkalender.circulus-berkel.nl.
The response I get when I am put it in a browser with my address is is a little different then from the hvcgroep url
I am not familiar with json and don’t know how to solve this.
If you give me the bagid you use I will take a look. Could take a while though as I am travelling.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Superpjeter
Posts: 11
Joined: Wednesday 29 August 2018 14:11
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by Superpjeter »

Thanks for your offer but I already figured it out
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by waaren »

Superpjeter wrote: Tuesday 11 September 2018 19:42 Thanks for your offer but I already figured it out
Good to read. Can you please share your solution for the benefit of other forum users ?
Thx
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Huntback
Posts: 28
Joined: Monday 02 January 2017 14:35
Target OS: NAS (Synology & others)
Domoticz version: 2024.2
Location: Apeldoorn
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by Huntback »

Hi Superpjeter,
we also use https://afvalkalender.circulus-berkel.nl here
do you want to share the solution for the script with us?
thank you in advance :)
Synology - DS411+II
Synology - DS918+
RFXCOM - RFXtrx433XL (LAN)
Oregon - Weatherstation
Some KAKU, Impuls, TFA, etc.
Huntback
Posts: 28
Joined: Monday 02 January 2017 14:35
Target OS: NAS (Synology & others)
Domoticz version: 2024.2
Location: Apeldoorn
Contact:

Re: dzVents get garbage collection dates from inzamelkalender.hvcgroep.nl

Post by Huntback »

waaren wrote: Tuesday 11 September 2018 21:24
Superpjeter wrote: Tuesday 11 September 2018 19:42 Thanks for your offer but I already figured it out
Good to read. Can you please share your solution for the benefit of other forum users ?
Thx
Hello waaren,
Unfortunately Superpjeter is not responding
So would you please, if you have time for it, take a to look at the script so that this can also work for https://afvalkalender.circulus-berkel.nl?
My BagId = "0200200000024867"
Thanks in advance.
Synology - DS411+II
Synology - DS918+
RFXCOM - RFXtrx433XL (LAN)
Oregon - Weatherstation
Some KAKU, Impuls, TFA, etc.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest