Hi, I had a little time fiddling with ProntoScript today and wrote a few lines to report the battery status of my 9800 back to my home automation software. Now I'm looking for a way to update the report maybe every hour or so. I would also be good if this only happend when the device is awake (or maybe also each time it wakes up).
As I see it now, that's not really possible, is it? As all the code is only running in a specific activity's context, I'd have to copy the same code to all activities, right? Or is there some way to use onSleep()/onWake() or scheduleAfter() on a system level?
You'd have to write a ProntoScript Module and include it at the System Level. Then each activity would get this module.
Note that this only works with PEP2 as this is where modules were introduced.
Now, with regard to how the Pronto operates.
1. When docked, even though the screen is off, ProntoScript is able to run continuously.
2. When undocked, Pronto CPU goes into a semi-sleep mode effectively waking up every minute or so to keep wifi active. When this happens, some ProntoScript can start to run and then be suspended again.
So, now, a very terse example.
Put this closurecode into a JS file and include it from the System Activity. It will be run for every activity in the configuration.
Awesome, thanks! That'll help a lot! I haven't looked into creating libraries yet, but looking at the PS dev guide, it doesn't seem to be overly complicated.
BTW: are you at liberty to reveal the meaning of the 4th bit in setDebugMask()? My version of the dev guide covers bit 0/1/2 but not 3. I've found an old thread where you couldn't share the info because of an NDA.
On Barry's Base Mod doc (available in left link bar) on the Wire Up the LED page, you will these 3 solder points. TX, RX, and GND I forget which pin is which but you should not have an issue if you miswire provided you don't short 2 pads together.
These holes just so happen to fit a 3 pin molex pin header (the kind used for many PC motherboard fan connectors). I soldered one in there (placed pins on top side of the board) and then used a 3 pin molex socket and ran wires out to a stereo 1/8" jack. This just so happens to be the jack into which the USB to serial adapter from FTDI plugs.
You then use Barry's VB program to monitor the output.
Barry had the mod instructions on the site at one time, or so I thought. I bet if you email him, he will happily send along docs that will augment what I describe above.
Thanks a lot for your explanation! I've found Barry's LED mod document on his site, it shouldn't be too hard to solder in the serial pin header. I'm not sure if I really this capability it at this time, though ;)
After reading the info below, if you need the mod, contact Barry. Maybe he will do the mod for you.
I have some comments with regard to current software available. Barry's mod/code were done at a time when there was only PEP1 and there was really no way to debug your code except with the _PS_DEBUG_ panels which was basically, a royal pain.
Then, comes PEP2 with a decent debugger.
Note that if you do System.setDebugMask(9), you can see your System.print() statements in the PEP2 Emulator Console window which for most cases, effectively eliminates the need for debugging on the Pronto and gets rid of the need for the _PS_DEBUG_ solution.
Provided you don't use the Pronto for IR but instead use RFX, with Jon's mod, you can set your config in PEP2 to used fixed-IP for all RFX units and you can run your config from your PC using the emulator.
So, if you need to test onSleep/onWake use Barry's mod. There are also some other use cases.
I used Barry's software again recently to test some things that worked in simulator. But as the simulator runs at PC speed, I needed to actual get some CPU benchmarks on the remote.
Thanks again! That definitely sounds useful - I'm just not sure how much time and effort I want to be investing in ProntoScript...
I got my TSU9800 only last year when I ditched my TSU7000 for it. Currently all my devices are controlled via IR and I don't use any of the RFX extenders. I once had some RF-controlled power plugs that I could control directly with the TSU7000 (European model). Most of them were attached to lights and they got replaced with Hue lights.
I've only played a few hours with ProntoScript so far. I managed to connect with my home automation software (home-assistant.io) and I set up an activity to control my lights through that. Currently, I don't see many use cases that would require extensive PS coding. Reporting the TSU's battery state back to home-assistant was a thing I wanted to try for fun. Also, I'm thinking about controlling Kodi (kodi.tv) through its JSON API instead of IR, but that's only an idea for now.
So far I only tested small code snippets at a time and watched the debug output inside a _PS_DEBUG panel in the simulator. I've also applied the TCP patch for it, which is an enormous improvement. Still I'm not sure I would want to start any larger projects in PS. Currently I'm preparing my code in a decent editor and then copy&paste it into PEP3, which can become pretty cumbersome. Having most of the code reside in a custom library might ease things up a little, though.
As it is now, on the one hand I'm grateful for the flexibility PS allows you, but on the other hand I'd probably always check first if there's another way to solve a "problem".
I still use Pronto's for the TV's and the entire home theater; I want the hard buttons. The home theater has a small PC as the central control point and the 9800 talks only to it.
Barry, you're absolutely right regarding the benefits of knowing one or more programming languages. Being an IT professional myself, you're preaching to the choir here ;)
When I was looking for PS examples last year, for example, I came across an implementation of a DLNA control point app (or something along those lines) someone created "back in the day". While this is an awesome achievement, that's about the project size where I think the Prontos today show their age. Today you'd probably get an iPad to run these kinds of applications. I just don't see me coding thousands of lines to run them on the TSU ;) I will however continue to improve my PS-skills and use it in places where it makes sense (like controlling a device over the Network).
CommandFusion does sound interesting, thanks for the tip! I think I once saw their website, but I got the impression that their hardware (i.e. server appliance) was required to make use of the apps. If I understand you correctly, you can also have the app talk to an (open source?) implementation running on a RPi? I'll have to look into that :)
As for the hard buttons, I'm right there with you (as is probably every Pronto user). I wouldn't want to have a control solution purely based on touch screens.
CommandFusion (CF) Has both a hardware operation and a software operation. I have never used their hardware but have extensively used their software. The two are not related but obviously will work together. Their hardware is focused on network connectivity.
I use an RPi-3 as my "central controller" replacing a long time Homeseer system. The RPi handles audio (TTS) and makes all announcements needed in the house. In the house, all communications except for legacy TV and set-top boxes is over IP (UDP or TCP or http). IR and RS232 are handled by a Global Cache unit(s). The RPi opens many ports each representing a single functionality e.g. TTS; and just listens for messages.
Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.