Plugin: Travel Times

Python and python framework
Post Reply
mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Plugin: Travel Times

Post by mastair » Tuesday 16 May 2017 18:28

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.
Attachments
TravelTimes.PNG
TravelTimes.PNG (25.24 KiB) Viewed 1473 times
TravelTimes_1.0.0.zip
(1.25 KiB) Downloaded 71 times

Grove
Posts: 11
Joined: Wednesday 01 June 2016 20:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by Grove » Tuesday 16 May 2017 19:21

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

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

Re: Plugin: Travel Times

Post by Derik » Tuesday 16 May 2017 21:55

Great job!!!
When i have time i will give this a try...
NICE .... for my work...
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

CaesarPL
Posts: 67
Joined: Tuesday 08 November 2016 15:03
Target OS: Raspberry Pi
Domoticz version:
Location: Poland
Contact:

Re: Plugin: Travel Times

Post by CaesarPL » Wednesday 17 May 2017 11:58

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
HW: Raspberry Pi B+,Pi 3,2x Pi B,RFLink,FA20RF,DCS-930L,DCS-935L,Clarus switches,Eurochron,chinese and Alecto Temp,Owl Micro+,Mi Flora,Kerui door sensor,Yeelight,Xiaomi stuff
SF: Jessie, Domoticz 3.8153, Logitech Media server, PiCorePlayers, Dashticz

CaesarPL
Posts: 67
Joined: Tuesday 08 November 2016 15:03
Target OS: Raspberry Pi
Domoticz version:
Location: Poland
Contact:

Re: Plugin: Travel Times

Post by CaesarPL » Wednesday 17 May 2017 12:20

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.
HW: Raspberry Pi B+,Pi 3,2x Pi B,RFLink,FA20RF,DCS-930L,DCS-935L,Clarus switches,Eurochron,chinese and Alecto Temp,Owl Micro+,Mi Flora,Kerui door sensor,Yeelight,Xiaomi stuff
SF: Jessie, Domoticz 3.8153, Logitech Media server, PiCorePlayers, Dashticz

qwerk
Posts: 265
Joined: Tuesday 22 July 2014 7:21
Target OS: Raspberry Pi
Domoticz version: beta
Location: Netherlands
Contact:

Re: Plugin: Travel Times

Post by qwerk » Wednesday 17 May 2017 13:00

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?

mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by mastair » Wednesday 17 May 2017 13:19

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.

mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by mastair » Wednesday 17 May 2017 13:21

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.

qwerk
Posts: 265
Joined: Tuesday 22 July 2014 7:21
Target OS: Raspberry Pi
Domoticz version: beta
Location: Netherlands
Contact:

Re: Plugin: Travel Times

Post by qwerk » Wednesday 17 May 2017 13:56

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

mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by mastair » Wednesday 17 May 2017 14:28

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.

User avatar
emme
Posts: 564
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Plugin: Travel Times

Post by emme » Wednesday 17 May 2017 14:48

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
That's one small step for a programmer, one giant leap for me!
- - - - -
Raspberry Pi3 + AeonStick G5 + RFXCOMM433 + iRTrans Server + NodeJS
There's no stress in the mess!!

User avatar
Mooseknuckle
Posts: 68
Joined: Sunday 08 March 2015 10:24
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by Mooseknuckle » Friday 19 May 2017 8:03

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,
RPI 3, Philips Hue,Toon Thermostat, Harmony Smart Control, Yeelights
Mysensors wifi gateway + sensors, RFXtrx433E, Kaku stuff, Xiaomi gateway + sensors
Domoticz controlled DIY ambilight, Selectplus chime, Mi-light led controller

corederoma82
Posts: 31
Joined: Saturday 14 January 2017 22:34
Target OS: Windows
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by corederoma82 » Monday 10 July 2017 0:59

Is this plugin ok with Windows?

mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by mastair » Wednesday 12 July 2017 17:15

Yes, I only tested on windows.

Failure404
Posts: 12
Joined: Sunday 24 July 2016 15:28
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by Failure404 » Wednesday 12 July 2017 17:57

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.

mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by mastair » Wednesday 12 July 2017 18:02

As said, it's a bug in Domoticz, not the plugin.

corederoma82
Posts: 31
Joined: Saturday 14 January 2017 22:34
Target OS: Windows
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by corederoma82 » Wednesday 12 July 2017 21:44

mastair wrote:Yes, I only tested on windows.
which is procedure for windows? And how associate the script?
Thanks

Andree
Posts: 69
Joined: Wednesday 07 June 2017 11:19
Target OS: Windows
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by Andree » Thursday 13 July 2017 13:57

Plugin works,sensor will be update but the log is full of error!
TTTError.JPG
TTTError.JPG (72.72 KiB) Viewed 827 times

Andree
Posts: 69
Joined: Wednesday 07 June 2017 11:19
Target OS: Windows
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by Andree » Friday 11 August 2017 16:11

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

mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by mastair » Wednesday 18 October 2017 12:09

Still a bug in Domoticz.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests