farmbot v6.0.0 Farmbot.BotState View Source

State tree of the bot.

Link to this section Summary

Types

Instance of this module

t()

Bot State

Functions

Forces a dispatch to all the clients

Start the Bot State Server

Subscribe to updates from the bot

Unsubscribes from the bot state tracker. returns a boolean where true means the called pid was actually subscribed and false means it was not actually subscribed

Link to this section Types

Link to this type state_server() View Source
state_server() :: GenServer.server

Instance of this module.

Link to this type t() View Source
t() :: %Farmbot.BotState{configuration: Farmbot.BotState.Configuration.t, informational_settings: Farmbot.BotState.InformationalSettings.t, jobs: %{optional(binary) => Farmbot.BotState.Job.t}, location_data: Farmbot.BotState.LocationData.t, mcu_params: Farmbot.BotState.McuParams.t, pins: %{optional(number) => Farmbot.BotState.Pin.t}, process_info: Farmbot.BotState.ProcessInfo.t, user_env: %{optional(binary) => binary}}

Bot State

Link to this section Functions

Link to this function force_dispatch(state_server) View Source
force_dispatch(state_server) :: :ok

Forces a dispatch to all the clients.

Start the Bot State Server.

Link to this function subscribe(state_tracker) View Source
subscribe(state_server) :: :ok | {:error, :already_subscribed}

Subscribe to updates from the bot.

Updates

Updates will come in randomly in the shape of {:bot_state, state} where state is a BotState struct.

Link to this function unsubscribe(state_tracker) View Source
unsubscribe(state_server) :: boolean

Unsubscribes from the bot state tracker. returns a boolean where true means the called pid was actually subscribed and false means it was not actually subscribed.