Page 1 of 2

Plugin: Travel Times

Posted: Tuesday 16 May 2017 18:28
by mastair
Created a very small plugin that let's you monitor travel times and delays (by car only for now) between A and B. Yeah I know, not so much to do with smart home he.

What you get:
  • Sensor with current travel time in minutes (i.e. if you would leave right now)
  • Sensor with percentage delay in relation to normal traffic for that time of the day
Why do you want that:
  • You probably won't
  • But maybe because you want to drive a RGB led with the current traffic congestion
  • Or have your eardrums blown up by a z-wave sirene while at breakfast, because you really need to leave the house now to get on work in time
Prerequisites: Installation and configuration:
  • Put complete folder from zip in plugins folder
  • Add 'Travel Times' hardware device
    • In from and to add a descriptive text that gives a distinctive location as if you would search on Google Maps
  • Set a not so small polling interval as free Google API Key gives you 2,500 requests per day only
Furthermore:
  • If for any reason people are actually interested in this, I will probably make the code a bit nicer. Leave some feedback or feature requests if you'd like.

Re: Plugin: Travel Times

Posted: Tuesday 16 May 2017 19:21
by Grove
I was thinking about it this afternoon. Great idea. Something like a map where on the road it is busy will be a nice feature.

Verstuurd vanaf mijn SM-G950F met Tapatalk

Re: Plugin: Travel Times

Posted: Tuesday 16 May 2017 21:55
by Derik
Great job!!!
When i have time i will give this a try...
NICE .... for my work...

Re: Plugin: Travel Times

Posted: Wednesday 17 May 2017 11:58
by CaesarPL
Excuse me - is there any special way that I should 'install' this plugin or it should be automatically recognized by Domoticz?

After sudo pip install urllib I also get:
Downloading/unpacking urllib
Could not find any downloads that satisfy the requirement urllib
Cleaning up...
No distributions at all found for urllib
Storing debug log for failure in /root/.pip/pip.log
Where is the issue, then? Should I install it through apt-get? python-urllib3 is already the newest version in my case

Re: Plugin: Travel Times

Posted: Wednesday 17 May 2017 12:20
by CaesarPL
CaesarPL wrote:Excuse me - is there any special way that I should 'install' this plugin or it should be automatically recognized by Domoticz?

After sudo pip install urllib I also get:
Downloading/unpacking urllib
Could not find any downloads that satisfy the requirement urllib
Cleaning up...
No distributions at all found for urllib
Storing debug log for failure in /root/.pip/pip.log
Where is the issue, then? Should I install it through apt-get? python-urllib3 is already the newest version in my case
Ok, first of all I have to check it at home. Can't restart Domoticz remotely for some reason, which is necessary to see new plugin.

Re: Plugin: Travel Times

Posted: Wednesday 17 May 2017 13:00
by qwerk
Hi, I installed this plugin.
It is really nice.
I set the interval at 300 seconds. But almost every 30 seconds I get in my domoticz logging:

Error: Reistijd hardware (28) thread seems to have ended unexpectedly

Reistijd is the name I gave it.

any clue?

Re: Plugin: Travel Times

Posted: Wednesday 17 May 2017 13:19
by mastair
qwerk wrote:Hi, I installed this plugin.
It is really nice.
I set the interval at 300 seconds. But almost every 30 seconds I get in my domoticz logging:

Error: Reistijd hardware (28) thread seems to have ended unexpectedly

Reistijd is the name I gave it.

any clue?
It's a bug in Domoticz if you have large heartbeat intervals.

Re: Plugin: Travel Times

Posted: Wednesday 17 May 2017 13:21
by mastair
CaesarPL wrote:Excuse me - is there any special way that I should 'install' this plugin or it should be automatically recognized by Domoticz?

After sudo pip install urllib I also get:
Downloading/unpacking urllib
Could not find any downloads that satisfy the requirement urllib
Cleaning up...
No distributions at all found for urllib
Storing debug log for failure in /root/.pip/pip.log
Where is the issue, then? Should I install it through apt-get? python-urllib3 is already the newest version in my case
When you have placed the folder in the plugin folder you should restart Domoticz, and you should be able to create one on the hardware tab.

As for urllib, try if it works without pip install. You probably already have it.

Re: Plugin: Travel Times

Posted: Wednesday 17 May 2017 13:56
by qwerk
mastair wrote:
qwerk wrote:Hi, I installed this plugin.
It is really nice.
I set the interval at 300 seconds. But almost every 30 seconds I get in my domoticz logging:

Error: Reistijd hardware (28) thread seems to have ended unexpectedly

Reistijd is the name I gave it.

any clue?
It's a bug in Domoticz if you have large heartbeat intervals.
thanks for the quick reply.
is there a way to measure the heartbeat intervals and can I change them?
I am running on a raspberry b

Re: Plugin: Travel Times

Posted: Wednesday 17 May 2017 14:28
by mastair
The heartbeat interval is exactly the polling interval as you defined in the hardware settings.

Also, if you don't mind the error message in the log. You can leave the polling interval as it doesn't harm the plugin function.

Re: Plugin: Travel Times

Posted: Wednesday 17 May 2017 14:48
by emme
this is very intresting!!!

a possible feature (to reduce the API Calls) is setting up a time schedule for quering the traffic information...
example.... I'm suppose to go at work at 8.00am... so I will query from 7.30 to 8.00
it does not make senso to me to query the traffic at 5.00pm :P :P


P.S.
I'm willing to do the same with the Milan public transportation (ATM): undeground and surface lines status :P :P

Re: Plugin: Travel Times

Posted: Friday 19 May 2017 8:03
by Mooseknuckle
Hi there,
Thanks for the great plugin. Is it possible to make input fields for travel options? I use the train to get to work. I could change mode to "transit" and transit_mode to "train" in the file but maybe more ppl would like to configure it in the hardware tab.

Thanks in advance,

Re: Plugin: Travel Times

Posted: Monday 10 July 2017 0:59
by corederoma82
Is this plugin ok with Windows?

Re: Plugin: Travel Times

Posted: Wednesday 12 July 2017 17:15
by mastair
Yes, I only tested on windows.

Re: Plugin: Travel Times

Posted: Wednesday 12 July 2017 17:57
by Failure404
Hi,
runs reliably on Rpi2.
The only annoying thing is the repeating message in the log saying
"2017-07-12 17:55:13.479 Error: Travel (16) thread seems to have ended unexpectedly"
Every 30 seconds.
Nothing that can be done about this? I don't want to run it less than every 300 seconds.

Re: Plugin: Travel Times

Posted: Wednesday 12 July 2017 18:02
by mastair
As said, it's a bug in Domoticz, not the plugin.

Re: Plugin: Travel Times

Posted: Wednesday 12 July 2017 21:44
by corederoma82
mastair wrote:Yes, I only tested on windows.
which is procedure for windows? And how associate the script?
Thanks

Re: Plugin: Travel Times

Posted: Thursday 13 July 2017 13:57
by Andree
Plugin works,sensor will be update but the log is full of error!
TTTError.JPG
TTTError.JPG (72.72 KiB) Viewed 4763 times

Re: Plugin: Travel Times

Posted: Friday 11 August 2017 16:11
by Andree
Andree wrote: Thursday 13 July 2017 13:57 Plugin works,sensor will be update but the log is full of error!
TTTError.JPG
Help!

Re: Plugin: Travel Times

Posted: Wednesday 18 October 2017 12:09
by mastair
Still a bug in Domoticz.