Closed 3axis closed 5 years ago
Along with the rounding.
How many decimals would you round to, two?
2 or 1 should be ok ;) maybe together with own side panel, you can create tab with some kind of statistic?
I can't get this to work. I tried turning the printer on/off several times with the UI. I even uninstalled and reinstalled this plugin. I can see the readings from my plug by running the hs100.sh emeter script so it should be working.
@KissmanCZ: I think once I get into logging I'll add additional features like graphing the data, etc., but that's going to be a while before I get to it.
@viljamip: Please enable debug logging and upload your plugin_tplinksmartplug_debug and octoprint log files.
Hopefully these will help you. I deleted the logs, enabled logging, restarted octoprint, turned the printer on, waited a minute, turned the printer off, waited a minute. The power stats are getting to the log just fine but I have never seen them working in the UI. plugin_tplinksmartplug_debug.log octoprint.log
@KissmanCZ: How is this? I need to either work out a way to show only the sidebar panel when there are energy monitoring devices only or move the navbar buttons into the side panel. I'd personally prefer the former because I don't like the idea of a single button in a sidebar panel for those users that only have one plug.
@viljamip, the logs don't really show any errors, but I am working on some additional changes that should help in the logic. In the meantime, if you install version 0.9.6 you should be able to get the plugin functional again. Use the following url in Plugin Manager.
https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/archive/0.9.6.zip
Look good... just implement logic which remove divider after last plug in the box. And center vertically divider between plugs. And yeah, showing panel only for plugs with power usage readings is OK.
Tackled the border issue etc. using pure css approach.
I've updated the logic for the on/off commands too, which might resolve the issue for you @viljamip. If you guys don't mind being my guinea pigs you could install this version using the following URL in plugin manager. Let me know if it works out for you. This version should also not wipe out your previous settings, but it will clear out the previous emeter readings, but that should re-update once the plugs' statuses are checked. So far it's working for me and my HS100 and (2) HS110 devices.
https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/archive/0.9.8.zip
Hmmm.... turn on/off action is now very fast :) perfect. Still no readings from my second HS110 :(
I tried 0.9.8 but I still can't see the readings in the UI. On/Off functionality is working nicely.
The new UI panel was so low in the UI that I had to scroll down to see it. Can I rearrange the UI somehow or could you put it maybe below the State panel and above the Files?
There's an unpublished plugin called OctoPrint-SidebarOrder in github that was a fork of my tab order one that will let you rearrange the panels. Otherwise, you can just minimize the other panels to bring it up.
As for the not updating part if you open the browser's console are there any errors?
Uncaught TypeError: Unable to process binding "if: function(){return emeter.get_realtime }" Message: Unable to process binding "text: function(){return emeter.get_realtime.power().toFixed(2) }" Message: emeter.get_realtime.power is not a function at text (eval at parseBindingsString (packed_libs.js?331a1bb5:11374), <anonymous>:3:84) at update (packed_libs.js?331a1bb5:11404) at function.a.B.i (packed_libs.js?331a1bb5:11378) at Function.Pc (packed_libs.js?331a1bb5:11357) at Function.Qc (packed_libs.js?331a1bb5:11357) at Function.aa (packed_libs.js?331a1bb5:11356) at Object.a.m.a.B (packed_libs.js?331a1bb5:11355) at packed_libs.js?331a1bb5:11378 at Object.q (packed_libs.js?331a1bb5:11317) at m (packed_libs.js?331a1bb5:11377)
Uncaught TypeError: Unable to process binding "if: function(){return emeter.get_realtime }" Message: Unable to process binding "text: function(){return emeter.get_realtime.power().toFixed(2) }" Message: emeter.get_realtime.power is not a function at text (eval at parseBindingsString (packed_libs.js?331a1bb5:11374), <anonymous>:3:84) at update (packed_libs.js?331a1bb5:11404) at function.a.B.i (packed_libs.js?331a1bb5:11378) at Function.Pc (packed_libs.js?331a1bb5:11357) at Function.Qc (packed_libs.js?331a1bb5:11357) at Function.aa (packed_libs.js?331a1bb5:11356) at Object.a.m.a.B (packed_libs.js?331a1bb5:11355) at packed_libs.js?331a1bb5:11378 at Object.q (packed_libs.js?331a1bb5:11317) at m (packed_libs.js?331a1bb5:11377)
I get this as well.
Perfect guys, that's what I needed. Quick question, you both are using energy monitoring devices?
Yes I have a HS110 whose readings are showing up in the debug logs but not in the UI.
I just realized that my plug returns different information then your plugs. Are you guys using EU versions? What firmware version is your plug running? Just trying to figure out why the returned data is different.
Yes my plug is bought from Amazon DE and the logs say:
"model":"HS110(EU)"
"sw_ver":"1.5.4 Build 180815 Rel.121440","hw_ver":"2.0"
I think I updated the FW with the Kasa app when I first set up the plug. I didn't create a Kasa-account so the plug only works in my local network.
Ok, thanks. I think I may have an update shortly to test. Having to take into account the two separate formats.
I just pushed an update that should help with it displaying data for my friends over the pond, but it's got some little weird quirk relative to the plug being off which might be ok (when it's 0 it doesn't display anything). Also, need to work out updating the sidebar when the plug is toggled via the navbar. I probably need to tweak the units on those measures though, as I'm not sure what the difference may be relative to the different regions. If you guys could take a look and let me know if that works for you that would be great.
Thanks for the update!
Now I see the readings in the UI as you expected. The units are a bit wrong. It reports: total_wh = 9631 Wh which needs to be divided by 1000 to get 9.63 kWh power_mw = 235630 mW which needs to be divided by 1000 to get 235.63 W.
Thanks, that's what I thought might be the case.
Just updated the 0.9.8 branch with these tweaks and conditional display of sidebar panel for non energy monitoring devices. Still need to program some changes to incorporate updating current readings when the device is toggled to prevent "frozen" data. For example, the sidebar panel showing ~8 W for power when the plug is off, refreshing the page will sync things back up or if polling is enabled, upon next check it should update.
Thanks for the new version. Yes the sidebar is now shown. But it seems that there is no refreshing of the values until you press F5 to reload the side. Is this the way it should work? Moreover the values are not the same like in the Kasa App. For example the sidebar shows a Total Consumption of 0.00 kWh and the Kasa App shows 0.59 kWh.
Thanks. Yes, enable polling in the settings and it will refresh. Should also refresh while printing at every percentage change.
would be nice also if there was a setting in the back end to turn this off for those of us that don't have one of these plugs so it is not showing on the front page all the time.
The sidebar panel should hide if your device does not support energy monitoring. If it is showing after loading there is an issue with your instance and would need to check if the are errors in your browser's console or in the logs.
How do I do that.
Here is what the chrome console shows.
This page includes a password or credit card input in a non-secure context. A warning has been added to the URL bar. For more information, see https://goo.gl/zmWq3m.
packed_core.js?024ebb0a:15129 Starting dependency resolution...
packed_core.js?024ebb0a:15239 ... dependency resolution done
packed_core.js?024ebb0a:15543 Initial application setup done, connecting to server...
packed_core.js?024ebb0a:13279 Connected to the server
packed_core.js?024ebb0a:15521 Finalizing application startup
packed_core.js?024ebb0a:15405 Going to bind 36 view models...
packed_plugins.js?c9d73e65:1784 checking removed
packed_core.js?024ebb0a:15458 Did not bind view model SoftwareUpdateViewModel to target #softwareupdate_confirmation_dialog since it does not exist
packed_core.js?024ebb0a:15458 Did not bind view model SoftwareUpdateViewModel to target #wizard_plugin_softwareupdate since it does not exist
packed_core.js?024ebb0a:2443 User removed logged in
packed_core.js?024ebb0a:15497 ... binding done
packed_core.js?024ebb0a:15517 Application startup complete
packed_plugins.js?c9d73e65:1757 {currentState: "off", emeter: null, ip: "removed"}
packed_plugins.js?c9d73e65:1760 {autoConnect: ƒ, autoConnectDelay: ƒ, autoDisconnect: ƒ, autoDisconnectDelay: ƒ, btnColor: ƒ, …}
I have been looking through the log files also I see no errors in there but not really sure what to look for. I turned on debugging log in the plugin backend but I don't know where those logs are at.
Ok, I see from your screenshot that you have a theme installed, probably themify? That may be causing the sidebar to show when it shouldn't, can you try disabling that and confirming for me? Which one do you have and applied?
It done it before I installed that plugin. I have disable almost all plugins and tried it and it still shows it. I just disabled that plugin again and restarted the pi and it still shows up.
Look in settings logging section and get octoprint.log and the tplink log and upload here.
What language is that in the plugin log file?? I think this is what your wanting. plugin_tplinksmartplug_debug.log octoprint.log
@12345Josparky, that's odd there doesn't seem to be any errors at all so it shouldn't be showing for you. Did you upgrade the plugin from a previous version to the energy monitoring version or install from scratch the latest version?
It is a new install I just done so this one is not been updated but it done it on both the one I had updated and this new one.
I have the HS105 if that helps any
Is there a way I can just edit the css to hide it.
Ok I was able to use the custom css rules in themify and hide it that way but if you would like to trouble shoot it for a permanent fix just let me know what you need from me.
New version I've been working on adds energy logging and adds a tab to graph the logged data. Currently only working for US devices if I'm not mistaken due to the way the plug reports the information back. I will be expanding it to support the devices that report total_wh vs total
,current_ma vs current
, and power_mw vs power
in the near future for users like @KissmanCZ .
Again, you may need to enable polling, otherwise it should log at every percent change during printing. The above screenshot was with 1 minute polling interval so it's really busy looking. If you'd like to test and provide feedback please do so by installing using the url below in plugin manager.
https://github.com/jneilliii/OctoPrint-TPLinkSmartplug/archive/0.9.15.zip
Loving to see that this is being worked on, unfortunately I'm in the UK so I believe this won't currently work for me?
That latest version with the tab will not yet I don't think because the data is returned in different units and I haven't had the chance to account for that yet if I remember correctly. It's been hectic at work so plugin development has been put on hold.
For the extra £5 I got the energy monitoring version, it would be nice if the plug-in could be extended to use this feature.