Page 2 of 9

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by Masonit
Hi

I am using your powershell models and they work great. Big thanks for sharing! :)

\Masonit

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by c8h10n4o2
So glad to hear that, thanks for telling me :-)

Feel free to post any feature requests you might want in this thread and I'll try to take a look at them when I get some time.

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by ArneG
Will there be any Get-TDSensorHistory soon ? The data from Telldus Live may be available now like it is with the Device-History ?

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by c8h10n4o2
ArneG wrote:Will there be any Get-TDSensorHistory soon ? The data from Telldus Live may be available now like it is with the Device-History ?
Sadly, there is no function to call for sensor history afaik, I have made a cmdlet/function for the detvice history though, the full module is available at github:
https://github.com/AWahlqvist/powershel ... lldus.psm1

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by ArneG
I know. I''m collecting devicehistory via that cmdlet on a regular basis. I also do poll the sensors via TD-GetSensor every 15 minutes or so, and that way collecting/storing my own sensorhistory locally via a simple Delphi-application that I've hacked together...But it would be nice to get this historical data directly from the Live-server the same way as for the device-history, and they are indeed betatesting this now. (http://live.telldus.com/sensor/index2). So Telldus Live server IS indeed storing such sensorhistory (You have to enabled the storing of historydata per device via 'Edit sensor'). Is there any way to pull off this history from the Live-server via a cmdlet?

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by c8h10n4o2
ArneG wrote:I know. I''m collecting devicehistory via that cmdlet on a regular basis. I also do poll the sensors via TD-GetSensor every 15 minutes or so, and that way collecting/storing my own sensorhistory locally via a simple Delphi-application that I've hacked together...But it would be nice to get this historical data directly from the Live-server the same way as for the device-history, and they are indeed betatesting this now. (http://live.telldus.com/sensor/index2). So Telldus Live server IS indeed storing such sensorhistory (You have to enabled the storing of historydata per device via 'Edit sensor'). Is there any way to pull off this history from the Live-server via a cmdlet?
Hey, look at that! Cool :)

I've now updated the module with Get-TDSensorHistoryData!

It's available at:
https://github.com/AWahlqvist/powershel ... lldus.psm1

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by ArneG
Got it :)
Thanx!

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by ArneG
The cmdlet for the sensorhistory data is collecting the complete history available on the telldusserver each time. This results in a lot of duplicate sensordata when the cmdlet is uses to poll the telldus server on a regular basis. Of course it is no problem handling/filtering out duplicate sensordata-reading/entries when dealing with the data locally afterwards.
But maybe you could modify the Cmdlet a bit so that the script using the sensorhistory-cmdlet can pass along a date/time-stamp along with the sensor-id to the cmdlet to only pull the sensorreadings on and after that given datestamp? Like pseudocode: "no need for getting those data I've already got, I only need the last few NEW entries since last poll"

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by c8h10n4o2
I'll look into it and get back to you!

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by c8h10n4o2
ArneG wrote:The cmdlet for the sensorhistory data is collecting the complete history available on the telldusserver each time. This results in a lot of duplicate sensordata when the cmdlet is uses to poll the telldus server on a regular basis. Of course it is no problem handling/filtering out duplicate sensordata-reading/entries when dealing with the data locally afterwards.
But maybe you could modify the Cmdlet a bit so that the script using the sensorhistory-cmdlet can pass along a date/time-stamp along with the sensor-id to the cmdlet to only pull the sensorreadings on and after that given datestamp? Like pseudocode: "no need for getting those data I've already got, I only need the last few NEW entries since last poll"
Sorry for taking so long... I started this and then sadly forgot about it... Anyway, new version available at:
https://github.com/AWahlqvist/powershel ... lldus.psm1

You can now specify After and Before parameters!

I hope it will be useful :-)

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by lizardus
Great work, thanks!

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by ArneG
Thanks. Works fine appearanty :P

Btw: maybe the example in the code should reflect that the cmdlet uses UTC times (since the timedata from Telldus live is in UTC, and getdate() returns local time by default)

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by c8h10n4o2
ArneG wrote:Thanks. Works fine appearanty :P

Btw: maybe the example in the code should reflect that the cmdlet uses UTC times (since the timedata from Telldus live is in UTC, and getdate() returns local time by default)
Glad it works! :)

Hmm... I think I see your point. The way it works now will make sure the user will get the expected data back from Telldus Live (converts the date you add to UTC). What I really should do though is convert the returned dates to the local time for the whole thing to make more sense (or the time zone of the tellstick really). It's supported in the API but I've been a bit lazy...

Did I understand you correctly? That it's a bit inconsistent currently? :-)

Would returning the local time or just ask for UTC time as input be preferred?

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by ArneG
c8h10n4o2 wrote:
Glad it works! :)

Hmm... I think I see your point. The way it works now will make sure the user will get the expected data back from Telldus Live (converts the date you add to UTC). What I really should do though is convert the returned dates to the local time for the whole thing to make more sense (or the time zone of the tellstick really). It's supported in the API but I've been a bit lazy...

Did I understand you correctly? That it's a bit inconsistent currently? :-)

Would returning the local time or just ask for UTC time as input be preferred?
Same thing different wrapping? :) I
I guess UTC as preffered input is ok, as long as the we/the script knows that the cmdlet expects UTC.
For me personally is doesn't matter really, since I will do my own handling/converting of dates&times as/if needed both when I use the cmdlet and when I processing the returned data afterwards :)

Re: PowerShell based cmdlets / Commands

Posted: Fri Mar 17, 2023 9:45 am
by Masonit
Hi

Since yesterday I get a certificate warning when running get-tdsensor. Never seen this before. Certificate is issued to *.ballou.se. Anyone else with the same problem? My powershell scripts isen't working correctly because of this.


\Masonit