Closed MGPhil closed 2 years ago
I wouldn't want to change the current behavior for your very special use case but you could simply change this line to include 5 and 30 (searching home and going home) so it would still be "on" while going home and only turn "off" when its actually home. Of course that would also mean that when you turn it off manually the switch would turn back on in HomeKit until its really back on the dock.
Another option would be to add an optional contact sensor for the dock but I don't think I'll get around to adding that any time soon. If you want to add it yourself you can send send a Pull Request for that and I'll integrate it.
I think the first option will not work as to send the landroid home the switch will be off shortly triggering the door close automation.
A Contact Sensor that tells if landroid is docked/home would be the perfect solution.
I have never done a pull or code change on github but if you tell me were to start in your code I could give it a try as writing code is something I am not unfamiliar.
The current error contact sensor would be an example for adding a contact sensor (look for ContactSensor
in the code). The optional rain sensor is an example for how to add optional "Services" when the mower is created in HomeKit in the LandroidAccessory
constructor. Don't forget adding the switch to the config.schema.json
file for UI access. The actual updateValue
message for the sensor would happen in the LandroidAccessory.prototype.landroidUpdate
method.
Hope this helps, its not too much work but I have several code projects lying dormant atm due to lack of time so as said I won't get around to working on this any time soon. Maybe for you its a good learning project to get into Homebridge development though, I can do code reviews from my mobile in case you get around to doing a PR 🙂
Same Idea on my end to use the contact sensor as „template“ with the optional feature of the rain sensor.
Will do a fork in the next days and try my best including testing on my side until the pull request.
Lets see how it works ;-)
Started already a bit and one question came up when I read your code, how do I distinguish between the 2 contact sensors in the code?
At this line there is only a reference to the ContactSensor but if I have now two in the code how does that need to look like? this.accessory.getService(Service.ContactSensor).getCharacteristic(Characteristic.ContactSensorState).on('get',` this.getContactSensorState.bind(this));
If you can help me out here I think I can finish the rest tomorrow morning, quite late at my end now ;-)
Good question, I guess you'll have to look for a name or something. Finding the right method for that might not be that easy as we're in plain JS without any option for code completion or the likes. This is the library that provides the Service classes, you'll probably have to dig in that code/documentation: https://github.com/homebridge/HAP-NodeJS
Idk if you're lucky and getServices() always returns all services in the same order.. But you might be able to JSON.stringify
whatever you get back to look for an option to discern.
Done, tested and pull request created. Hope everything is correct like I did it, as mentioned first time working with github ;-)
Thank you very much, the PR has been merged and the update published to NPM.
Thank you too for merging and educating me about github and homekit/homebridge, was a pleasure working with you
Hi, first of all thanks for the great plugin really appreciate it.
I have my landroid behind an automatic door charging and start it like following: Open the automatic door and wait 2 minutes Turn the landroid switch on to start to cut the lawn After some cutting time turn off the landroid switch again Wait for 5 min until the landroid hopefully find home in the dock and door can close safely. Worked great for some weeks now but this time the landroid stuck in the automatic door and the door need some repair, landroid is fine luckily.
Of course I could increase the 5min but using time for such thing is not nice, would it be possible to have an additional switch that only tells if the landroid is standing in the docking station not mowing? Then I could use that switch for closing the door.
Thanks
Philipp