Help me with my Schoolsoft project?

Im new to python and would like some experienced guidance in how to create this Connector.

The idea is to pass the userid/pwd to a site that my Childs uses and retrieve the lunch menu.
They uses a site called Schoolsoft.

The result from the lunch menu should be passed, per weekday back to 5 sensors, one for each schoolday.

I have done some things but can’t make it to work and are pretty sure that there are a few things that needs correction. eg. the pass of data from site to 5 sensors.

Anyone up for advices or would like to get payed to develop this for me?


Schoolsoft lunchmeny

import logging

import voluptuous as vol

import homeassistant.helpers.config_validation as cv
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle

_LOGGER = logging.getLogger(__name__)

# Validation of the user's configuration
	vol.Required(CONF_SCHOOL): cv.string,
	vol.Required(CONF_USERNAME): cv.string,
	vol.Required(CONF_PASSWORD): cv.string,
	vol.Required(CONF_USERTYPE): cv.string

def setup_platform(hass, config, add_devices, discovery_info=None):
	sensor_name = CONF_NAME
	school = config.get(CONF_SCHOOL)
	username = config.get(CONF_USERNAME)
	password = config.get(CONF_PASSWORD)
	usertype = config.get(CONF_USERTYPE)
    sensor_name = 'Lunchmenu'


class Schoolsoft(Entity):
	"""Implementation of the schoolsoft sensor."""

	def __init__(self, sensor_name, matsedel, school, username, password, usertype):
		"""Initialize the sensor."""
		self._name = sensor_name
		self._state = None
		self._data = {}
		self.update() = school
		self.username = username
		self.password = password
		self.usertype = usertype

		self.cookies = {}

		_login_page_re = r"https://sms(\d*)"
		self._login_page_re = re.compile(_login_page_re % school)

	def name(self):
		"""Return the name of the sensor."""
		return self._name

	def state(self):
		"""Return the state of the sensor."""
		return self._state

	def icon(self):
		"""Icon to use in the frontend, if any."""
		return 'mdi:food'

    def try_get(self, url, attempts = 0):
		r = requests.get(url, cookies=self.cookies)

		login_page_match = self._login_page_re.match(r.url)
		if login_page_match:
			server_n = login_page_match.groups()
			if attempts < 1:
				# Sends a post request with self.username && self.password
				loginr =, data = {
					"action": "login",
					"usertype": self.usertype,
					"ssusername": self.username,
					"sspassword": self.password
					}, cookies=self.cookies, allow_redirects=False)

				# Saves login cookie for faster access after first call
				self.cookies = loginr.cookies

				return self.try_get(url, attempts+1)
				raise AuthFailure("Invalid username or password")
			return r

	def update(self):

		menu_html = self.try_get("{}/jsp/student/right_student_lunchmenu.jsp?menu=lunchmenu".format(
		menu = BeautifulSoup(menu_html.text, "html.parser")

		lunch_menu = []

		for div in menu.find_all("td", {"style": "word-wrap: break-word"}):
			food_info = div.get_text(separator=u"<br/>").split(u"<br/>")

		self._state = true

No-one that can offer to help?

I made a bash-script to get info from schoolsoft. PM if you want it.