Check alle échte Black Friday-deals Ook zo moe van nepaanbiedingen? Wij laten alleen échte deals zien

Tracking UK Revoke Article 50 petition data in Domoticz

Pagina: 1
Acties:
  • 170 views

  • romixL
  • Registratie: Februari 2015
  • Laatst online: 12-01 14:37
Hi,

Here is a simple DZvents timer script to track the data from the Revoke Article 50 petition

return {
active = true,
on = {
timer = { 'every 5 minutes' },
httpResponses = { 'art50revoke' } -- matches callback string below
} ,
execute = function(domoticz, item)

if (item.isTimer) then
domoticz.openURL({
url = 'https://petition.parliament.uk/petitions/241584.json',
method = 'GET',
callback = 'art50revoke'
})
end
if (item.isHTTPResponse and item.ok) then

if (item.isJSON) then -- statusCode == 2xx
domoticz.log(item.json.data.attributes.signature_count)
domoticz.devices('Art 50 revoke signatures').updateCustomSensor(item.json.data.attributes.signature_count)
else
-- oops
-- domoticz.log('Error Petition data not in JSON', domoticz.LOG_ERROR)
end
end

end
}

create dummy device with name 'Art 50 revoke signatures', type: custom sensor, x-axis 'signatures'. Will be added to your Utility tab, why not ;)

  • Room42
  • Registratie: September 2001
  • Niet online
Mag gewoon in het Nederlands, hoor ;) Daarnaast is het handig om je code in [code]-tags te plaatsen voor de leesbaarheid. B)

Maar bovenal is vraag ik me af wat je nu met dit topic wilt. Als het gewoon een tip is, kan het misschien beter in het Domoticz - open source domotica systeem - deel 4-topic ;)

"Technological advancements don't feel fun anymore because of the motivations behind so many of them." Bron


  • Zeehond
  • Registratie: Juni 2015
  • Niet online

Zeehond

FP Admin & Powermod/ Mod W&M

Seal with it!

Het doel van dit topic is mij ook niet helemaal duidelijk. Wellicht past het idd beter in Domoticz - open source domotica systeem - deel 4 maar zorg dan voor iets meer toelichting en code tags. Graag ook Nederlands aanhoud als voertaal :).

200 fish found!


Dit topic is gesloten.