Gå til innhold
  • Bli medlem
Støtt hjemmeautomasjon.no!

Anbefalte innlegg

Skrevet

Ah, pokker. Glemte entries, rart debuggeren ikke tok det...

 

Sub Main(parm As Object)
    Dim stop1 As String = "NSR:StopPlace:59854"
    Dim stop2 As String = "NSR:StopPlace:27753"
    Dim entries as Integer = 5

    Dim jsonQuery As String = "{trip(from:{place: """ & stop1 & """} to: {place: """ & stop2 & """} modes: [bus] numTripPatterns: " & entries & ") { tripPatterns { startTime endTime duration walkDistance legs {mode distance line {id publicCode name } }}}}"
    Dim result As String = RunQuery(jsonQuery)
    hs.WriteLog("EnTur", result)
 End Sub

 

Skrevet
1 minutt siden, Moskus skrev:

Ah, pokker. Glemte entries, rart debuggeren ikke tok det...

 


Sub Main(parm As Object)
    Dim stop1 As String = "NSR:StopPlace:59854"
    Dim stop2 As String = "NSR:StopPlace:27753"
    Dim entries as Integer = 5

    Dim jsonQuery As String = "{trip(from:{place: """ & stop1 & """} to: {place: """ & stop2 & """} modes: [bus] numTripPatterns: " & entries & ") { tripPatterns { startTime endTime duration walkDistance legs {mode distance line {id publicCode name } }}}}"
    Dim result As String = RunQuery(jsonQuery)
    hs.WriteLog("EnTur", result)
 End Sub

 

får denne i loggen nå:

  Running script C:\Program Files (x86)\HomeSeer HS3\scripts\EnTur.vb :Målet forårsaket et unntak under aktivering.->Does entry point Main exist in script? ved System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) ved System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) ved System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) ved Scheduler.clsRunVBNetScript.ExecuteScript()
jan-14 10.11.05   Event Running script and waiting: C:/Program Files (x86)/HomeSeer HS3/scripts/EnTur.vb("Main","345,NSR:StopPlace:57094,NSR:Quay:97801,5")
jan-14 10.11.05   Event Event Trigger "Ute Busstider"
jan-14 10.11.05   Event Event Ute Busstider triggered by the event page 'Run' button.
Skrevet

Når jeg bytter ut CallsFromStopplace med Main og parametere som blankt, får jeg:
Running script C:\Program Files (x86)\HomeSeer HS3\scripts\EnTur_test6.vb :Exception has been thrown by the target of an invocation.->Does entry point Main exist in script? at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Scheduler.clsRunVBNetScript.ExecuteScript()

 

Har forsøkt å fjerne referansen til Newtonsoft.JSon.dll i scripting-references, og da klager loggen på
Namespace or type specified in the Imports 'Newtonsoft.Json.Linq' doesn't contain any public member or cannot be found.

 

Forsøkte å endre tusenskille og kommategn, men eneste jeg oppnådde med det var å tulle til energy databasen.

 

Skrevet
7 minutes ago, Moskus said:

Ah, pokker. Glemte entries, rart debuggeren ikke tok det...

 


Sub Main(parm As Object)
    Dim stop1 As String = "NSR:StopPlace:59854"
    Dim stop2 As String = "NSR:StopPlace:27753"
    Dim entries as Integer = 5

    Dim jsonQuery As String = "{trip(from:{place: """ & stop1 & """} to: {place: """ & stop2 & """} modes: [bus] numTripPatterns: " & entries & ") { tripPatterns { startTime endTime duration walkDistance legs {mode distance line {id publicCode name } }}}}"
    Dim result As String = RunQuery(jsonQuery)
    hs.WriteLog("EnTur", result)
 End Sub

 

Får samme som Roger:

Running script C:\Program Files (x86)\HomeSeer HS3\scripts\EnTur_test7.vb :Exception has been thrown by the target of an invocation.->Does entry point Main exist in script? at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at Scheduler.clsRunVBNetScript.ExecuteScript()

Skrevet

OK, da ser det ut som om jeg kan replikere feilen. Alltid enklere da. Jeg forstår bare ikke hvorfor det fungerer på noen maskiner, men ikke på andre.

 

 

Skrevet
Akkurat nå, Kensko skrev:

Mange varianter av Newtonsoft.Json.dll i HomeSeer plugins mappene. Kan det være at vi har en feil versjon? 

Nei, det spiller ingen rolle. Pluginene definerer selv hvilken versjon de skal bruke og hvor den ligger.

Skrevet

OK, jeg fant bug'en. :) 

... og selvfølgelig er det slik at når jeg har funnet den så burde jeg ha tenkt på den med en gang.

 

Det mangler en linje i RunQuery-funksjonen. Den skal altså se slik ut:

 

Private Function RunQuery(ByVal jsonQuery As String) As String
    Dim url As String = "https://api.entur.io/journey-planner/v2/graphql"

    Using client As New System.Net.WebClient
        Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Tls12
        client.Headers.Add("ET-Client-Name", "Moskus-InfoplakatForHomeseer")
        client.Headers.Add("User-Agent", "EnTur-script by Moskus")
        client.Headers.Add("Content-Type", "application/graphql")
        client.Encoding = System.Text.Encoding.UTF8
        client.BaseAddress = url

        Return client.UploadString(url, "POST", jsonQuery)
    End Using
End Function

... som tvinger WebClient til å bruke TLS12.

 

Hele scriptet skal altså være slik:

 

Imports Newtonsoft.Json
Imports Newtonsoft.Json.Linq
Imports System.Collections.Generic

'Moskus 2019
'Besøk https://en-tur.no for å finne stop-ider og quay-ider

Sub CallsFromStopplace(parm As Object)
    Dim input() As String = parm.ToString.Split(",")
    Dim deviceRef As Integer = input(0).Trim
    Dim stop1 As String = input(1).Trim
    Dim quay As String = ""
    Dim entries As Integer = 5
    If input.GetLength(0) > 2 Then quay = input(2).Trim
    If input.GetLength(0) = 4 Then entries = input(3).Trim

    Dim list As List(Of EstimatedCall) = GetCallsFromStopPlace(stop1, quay, entries)
    Dim out As String = ""

    For Each c As EstimatedCall In list
        out &= c.ToString & "<br>"
    Next
    Dim minutesToNextDeparture As Integer = list(0).expectedArrivalTime.Subtract(Now).TotalMinutes

    hs.SetDeviceString(deviceRef, out, False)
    hs.SetDeviceValueByRef(deviceRef, minutesToNextDeparture, True)


End Sub

Sub TripsBetweenStops(parm As Object)
    Dim input() As String = parm.ToString.Split(",")
    Dim deviceRef As Integer = input(0).Trim
    Dim stop1 As String = input(1).Trim
    Dim stop2 As String = input(2).Trim
    Dim entries As Integer = 5
    If input.GetLength(0) = 4 Then entries = input(3).Trim


    Dim list As List(Of Trippattern) = GetTripBetweenStops(stop1, stop2, entries)
    Dim out As String = ""

    For Each c As Trippattern In list
        out &= c.ToString & "<br>"
    Next
    Dim minutesToNextDeparture As Integer = list(0).startTime.Subtract(Now).TotalMinutes

    hs.SetDeviceString(deviceRef, out, False)
    hs.SetDeviceValueByRef(deviceRef, minutesToNextDeparture, True)

End Sub

Private Function RunQuery(ByVal jsonQuery As String) As String
    Dim url As String = "https://api.entur.io/journey-planner/v2/graphql"

    Using client As New System.Net.WebClient
        Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Tls12
        client.Headers.Add("ET-Client-Name", "Moskus-InfoplakatForHomeseer")
        client.Headers.Add("User-Agent", "EnTur-script by Moskus")
        client.Headers.Add("Content-Type", "application/graphql")
        client.Encoding = System.Text.Encoding.UTF8
        client.BaseAddress = url

        Return client.UploadString(url, "POST", jsonQuery)
    End Using
End Function

Private Function GetCallsFromStopPlace(ByVal _stop As String, Optional ByVal _quay As String = "", Optional ByVal entries As Integer = 5) As List(Of EstimatedCall)
    Dim jsonQuery As String = "{stopPlace(id: """ & _stop & """) {id name estimatedCalls(startTime: """ & Now.ToString("yyyy-MM-ddTHH:mm:sszzz") & """, timeRange: 72100, numberOfDepartures: " & (entries * 2 + 2) & "){ realtime aimedArrivalTime expectedArrivalTime destinationDisplay {frontText} quay {id} serviceJourney {journeyPattern {line {id name transportMode}}}}}}"

    Dim result As String = RunQuery(jsonQuery)
    Dim enTurJson As EnTur = Newtonsoft.Json.JsonConvert.DeserializeObject(Of EnTur)(result)

    Dim lst As New List(Of EstimatedCall)
    Dim count As Integer = 0
    For Each e As EstimatedCall In enTurJson.data.stopPlace.estimatedCalls
        If _quay <> "" Then
            If e.quay.id = _quay Then
                lst.Add(e)
                count += 1
            End If
        Else
            lst.Add(e)
            count += 1
        End If
        If count = entries Then Exit For
    Next
    Return lst
End Function

Private Function GetTripBetweenStops(ByVal stop1 As String, ByVal stop2 As String, Optional ByVal entries As Integer = 5) As List(Of Trippattern)
    Dim jsonQuery As String = "{trip(from:{place: """ & stop1 & """} to: {place: """ & stop2 & """} modes: [bus] numTripPatterns: " & entries & ") { tripPatterns { startTime endTime duration walkDistance legs {mode distance line {id publicCode name } }}}}"

    Dim result As String = RunQuery(jsonQuery)
    Dim enTurJson As EnTur = JsonConvert.DeserializeObject(Of EnTur)(result)

    Return enTurJson.data.trip.tripPatterns
End Function

Sub Main(parm As Object)

End Sub

Public Class EnTur
    Private _data As Data
    Public Property data() As Data
        Get
            Return _data
        End Get
        Set(ByVal value As Data)
            _data = value
        End Set
    End Property
End Class

Public Class Data
    Private _stopPlace As Stopplace
    Public Property stopPlace() As Stopplace
        Get
            Return _stopPlace
        End Get
        Set(ByVal value As Stopplace)
            _stopPlace = value
        End Set
    End Property
    Private _trip As Trip
    Public Property trip() As Trip
        Get
            Return _trip
        End Get
        Set(ByVal value As Trip)
            _trip = value
        End Set
    End Property

End Class

Public Class Stopplace
    Private _id As String
    Public Property id() As String
        Get
            Return _id
        End Get
        Set(ByVal value As String)
            _id = value
        End Set
    End Property
    Private _name As String
    Public Property name() As String
        Get
            Return _name
        End Get
        Set(ByVal value As String)
            _name = value
        End Set
    End Property
    Private _estimatedCalls As List(Of EstimatedCall)
    Public Property estimatedCalls() As List(Of EstimatedCall)
        Get
            Return _estimatedCalls
        End Get
        Set(ByVal value As List(Of EstimatedCall))
            _estimatedCalls = value
        End Set
    End Property
End Class

Public Class EstimatedCall
    Private _realtime As Boolean
    Public Property realtime() As Boolean
        Get
            Return _realtime
        End Get
        Set(ByVal value As Boolean)
            _realtime = value
        End Set
    End Property
    Private _aimedArrivalTime As Date
    Public Property aimedArrivalTime() As Date
        Get
            Return _aimedArrivalTime
        End Get
        Set(ByVal value As Date)
            _aimedArrivalTime = value
        End Set
    End Property
    Private _aimedDepartureTime As Date
    Public Property aimedDepartureTime() As Date
        Get
            Return _aimedDepartureTime
        End Get
        Set(ByVal value As Date)
            _aimedDepartureTime = value
        End Set
    End Property
    Private _expectedArrivalTime As Date
    Public Property expectedArrivalTime() As Date
        Get
            Return _expectedArrivalTime
        End Get
        Set(ByVal value As Date)
            _expectedArrivalTime = value
        End Set
    End Property
    Private _expectedDepartureTime As Date
    Public Property expectedDepartureTime() As Date
        Get
            Return _expectedDepartureTime
        End Get
        Set(ByVal value As Date)
            _expectedDepartureTime = value
        End Set
    End Property
    Private _actualArrivalTime As Object
    Public Property actualArrivalTime() As Object
        Get
            Return _actualArrivalTime
        End Get
        Set(ByVal value As Object)
            _actualArrivalTime = value
        End Set
    End Property
    Private _actualDepartureTime As Object
    Public Property actualDepartureTime() As Object
        Get
            Return _actualDepartureTime
        End Get
        Set(ByVal value As Object)
            _actualDepartureTime = value
        End Set
    End Property
    Private __date As String
    Public Property _date() As String
        Get
            Return __date
        End Get
        Set(ByVal value As String)
            __date = value
        End Set
    End Property
    Private _forBoarding As Boolean
    Public Property forBoarding() As Boolean
        Get
            Return _forBoarding
        End Get
        Set(ByVal value As Boolean)
            _forBoarding = value
        End Set
    End Property
    Private _forAlighting As Boolean
    Public Property forAlighting() As Boolean
        Get
            Return _forAlighting
        End Get
        Set(ByVal value As Boolean)
            _forAlighting = value
        End Set
    End Property
    Private _destinationDisplay As Destinationdisplay
    Public Property destinationDisplay() As Destinationdisplay
        Get
            Return _destinationDisplay
        End Get
        Set(ByVal value As Destinationdisplay)
            _destinationDisplay = value
        End Set
    End Property
    Private _quay As Quay
    Public Property quay() As Quay
        Get
            Return _quay
        End Get
        Set(ByVal value As Quay)
            _quay = value
        End Set
    End Property
    Private _serviceJourney As Servicejourney
    Public Property serviceJourney() As Servicejourney
        Get
            Return _serviceJourney
        End Get
        Set(ByVal value As Servicejourney)
            _serviceJourney = value
        End Set
    End Property

    Public Overrides Function ToString() As String
        Return Me.expectedArrivalTime.ToString("HH:mm") & " (" & Me.aimedArrivalTime.ToString("HH:mm") & ")" & ": " & Me.serviceJourney.journeyPattern.line.name & " " & Me.destinationDisplay.frontText
    End Function

    Public Shared Sub ToFile(ByVal calls As List(Of EstimatedCall), ByVal filename As String)
        If calls.Count = 0 Then Exit Sub

        Dim sb As New Text.StringBuilder
        'FEILER
        'calls.ForEach(Sub(x) sb.AppendLine(x.ToString))
        My.Computer.FileSystem.WriteAllText(Environment.CurrentDirectory & "\" & filename, sb.ToString, False)
    End Sub
End Class

Public Class Destinationdisplay
    Private _frontText As String
    Public Property frontText() As String
        Get
            Return _frontText
        End Get
        Set(ByVal value As String)
            _frontText = value
        End Set
    End Property
End Class

Public Class Quay
    Private _id As String
    Public Property id() As String
        Get
            Return _id
        End Get
        Set(ByVal value As String)
            _id = value
        End Set
    End Property
    Private _name As String
    Public Property name() As String
        Get
            Return _name
        End Get
        Set(ByVal value As String)
            _name = value
        End Set
    End Property
End Class

Public Class Servicejourney
    Private _journeyPattern As Journeypattern
    Public Property journeyPattern() As Journeypattern
        Get
            Return _journeyPattern
        End Get
        Set(ByVal value As Journeypattern)
            _journeyPattern = value
        End Set
    End Property
End Class

Public Class Journeypattern
    Private _line As Line
    Public Property line() As Line
        Get
            Return _line
        End Get
        Set(ByVal value As Line)
            _line = value
        End Set
    End Property
End Class

Public Class Line
    Private _id As String
    Public Property id() As String
        Get
            Return _id
        End Get
        Set(ByVal value As String)
            _id = value
        End Set
    End Property
    Private _name As String
    Public Property name() As String
        Get
            Return _name
        End Get
        Set(ByVal value As String)
            _name = value
        End Set
    End Property
    Private _transportMode As String
    Public Property transportMode() As String
        Get
            Return _transportMode
        End Get
        Set(ByVal value As String)
            _transportMode = value
        End Set
    End Property
    Private _publicCode As String
    Public Property publicCode() As String
        Get
            Return _publicCode
        End Get
        Set(ByVal value As String)
            _publicCode = value
        End Set
    End Property
End Class


Public Class Trip
    Private _tripPatterns As List(Of Trippattern)
    Public Property tripPatterns() As List(Of Trippattern)
        Get
            Return _tripPatterns
        End Get
        Set(ByVal value As List(Of Trippattern))
            _tripPatterns = value
        End Set
    End Property
End Class

Public Class Trippattern
    Private _startTime As Date
    Public Property startTime() As Date
        Get
            Return _startTime
        End Get
        Set(ByVal value As Date)
            _startTime = value
        End Set
    End Property
    Private _endTime As Date
    Public Property endTime() As Date
        Get
            Return _endTime
        End Get
        Set(ByVal value As Date)
            _endTime = value
        End Set
    End Property
    Private _duration As Integer
    Public Property duration() As Integer
        Get
            Return _duration
        End Get
        Set(ByVal value As Integer)
            _duration = value
        End Set
    End Property
    Private _walkDistance As Double
    Public Property walkDistance() As Double
        Get
            Return _walkDistance
        End Get
        Set(ByVal value As Double)
            _walkDistance = value
        End Set
    End Property
    Private _legs As List(Of Leg)
    Public Property legs() As List(Of Leg)
        Get
            Return _legs
        End Get
        Set(ByVal value As List(Of Leg))
            _legs = value
        End Set
    End Property

    Public Overrides Function ToString() As String
        Return Me.startTime.ToString("HH:mm") & " → " & Me.endTime.ToString("HH:mm") & ":  Rute " & Me.legs(0).line.name
    End Function

    Public Shared Sub ToFile(ByVal calls As List(Of Trippattern), ByVal filename As String)
        If calls.Count = 0 Then Exit Sub

        Dim sb As New Text.StringBuilder
        'FEILER
        ' calls.ForEach(Sub(x) sb.AppendLine(x.ToString))
        My.Computer.FileSystem.WriteAllText(Environment.CurrentDirectory & "\" & filename, sb.ToString, False)
    End Sub
End Class

Public Class Leg
    Private _mode As String
    Public Property mode() As String
        Get
            Return _mode
        End Get
        Set(ByVal value As String)
            _mode = value
        End Set
    End Property
    Private _distance As Single
    Public Property distance() As Single
        Get
            Return _distance
        End Get
        Set(ByVal value As Single)
            _distance = value
        End Set
    End Property
    Private _line As Line
    Public Property line() As Line
        Get
            Return _line
        End Get
        Set(ByVal value As Line)
            _line = value
        End Set
    End Property
End Class

 

... eller bruk denne:

EnTur.vb

  • Thanks 2
Skrevet

Japp, der virker det!

1192717275_Screenshotfrom2020-01-1410-34-40.png.423370d7cdd706e35c285e67aa36d775.png

 

Betyr det at min HomeSeer server fortsatt bruker TLS 1.0/1.1? Eller er det webleseren som du HomeSeer via som gjør dette?

 

Uansett, takk for at du gidder :)

  • Like 1
Skrevet
13 minutter siden, Kensko skrev:

Betyr det at min HomeSeer server fortsatt bruker TLS 1.0/1.1? Eller er det webleseren som du HomeSeer via som gjør dette?

Det betyr ikke mer enn at WebClient defaulter til TSL 1.0/1.1, men den kan tvinges til å bruke 1.2.

Jeg fant en fornuftig forklaring på det første gang jeg møtte problemet, men har glemt det nå...

Skrevet
19 minutter siden, GeneralVirus skrev:

Fungerer helt fint nå igjen. Rart at det funket for meg før, men plutselig sluttet.

Ja, det betyr at en del webservere har fått oppgradert sikkerheten i mellomtiden. ;)

Skrevet

hmm, så bra for dere, mennår jeg kjører det samme scripet får jeg fremdeles feilmelding, tror jeg er ganna:

jan-14 16.33.31   Error 3 Running script C:\Program Files (x86)\HomeSeer HS3\scripts\EnTur.vb :Målet forårsaket et unntak under aktivering.->Does entry point CallsFromStopplace exist in script? ved System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) ved System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) ved System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) ved Scheduler.clsRunVBNetScript.ExecuteScript()
jan-14 16.33.30   Event Running script and waiting: C:/Program Files (x86)/HomeSeer HS3/scripts/EnTur.vb("CallsFromStopplace","345,NSR:StopPlace:57094,NSR:Quay:97801,5")
jan-14 16.33.30   Event

Event Trigger "Ute Busstider"

 

 

Spoiler

 

 

Skrevet
17 minutter siden, Moskus skrev:

.... Men fungerer Main-rutinene some vi hard postet før?

Ja, ser ihvertfall ikke noen feilmelding i loggen ved oppkall av Main istedenfor den andre rutinen.
Så der er en forskjell! ?

Skrevet
4 minutter siden, Rogerbl skrev:

Ja, ser ihvertfall ikke noen feilmelding i loggen ved oppkall av Main istedenfor den andre rutinen.
Så der er en forskjell! ?

Her er resultat fra siste Main rutine jeg fik fra deg:

{"data":{"trip":{"tripPatterns":[{"startTime":"2020-01-14T17:21:00+0100","endTime":"2020-01-14T17:28:00+0100","duration":420,"walkDistance":0.0,"legs":[{"mode":"bus","distance":2550.9434618963073,"line":{"id":"KOL:Line:1006_245","publicCode":"5","name":"5"}}]},{"startTime":"2020-01-14T17:29:00+0100","endTime":"2020-01-14T17:36:00+0100","duration":420,"walkDistance":0.0,"legs":[{"mode":"bus","distance":2550.9434618963073,"line":{"id":"KOL:Line:1006_245","publicCode":"5","name":"5"}}]},{"startTime":"2020-01-14T17:36:00+0100","endTime":"2020-01-14T17:43:00+0100","duration":420,"walkDistance":0.0,"legs":[{"mode":"bus","distance":2550.9434618963073,"line":{"id":"KOL:Line:1006_245","publicCode":"5","name":"5"}}]},{"startTime":"2020-01-14T17:44:00+0100","endTime":"2020-01-14T17:51:00+0100","duration":420,"walkDistance":0.0,"legs":[{"mode":"bus","distance":2550.9434618963073,"line":{"id":"KOL:Line:1006_245","publicCode":"5","name":"5"}}]},{"startTime":"2020-01-14T17:51:00+0100","endTime":"2020-01-14T17:58:00+0100","duration":420,"walkDistance":0.0,"legs":[{"mode":"bus","distance":2550.9434618963073,"line":{"id":"KOL:Line:1006_245","publicCode":"5","name":"5"}}]}]}}}

Skrevet (endret)

endret fra Main til Tripsbetweenstopplaces og det funker!
Fått lagt inn de to stoppestedene herfra til Alta.
Takk Moskus for en god jobb! ?
 

 

Busstabell-Eiby.png

Endret av Rogerbl
Skrevet

Så bra! :) 

 

... kan du prøve dette:

    Sub Main(parm As Object)
        Dim list As List(Of EstimatedCall) = GetCallsFromStopPlace("NSR:StopPlace:27753", "NSR:Quay:47785")
        Dim out As String = ""

        For Each c As EstimatedCall In list
            out &= c.ToString & "<br>"
        Next

        hs.WriteLog("EnTur", out)
    End Sub

 

 

Skrevet
6 minutter siden, Moskus skrev:

Sub Main(parm As Object) Dim list As List(Of EstimatedCall) = GetCallsFromStopPlace("NSR:StopPlace:27753", "NSR:Quay:47785") Dim out As String = "" For Each c As EstimatedCall In list out &= c.ToString & "<br>" Next hs.WriteLog("EnTur", out) End Sub

Det likte ikke Hs3; her er feilmeldingen:

Running script C:\Program Files (x86)\HomeSeer HS3\scripts\EnTur.vb :Målet forårsaket et unntak under aktivering.->Does entry point Main exist in script? ved System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) ved System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) ved System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) ved Scheduler.clsRunVBNetScript.ExecuteScript()

Skrevet

Tips ang. sortering:

Les radene inn i en tabell, sorter denne og skriv ut den sorterte tabellen til dev string'en. ?
Det er mer oversiktlig med sortering.

Og i HSTouch ser man kun starten på dev stringen..  det var litt synd. Man får ikke sett alt, kanskje en ide å

sende en pushover melding til  telefonen sånn at man får sett alle mulige avganger?

Skrevet
33 minutter siden, Rogerbl skrev:

Det likte ikke Hs3

Oookay, det er snålt Prøv dette, da:

Endre

GetCallsFromStopPlace("NSR:StopPlace:27753", "NSR:Quay:47785")

til:

GetCallsFromStopPlace("NSR:StopPlace:27753")

 

 

27 minutter siden, Rogerbl skrev:

Tips ang. sortering:

Les radene inn i en tabell, sorter denne og skriv ut den sorterte tabellen til dev string'en. ?
Det er mer oversiktlig med sortering.

Sortering av hva?

Det er vel sortert slik det skal?

 

Å laste over i en tabell for å sortere den er vel å gå over bekken etter vann.

 

 

27 minutter siden, Rogerbl skrev:

Og i HSTouch ser man kun starten på dev stringen..

I HStouch ser man hele strengen, det er jo ikke et problem. :) 

Du må evt. utvide selve labelen.

 

 

Skrevet
3 minutter siden, Moskus skrev:

Oookay, det er snålt Prøv dette, da:

Endre


GetCallsFromStopPlace("NSR:StopPlace:27753", "NSR:Quay:47785")

til:


GetCallsFromStopPlace("NSR:StopPlace:27753")

 

 

Sortering av hva?

Det er vel sortert slik det skal?

 

Å laste over i en tabell for å sortere den er vel å gå over bekken etter vann.

 

 

I HStouch ser man hele strengen, det er jo ikke et problem. :) 

Du må evt. utvide selve labelen.

 

 

vel, her hos meg er avgangstidene usortert. ?

Skrevet (endret)

Her er et modifisert vb script(pushoverhs.vb) som jeg bruker til å sende meg selv pushover meldinger med devicestring verdier. Det kan brukes til å sende

bussruter til din smarttelefon. F.eks en gang pr dag.

Parametrene er  Subjekt | hs.devID | prioritet | lyd

f.eks Bussrute Alta - Eiby | 567 | 1 | 1

Hvis du har installert Pushover plugin'en for HomeSeer vil du da motta en melding med bussrutene.

Du må selvsagt kjøre Moskus sitt Entur.vb script først så devicene får verdier.

Sjekk ut det orginale pushover.vb scriptet for mer info.

 

pushover.vb

pushoverhs.vb

push.jpg

Endret av Rogerbl
  • Like 1

Bli med i samtalen

Du kan publisere innhold nå og registrere deg senere. Hvis du har en konto, logg inn nå for å poste med kontoen din.

Gjest
Skriv svar til emnet...

×   Du har limt inn tekst med formatering.   Lim inn uten formatering i stedet

  Du kan kun bruke opp til 75 smilefjes.

×   Lenken din har blitt bygget inn på siden automatisk.   Vis som en ordinær lenke i stedet

×   Tidligere tekst har blitt gjenopprettet.   Tøm tekstverktøy

×   Du kan ikke lime inn bilder direkte. Last opp eller legg inn bilder fra URL.

×
×
  • Opprett ny...

Viktig informasjon

Vi har plassert informasjonskapsler/cookies på din enhet for å gjøre denne siden bedre. Du kan justere dine innstillinger for informasjonskapsler, ellers vil vi anta at dette er ok for deg.