-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
homebridge-sma-home-manager #527
Comments
✅ Pre-checks completed successfully. |
A basic config of
sends Homebridge into a crash loop:
Also does your plugin ever wait for the
and the icon never turning to green? |
(Over here it typically takes a few seconds to discover the devices, connect, and then launch.) |
Hi @wimleers Re (1) - there are still plenty of users who configure stuff directly with JSON, so we just need to make sure that any 'config issues' are caught properly by its plugin - to make sure that it does not send homebridge into a crash loop and therefore not stop any other plugin from functioning. Re (2) - okay 👍 - no action needed from you, thanks for explaining |
Makes sense, will address that! |
Great! Once ready, please reply on here with a comment just saying |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I will follow up on this in the coming week. |
I can't seem to find documentation on what the recommended pattern is for when the configuration is not valid, in either of these places:
So I went with Released in https://github.com/wimleers/homebridge-sma-home-manager/releases/tag/1.1.4. |
/check |
✅ Pre-checks completed successfully. |
Hi @wimleers thanks for trying to sort this out. The issue remains that you are throwing an error here. In my case I just installed your plugin via the homebridge-config-ui-x, and when the config screen appeared I just clicked save straight away (and then enabled child bridge). This results in a config of:
This is sending homebridge into a crash loop with this error:
I appreciate there are not any best practice guides with what to do in the case that a user has an invalid config. What I personally do with my plugins is just to log a warning that the config is invalid and stop the plugin from loading any more. For example in your code here: I would simply use a return statement
so that the user (assuming they look at the logs) can see that there is an issue with the config, but by not throwing an error, this does not send homebridge into a crash loop and so does not affect other plugins. |
Will do. Thanks for taking the time to elaborate! |
… plugin is misconfigured. See homebridge/plugins#527 (comment).
/check |
The following pre-checks failed: ❌ Failed to test plugin. Comment |
One question I have is why the long plugin name like I'm not familiar with the sma brand, but does your plugin generally support all their devices? |
No, it doesn't. I'd say >90% of SMA users are consumers with a solar (photovoltaic) inverter of theirs: https://www.sma.de/en/products/solar-inverters The remaining 10% is probably divided between:
For all of the above, the SMA Home Manager (https://www.sma.de/en/products/monitoring-control/sunny-home-manager) is an optional add-on. But only with this do you get correct/complete production & consumption information. And only this broadcasts it in real time (one UDP packet per second, broadcast via IP multicast): Watt produced and consumed. That's why I specifically named it "SMA Home Manager", because without it, this plugin is useless. It does also specifically talk to the solar inverter, but only for: live So:
(I bet that was more information you were hoping for? 😅 ) |
A yes or no would have been sufficient for me (!) but actually your extended response will be useful for a paper trail on here, so thank you for the detail, it's good for reference. Especially if there is ever a future I am just personally on a bit of a mission at the moment to try and keep plugins with simple names where appropriate. |
(Back from vacation.) It doesn't crash. It doesn't find the necessary devices. Why would it make sense to have the circular icon to turn green, if none of the required devices are present? The log entries are crystal clear, I think? If I allow this to launch when no devices are discovered, that would indeed result in a nice "green circular icon". But it'd have one disastrous consequence in case of an ephemeral networking problem that'd prevent the devices from being discovered (e.g. multicasting broke due to router/switch settings changes): HomeKit would think the accessories have been removed, and would automatically also remove them from all automations. (I know this because I had it happen early on during development. 😨) I'd much rather have my Homebridge plugins tell me explicitly that the necessary devices are missing and refuse to boot than to potentially quietly mess up my carefully curated automations! |
/check |
✅ Pre-checks completed successfully. |
Hi @wimleers I appreciate your response. For platform type plugins, the aim of the green light in the homebridge ui is that that plugin has successfully loaded and started. Not necessarily that it has found every accessory that it is expecting. We are trying to avoid the log message of
Are you on the Homebridge discord group? Happy to have a 1:1 message about this |
But if the required hardware is absent or temporarily inaccessible over the network, how does it make sense to make the plugin conclude "success!" and omit the yet-to-be-connected-to accessory, which then results in all automations getting broken? 🙃 🤔 The only alternative I see to fulfill both needs (1. avoid messing up users' automations, 2. always starting the plugin) is to only try for ~30 seconds and if it's not found by then, to just expose the accessories anyway but make them do nothing. I'll make that happen. 👍 |
Before you start making these changes let me have a discussion with some other maintainers. I do see your side of this too 😃 |
Hi @wimleers We believe that you are facing the accessory-resetting option because you are not making use of the homebridge cache accessory feature that platform-based plugins should use. I will reply again with more info... |
I know I have mentioned the discord thing before, i would really like to help you get this plugin looking great, discord is basically like 'slack' but a homebridge community, and totally happy to have a 1:1 chat with you to explain about cached accessories. I would find this much easier than trying to let it all out in one github post!! A signup link is here https://discord.gg/kqNCe2D and once you have registered you can just find me and send me a DM my username is |
Why do this in real-time chat when none of us are likely to be online at the same time? And if we'd communicate async there, then how is it any better from discussing it here? IOW: why not use this very GitHub issue? I'm used to seeing dozens or hundreds of comments on issues/tickets/PRs/MRs (I work on open source PHP software for my day job), because that results in linkable, searchable discussions that allow understanding why certain decisions were made years later. That'd allow you to point to the discussion/guidance you'd provide here rather than having to do it all over again for somebody else.
No, I'm facing that because I followed the developer docs at https://github.com/homebridge/homebridge-examples#platform-plugins, which says:
That's a perfect fit for my use case! It is impossible for an additional PV inverter or energy manager to appear out of nowhere. IOW: there is no need for dynamic accessory discovery. But you're now telling me that I should not expose an accessory that I do not know for certain will have a successful connection. AFAICT that implies that one should never use a static platform? If so, why is it in the official examples to this day? At this point, it honestly feels rather arbitrary to not grant my plugin the "Verified" stamp. My plugin boots even when you do not have the necessary hardware, and it gives you actionable, precise feedback. Besides, the only reason it does not boot for you is because you don't have the hardware. If I install an app on my smart phone that requires certain hardware to be connected, you also expect it to launch and inform you, right? Isn't this similar to that? That's far better than most verified Homebridge plugins I've used. Just now, I was trying https://github.com/produdegr/homebridge-3em-energy-meter, which is also verified. This is the experience for that: (You can see that it connected, received a response, but is just endlessly failing at parsing the response.) I've had similarly bad experiences with:
I'm definitely willing to make the changes mentioned in #527 (comment). But refactoring from static to dynamic platform is wrong AFAICT. I tried to follow the prescribed best practices when I refactored the unmaintained & unreliable https://github.com/codyc1515/homebridge-sma-inverter project (but thankfully somebody built that! Otherwise getting started would've been much harder!) into something that works reliably. The examples still list it, so surely it still is a recommended approach? I'd really like that "Verified" badge to encourage more people to save energy in their home. I can't believe I've been trying this for >6 months at this point. 😞 As a fellow open source maintainer, I applaud your relentless attention to the end user experience! 😊 👏 But AFAICT this plugin is already more reliable than most plugins I've tried. With more precise guidance. With clearer docs. With actual responses from the maintainer. So … why is it not good enough? |
Point taken I won't ask again!
Understood. We are trying to urge developers to always use dynamic-platform-type plugins. About a month ago I updated the homebridge wiki to just have links to the dynamic-platform type template as well as the camera-plugin template. Sorry it has been a lot of to-ing and fro-ing, but I really am taking into account now what you have said in your last reply, and this verification process in this case I totally understand has been very frustrating for you. This really was never my intention 😅 let me re-run the checks and have another ponder... |
/check |
✅ Pre-checks completed successfully. |
Everything Looks Good! |
Congratulations! Your plugin has been verified. You can now add the Verified by Homebridge badge to your plugin's README:
Your plugin is now also eligible to display a ❤️ Donate button on its tile in the Homebridge UI. See https://github.com/homebridge/homebridge/wiki/Donation-Links for instructions. If for any reason in the future you can no longer maintain your plugin, please consider transferring it to our unmaintained plugins repo. We can take ownership until another willing developer comes along. Don't forget to join the official Homebridge Discord server, where plugin developers can get tips and advice from other developers and the Homebridge project team in the #plugin-development channel! Thank you for your contribution to the Homebridge Community. |
Hi, i have the latest homebridge 1.6.1 with node.js version 18.16.0 running on a raspberry pi 4 with Buster. I tried to install homebridge-sma-home-manager v1.1.8 (2023-09-03) and get the following error messages
Do i do something wrong? Thank you. |
Link To GitHub Repo
https://github.com/wimleers/homebridge-sma-home-manager
Link To NPM Package
https://www.npmjs.com/package/homebridge-sma-home-manager
The text was updated successfully, but these errors were encountered: