Plugin: Travel Times

Python and python framework

Moderator: leecollings

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

Plugin: Travel Times

Post 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.
Attachments
TravelTimes.PNG
TravelTimes.PNG (25.24 KiB) Viewed 5405 times
TravelTimes_1.0.0.zip
(1.25 KiB) Downloaded 530 times
Grove
Posts: 13
Joined: Wednesday 01 June 2016 20:20
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post 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
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Plugin: Travel Times

Post by Derik »

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: 104
Joined: Tuesday 08 November 2016 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Poland
Contact:

Re: Plugin: Travel Times

Post 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
HW:Raspberry PiB+,Pi3,PiB,RFLink,FA20RF,DCS-930L,DCS-935L,Clarus switches,RF Temp sensors,Owl Micro+,Mi Flora,Kerui,Yeelight,Xiaomi,Broadlink RMM3,Alexa
SF:Jessie,Dmtcz 3.8153,Logitech Media srv,PiCorePlayers,Dashticz,Max2Play,InfluxDB,Grafana,HABridge
CaesarPL
Posts: 104
Joined: Tuesday 08 November 2016 14:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Poland
Contact:

Re: Plugin: Travel Times

Post 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.
HW:Raspberry PiB+,Pi3,PiB,RFLink,FA20RF,DCS-930L,DCS-935L,Clarus switches,RF Temp sensors,Owl Micro+,Mi Flora,Kerui,Yeelight,Xiaomi,Broadlink RMM3,Alexa
SF:Jessie,Dmtcz 3.8153,Logitech Media srv,PiCorePlayers,Dashticz,Max2Play,InfluxDB,Grafana,HABridge
qwerk
Posts: 222
Joined: Tuesday 22 July 2014 7:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Netherlands
Contact:

Re: Plugin: Travel Times

Post 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?
mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post 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.
mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post 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.
qwerk
Posts: 222
Joined: Tuesday 22 July 2014 7:21
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Netherlands
Contact:

Re: Plugin: Travel Times

Post 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
mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post 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.
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Plugin: Travel Times

Post 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
The most dangerous phrase in any language is:
"We always done this way"
User avatar
Mooseknuckle
Posts: 43
Joined: Sunday 08 March 2015 9:24
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post 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,
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: 85
Joined: Saturday 14 January 2017 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by corederoma82 »

Is this plugin ok with Windows?
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826, Controlicz, Kodi
mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by mastair »

Yes, I only tested on windows.
Failure404
Posts: 15
Joined: Sunday 24 July 2016 15:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post 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.
mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by mastair »

As said, it's a bug in Domoticz, not the plugin.
corederoma82
Posts: 85
Joined: Saturday 14 January 2017 21:34
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by corederoma82 »

mastair wrote:Yes, I only tested on windows.
which is procedure for windows? And how associate the script?
Thanks
Raspberry PI 3, 3x Yeelight bulbs, 1x Yeeligh led strip, 1x Sonoff with ESP826, Controlicz, Kodi
Andree
Posts: 74
Joined: Wednesday 07 June 2017 11:19
Target OS: Windows
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by Andree »

Plugin works,sensor will be update but the log is full of error!
TTTError.JPG
TTTError.JPG (72.72 KiB) Viewed 4759 times
Andree
Posts: 74
Joined: Wednesday 07 June 2017 11:19
Target OS: Windows
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post 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!
mastair
Posts: 24
Joined: Wednesday 01 July 2015 7:56
Target OS: -
Domoticz version:
Contact:

Re: Plugin: Travel Times

Post by mastair »

Still a bug in Domoticz.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest