Home assistant with xioami human sensor.

I wanted to automate fan, so that whenever someone is there it will turn on or off.

Same with light.

I want to automation to run from 11 in the morning till midnight and then it will manually run over alexa or voice.

For light the timing would be 6pm till midnight and then remains on.

Can this be done with Alexa, Home Automation on rasberry pi and sonoff wifi switches?

I’ve not tried this using Sonoff, but it sounds like it can be done. I’ve got similar automations. I’m running hass.io on a Raspberry Pi, using the default installation method. I’ve got the Xiaomi human body sensor connected to a Dresden electric DeConzz stick. (I’ve also used Xiaomi sensors connected to smartthings, but there was too much lag). I’ve got some Xiaomi sensors also connected to the Xiaomi hub, and that’s connected to Hass.io as well. (I’ve found it’s easier to pair the sensors with the Xiaomi hub than it is with the Deconzz stick). As for turning on fans and lights, you can use an automation that will flip things on or off when presence is detected, and adding automation “conditions” will restrict it to the times you want. It sounds like you might be new to Home assistant though - please keep in mind, Hass.io is not an “off the shelf” consumer ready product. You will need to read the documentation on automation if you want to setup complex conditional logic.

I am experimenting with it right now.

It’s a shame that Hass.io cannot be used on Windows.

Experimenting with Home Assistant.

So far working good.

But now searching for sonoff config.