In this paper, we investigate the joint optimisation of spectrum access and the transmission power for an energy harvesting cognitive sensor node, which operates in time-slotted fashion with causal knowledge of channel conditions along with the energy harvesting states. Allowing for the sensing imperfection, we formulate this joint optimisation problem as an infinite-horizon discrete time Markov decision process (MDP), in which the cognitive sensor aims at maximising the long-term expected throughput. An optimal policy which specifies the spectrum access decision as well as the power level is proposed. It is indicated that the optimal long-term expected throughput is non decreasing with the battery available energy. Moreover, we introduce a low-complexity policy and prove that the optimal low-complexity policy has a threshold structure with respect to the battery available energy. An efficient algorithm for deriving the optimal low-complexity policy is introduced. Finally, numerical results are presented to confirm the superiority of proposed policies.